[menu] show username at the top of the menu

This commit is contained in:
nymkappa 2023-08-18 18:04:40 +02:00
parent 5aff2c74e6
commit d1c9e8b56e
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
3 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,7 @@
<div class="sidenav" [class]="navOpen ? 'open': 'close'" *ngIf="userMenuGroups$ | async as menuGroups"> <div class="sidenav" [class]="navOpen ? 'open': 'close'" *ngIf="userMenuGroups$ | async as menuGroups">
<nav class="pt-3 pl-4 pr-4"> <nav>
<span *ngIf="userAuth"><strong>@ {{ userAuth.user.username }}</strong></span>
<div *ngFor="let group of menuGroups" style="height: max-content;"> <div *ngFor="let group of menuGroups" style="height: max-content;">
<h6 class="d-flex justify-content-between align-items-center mt-4 mb-2 text-uppercase"> <h6 class="d-flex justify-content-between align-items-center mt-4 mb-2 text-uppercase">
<span>{{ group.title }}</span> <span>{{ group.title }}</span>

View File

@ -37,6 +37,9 @@
} }
.sidenav nav { .sidenav nav {
height: auto; height: auto;
padding-left: 20px;
padding-right: 20px;
padding-top: 30px;
padding-bottom: 50px; padding-bottom: 50px;
@media (max-width: 572px) { @media (max-width: 572px) {
padding-bottom: 100px; padding-bottom: 100px;

View File

@ -12,12 +12,14 @@ import { MenuGroup } from '../../interfaces/services.interface';
export class MenuComponent implements OnInit { export class MenuComponent implements OnInit {
navOpen: boolean = false; navOpen: boolean = false;
userMenuGroups$: Observable<MenuGroup[]> | undefined; userMenuGroups$: Observable<MenuGroup[]> | undefined;
userAuth: any | undefined;
constructor( constructor(
private apiService: ApiService private apiService: ApiService
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
this.userAuth = JSON.parse(localStorage.getItem('auth') || '') ?? null;
this.userMenuGroups$ = this.apiService.getUserMenuGroups$(); this.userMenuGroups$ = this.apiService.getUserMenuGroups$();
} }