Skip to content
Snippets Groups Projects
Commit 376e0e81 authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Show room-shortId in header too

parent f42de726
No related merge requests found
......@@ -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">
......
......@@ -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);
......
......@@ -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">
......
......@@ -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);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment