diff --git a/src/app/components/shared/header/header.component.html b/src/app/components/shared/header/header.component.html index a283efc5d4786416fd78a054930efa08fcc6a8c6..90a1a8a815d80472c90c8c2c326b2556a75b121d 100644 --- a/src/app/components/shared/header/header.component.html +++ b/src/app/components/shared/header/header.component.html @@ -5,6 +5,16 @@ <mat-icon class="header-icons" aria-label="Go back">keyboard_arrow_left</mat-icon> </button> <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> + <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"> + {{'header.id' | translate}}: {{ roomId.slice(0,4) }} {{ roomId.slice(4,8) }} + </h3> + <span class="fill-remaining-space"></span> <mat-menu class="color-menu" #themeMenu="matMenu" [overlapTrigger]="false"> <mat-grid-list cols="2"> diff --git a/src/app/components/shared/header/header.component.scss b/src/app/components/shared/header/header.component.scss index f6dd4d3737be2ea35a126aad416b6d0214936374..54179f2278f93bb4b7f05674409d56e684a13f71 100644 --- a/src/app/components/shared/header/header.component.scss +++ b/src/app/components/shared/header/header.component.scss @@ -59,3 +59,7 @@ mat-toolbar { .sessions { color: var(--primary); } + +h3 { + color: var(--on-surface); +} diff --git a/src/app/components/shared/header/header.component.ts b/src/app/components/shared/header/header.component.ts index df26a09a6050c4309796e06a2f234c22a02e6f0f..3f5f4a04faf0d7f597ddd42206aeadc59c360ca3 100644 --- a/src/app/components/shared/header/header.component.ts +++ b/src/app/components/shared/header/header.component.ts @@ -19,6 +19,9 @@ import { ThemeService } from '../../../../theme/theme.service'; 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, @@ -41,6 +44,24 @@ 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); + this.cTime = hh + ':' + mm; } logout() { @@ -55,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); + } } diff --git a/src/assets/i18n/home/de.json b/src/assets/i18n/home/de.json index 0b8b2c13066e248066d49502eccd34f868c8ee26..d277b1a0f2ca6909ae58d1895c210ac97541ce14 100644 --- a/src/assets/i18n/home/de.json +++ b/src/assets/i18n/home/de.json @@ -11,7 +11,8 @@ "change-theme": "Stil ändern", "change-language": "Sprache ändern", "login": "Login", - "my-account": "Mein Account" + "my-account": "Mein Account", + "id": "ID" }, "login-page": { "creator": "Referent/in", diff --git a/src/assets/i18n/home/en.json b/src/assets/i18n/home/en.json index 62c7f5b03aaf24f21eb48a7e1996eaa2d7ed2ebe..9f766813ffb32de3ad0976f4151250d5fa07908b 100644 --- a/src/assets/i18n/home/en.json +++ b/src/assets/i18n/home/en.json @@ -11,7 +11,8 @@ "change-theme": "Change theme", "change-language": "Change language", "login": "Login", - "my-account": "My account" + "my-account": "My account", + "id": "ID" }, "login-page": { "creator": "Speaker",