diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index e9d2b65..d5c32ae 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -1,8 +1,7 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; -import {AppComponent} from "./app.component"; import {LoginComponent} from "./login/login.component"; -import {PrivateComponent} from "./private/private.component"; +import {GeneralComponent} from "./general/general.component"; const routes: Routes = [ { @@ -10,8 +9,8 @@ const routes: Routes = [ component: LoginComponent, }, { - path: 'private', - component: PrivateComponent, + path: 'general', + component: GeneralComponent, } ]; diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 15f4949..8748a95 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -2,14 +2,10 @@ import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import {HttpClientModule} from "@angular/common/http"; import {FormsModule, ReactiveFormsModule} from "@angular/forms"; - - import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { LoginComponent } from './login/login.component'; import { GeneralComponent } from './general/general.component'; -import { PrivateComponent } from './private/private.component'; -import { NavbarComponent } from './navbar/navbar.component'; import {CommonModule} from "@angular/common"; @@ -17,9 +13,7 @@ import {CommonModule} from "@angular/common"; declarations: [ AppComponent, LoginComponent, - GeneralComponent, - PrivateComponent, - NavbarComponent + GeneralComponent ], imports: [ BrowserModule, diff --git a/frontend/src/app/navbar/navbar.component.html b/frontend/src/app/navbar/navbar.component.html deleted file mode 100644 index 6bbf8ee..0000000 --- a/frontend/src/app/navbar/navbar.component.html +++ /dev/null @@ -1 +0,0 @@ -

navbar works!

diff --git a/frontend/src/app/navbar/navbar.component.scss b/frontend/src/app/navbar/navbar.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/src/app/navbar/navbar.component.spec.ts b/frontend/src/app/navbar/navbar.component.spec.ts deleted file mode 100644 index f8ccd6f..0000000 --- a/frontend/src/app/navbar/navbar.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { NavbarComponent } from './navbar.component'; - -describe('NavbarComponent', () => { - let component: NavbarComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ NavbarComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(NavbarComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/frontend/src/app/navbar/navbar.component.ts b/frontend/src/app/navbar/navbar.component.ts deleted file mode 100644 index 6a9bec8..0000000 --- a/frontend/src/app/navbar/navbar.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-navbar', - templateUrl: './navbar.component.html', - styleUrls: ['./navbar.component.scss'] -}) -export class NavbarComponent implements OnInit { - - constructor() { } - - ngOnInit(): void { - } - -} diff --git a/frontend/src/app/private/private.component.html b/frontend/src/app/private/private.component.html deleted file mode 100644 index 775a86b..0000000 --- a/frontend/src/app/private/private.component.html +++ /dev/null @@ -1,55 +0,0 @@ -
-
- -
- -
-
- - - -

- -
-
- -
-
- -
- -
-

{{selectedUser?.name}}

-
- -
-
- - -

{{item?.message}}

-
-
- - -
-
-
-
-
diff --git a/frontend/src/app/private/private.component.scss b/frontend/src/app/private/private.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/frontend/src/app/private/private.component.spec.ts b/frontend/src/app/private/private.component.spec.ts deleted file mode 100644 index f2a3e2f..0000000 --- a/frontend/src/app/private/private.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { PrivateComponent } from './private.component'; - -describe('PrivateComponent', () => { - let component: PrivateComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ PrivateComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(PrivateComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/frontend/src/app/private/private.component.ts b/frontend/src/app/private/private.component.ts deleted file mode 100644 index b1a4812..0000000 --- a/frontend/src/app/private/private.component.ts +++ /dev/null @@ -1,123 +0,0 @@ -import {NgModule, Component, OnInit, Input} from '@angular/core'; -import {ChatService} from "../services/chat/chat.service"; -import {FormsModule, ReactiveFormsModule} from "@angular/forms"; -import {AuthService} from "../services/auth/auth.service"; -import {MessageService} from "../services/message/message.service"; -import {MatTableDataSource} from "@angular/material/table"; - - -@Component({ - selector: 'app-private', - templateUrl: './private.component.html', - styleUrls: ['./private.component.scss'] -}) -export class PrivateComponent implements OnInit { - - dataSource = new MatTableDataSource(); - // @ts-ignore - public roomId: string; - // @ts-ignore - public messageText: string; - public messageArray: {user: string, message: string}[] = []; - private storageArray = []; - - // @ts-ignore - public showScreen: boolean; - - // @ts-ignore - public password: string; - // @ts-ignore - public currentUser; - // @ts-ignore - public selectedUser; - - - - constructor( - private Auth: AuthService, - private chatService: ChatService, - private MS: MessageService - - ) { - } - - ngOnInit(): void { - this.MS.sendMessage('Cours/CoursGet', {}).subscribe( send => { - console.log(send.data); - this.dataSource.data = send.data as userList[]; - }); - - // this.chatService.getMessage() - // .subscribe((data: {user: string, message: string}) => { - // this.messageArray.push(data); - // if (this.roomId) { - // setTimeout( () => { - // this.storageArray = this.chatService.getStorage(); - // //@ts-ignore - // const storeIndex = this.storageArray.findIndex((storage) => storage.roomId === this.roomId); - // //@ts-ignore - // this.messageArray = this.storageArray[storeIndex].chats; - // }, 500); - // } - // }); - - } - - // selectUserHandler(login: string): void { - // this.login = login; - // this.selectedUser = this.userList.find(user => user.password === password); - // this.roomId = this.selectedUser.roomId[this.currentUser.id]; - // this.messageArray = []; - // - // // this.storageArray = this.chatService.getStorage(); - // // // @ts-ignore - // // const storeIndex = this.storageArray.findIndex((storage) => storage.roomId === this.roomId); - // // - // // if (storeIndex > -1) { - // // // @ts-ignore - // // this.messageArray = this.storageArray[storeIndex].chats; - // // } - // - // this.join(this.login); - // } - - join(username: string, roomId: string): void { - this.chatService.joinRoom({user: username}); - } - - sendMessage(): void { - this.chatService.sendMessage({ - user: this.currentUser.name, - message: this.messageText - }); - - // this.storageArray = this.chatService.getStorage(); - // // @ts-ignore - // const storeIndex = this.storageArray.findIndex((storage) => storage.roomId === this.roomId); - // - // if (storeIndex > -1) { - // // @ts-ignore - // this.storageArray[storeIndex].chats.push({ - // user: this.currentUser.name, - // message: this.messageText - // }) - // } else { - // const updateStorage = { - // roomId: this.roomId, - // chats: [{ - // user: this.currentUser.name, - // message: this.messageText - // }] - // }; - // // @ts-ignore - // this.storageArray.push(updateStorage); - // } - // this.chatService.setStorage(this.storageArray); - this.messageText = ''; - } - -} - -export interface userList { - login: string; -}