diff --git a/src/app/components/shared/header/header.component.html b/src/app/components/shared/header/header.component.html index e20a4639c5af547f9f044b27d21439b73cb87f3f..974f28b7fa6cd5b25261c6305a7bd563d0779f87 100644 --- a/src/app/components/shared/header/header.component.html +++ b/src/app/components/shared/header/header.component.html @@ -7,7 +7,13 @@ <span class="fill-remaining-space"></span> <h3 *ngIf="router.url.includes('comments') && user.role === 1" fxLayoutAlign="center center"> <mat-icon>access_time</mat-icon> - {{cTime}}</h3> + {{cTime}} + </h3> + <span class="fill-remaining-space" + *ngIf="router.url.includes('comments') && user.role === 1 && deviceType === 'desktop'"></span> + <h3 *ngIf="router.url.includes('comments') && user.role === 1 && deviceType === 'desktop'" fxLayoutAlign="center center"> + ID: {{roomId}} + </h3> <span class="fill-remaining-space"></span> <mat-menu class="color-menu" #themeMenu="matMenu" [overlapTrigger]="false"> diff --git a/src/app/components/shared/header/header.component.ts b/src/app/components/shared/header/header.component.ts index d6869ef1bf0bbd26646c1c81d2f2a2e577972f15..3f5f4a04faf0d7f597ddd42206aeadc59c360ca3 100644 --- a/src/app/components/shared/header/header.component.ts +++ b/src/app/components/shared/header/header.component.ts @@ -20,6 +20,8 @@ export class HeaderComponent implements OnInit { user: User; themeClass = localStorage.getItem('theme'); cTime: string; + roomId: string; + deviceType = localStorage.getItem('deviceType'); constructor(public location: Location, private authenticationService: AuthenticationService, @@ -42,14 +44,20 @@ export class HeaderComponent implements OnInit { this.translationService.setDefaultLang(localStorage.getItem('currentLang')); } this.authenticationService.watchUser.subscribe(newUser => this.user = newUser); + this.getRoomId(); let time = new Date(); this.getTime(time); setInterval(() => { time = new Date(); this.getTime(time); + this.getRoomId(); }, 1000); } + public getRoomId() { + this.roomId = localStorage.getItem('shortId'); + } + getTime(time: Date) { const hh = ('0' + time.getHours()).substr(-2); const mm = ('0' + time.getMinutes()).substr(-2); @@ -68,10 +76,6 @@ export class HeaderComponent implements OnInit { this.location.back(); } - goToHomepage() { - this.router.navigate(['/home']); - } - useLanguage(language: string) { this.translationService.use(language); localStorage.setItem('currentLang', language); diff --git a/src/app/components/shared/room-list/room-list.component.html b/src/app/components/shared/room-list/room-list.component.html index af77f8f0b9a26e0fe8f0552b830b9988f4aa6bac..5321c817819a5214118233dd3861c21004b35c64 100644 --- a/src/app/components/shared/room-list/room-list.component.html +++ b/src/app/components/shared/room-list/room-list.component.html @@ -13,7 +13,7 @@ </mat-expansion-panel> <mat-expansion-panel *ngFor="let room of rooms" class="matPanel"> <mat-expansion-panel-header class="matPanelListHeader"> - <button mat-button routerLink="/{{ baseUrl }}/room/{{ room.shortId }}"> + <button mat-button routerLink="/{{ baseUrl }}/room/{{ room.shortId }}" (click)="setCurrentRoom(room.shortId)"> <mat-icon>input</mat-icon> </button> <mat-panel-title class="panelTitle"> diff --git a/src/app/components/shared/room-list/room-list.component.ts b/src/app/components/shared/room-list/room-list.component.ts index 4dbaa283819e3771484dc2cda32e9769c3b6ad09..e55aaaf4b47e8296903f358b57db4b5b1c0b15a8 100644 --- a/src/app/components/shared/room-list/room-list.component.ts +++ b/src/app/components/shared/room-list/room-list.component.ts @@ -51,4 +51,8 @@ export class RoomListComponent implements OnInit { this.closedRooms = this.rooms.filter(room => room.closed); this.isLoading = false; } + + setCurrentRoom(shortId: string) { + localStorage.setItem('shortId', shortId); + } }