Newer
Older
Website / src / app / toolbar / toolbar.component.html
@lukas lukas on 3 Apr 2022 636 bytes add login functionality
<mat-toolbar>
    <mat-toolbar-row>
        <a class="accent" routerLink="/">Lukas Eisenhauer</a>
        <a *ngIf="account.username == ''; else userPanel" class="accent" routerLink="login">Log In</a>
    </mat-toolbar-row>
</mat-toolbar>

<ng-template #userPanel>
    <button mat-stroked-button color="accent" [matMenuTriggerFor]="userActions">
        <h1>{{account.username}}</h1>
    </button>
    <mat-menu #userActions="matMenu">
        <button routerLink="/admin" mat-menu-item>Go to the admin panel</button>
        <button routerLink="/" (click)="account.logout()" mat-menu-item>Log Out</button>
    </mat-menu>
</ng-template>