remove unwanted component for now

This commit is contained in:
NyxiumYuuki 2021-05-28 21:02:59 +02:00
parent c52975ff46
commit 503c0efb49
10 changed files with 4 additions and 255 deletions

View file

@ -1,8 +1,7 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import {AppComponent} from "./app.component";
import {LoginComponent} from "./login/login.component"; import {LoginComponent} from "./login/login.component";
import {PrivateComponent} from "./private/private.component"; import {GeneralComponent} from "./general/general.component";
const routes: Routes = [ const routes: Routes = [
{ {
@ -10,8 +9,8 @@ const routes: Routes = [
component: LoginComponent, component: LoginComponent,
}, },
{ {
path: 'private', path: 'general',
component: PrivateComponent, component: GeneralComponent,
} }
]; ];

View file

@ -2,14 +2,10 @@ import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import {HttpClientModule} from "@angular/common/http"; import {HttpClientModule} from "@angular/common/http";
import {FormsModule, ReactiveFormsModule} from "@angular/forms"; import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { LoginComponent } from './login/login.component'; import { LoginComponent } from './login/login.component';
import { GeneralComponent } from './general/general.component'; import { GeneralComponent } from './general/general.component';
import { PrivateComponent } from './private/private.component';
import { NavbarComponent } from './navbar/navbar.component';
import {CommonModule} from "@angular/common"; import {CommonModule} from "@angular/common";
@ -17,9 +13,7 @@ import {CommonModule} from "@angular/common";
declarations: [ declarations: [
AppComponent, AppComponent,
LoginComponent, LoginComponent,
GeneralComponent, GeneralComponent
PrivateComponent,
NavbarComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,

View file

@ -1 +0,0 @@
<p>navbar works!</p>

View file

@ -1,25 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NavbarComponent } from './navbar.component';
describe('NavbarComponent', () => {
let component: NavbarComponent;
let fixture: ComponentFixture<NavbarComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ NavbarComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(NavbarComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -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 {
}
}

View file

@ -1,55 +0,0 @@
<div class="container-fluid" >
<div class="row">
<div class="col-md-4">
<div class="user-list-card">
<div class="user-card"
>
<!---->
<img src="../../assets/image/user.png" height="25" width="25"/>
<p class="username"></p>
</div>
</div>
</div>
<div class="col-md-8">
<div class="chat-container">
<ng-container *ngIf="selectedUser">
<div class="chat-header">
<p class="username">{{selectedUser?.name}}</p>
</div>
<div class="chat-body">
<div *ngFor="let item of messageArray"
>
<!---->
<p class="message-container">{{item?.message}}</p>
</div>
</div>
<div class="chat-footer">
<div class="row">
<div class="col-md-10">
<div class="form-group mb-0">
<input type="text" placeholder="Entrez votre message" class="form-control"
[(ngModel)]="messageText" (keyup)="$event.keyCode === 13 && sendMessage()"/>
</div>
</div>
<div class="col-md-2 text-center align-self-center">
<button class="btn btn-primary btn-bm px-3 " (click)="sendMessage()">Envoyer</button>
</div>
</div>
</div>
</ng-container>
</div>
</div>
</div>
</div>

View file

@ -1,25 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PrivateComponent } from './private.component';
describe('PrivateComponent', () => {
let component: PrivateComponent;
let fixture: ComponentFixture<PrivateComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ PrivateComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(PrivateComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -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<userList>();
// @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;
}