feat: Added notifications outbox to admin panel
This commit is contained in:
14
src/app/admin-view/toolbar/toolbar.component.html
Normal file
14
src/app/admin-view/toolbar/toolbar.component.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<mat-toolbar color="accent">
|
||||
<button mat-icon-button (click)="drawer.toggle()"><mat-icon>menu</mat-icon></button>
|
||||
<span>{{title.getTitle()}}</span>
|
||||
<span style="flex: 1 1 auto"></span>
|
||||
<button mat-icon-button *ngIf="toolbar.menu" [matMenuTriggerFor]="menu" (click)="openMenu()"><mat-icon>more_vert</mat-icon></button>
|
||||
</mat-toolbar>
|
||||
<mat-menu #menu="matMenu">
|
||||
@for (item of _menu; track $index) {
|
||||
<button mat-menu-item *ngIf="item.check ?? true" (click)="toolbar.comp[item.fn]()">
|
||||
<mat-icon *ngIf="item.icon">{{item.icon}}</mat-icon>
|
||||
<span>{{item.title}}</span>
|
||||
</button>
|
||||
}
|
||||
</mat-menu>
|
||||
0
src/app/admin-view/toolbar/toolbar.component.scss
Normal file
0
src/app/admin-view/toolbar/toolbar.component.scss
Normal file
23
src/app/admin-view/toolbar/toolbar.component.spec.ts
Normal file
23
src/app/admin-view/toolbar/toolbar.component.spec.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ToolbarComponent } from './toolbar.component';
|
||||
|
||||
describe('ToolbarComponent', () => {
|
||||
let component: ToolbarComponent;
|
||||
let fixture: ComponentFixture<ToolbarComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ToolbarComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ToolbarComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
26
src/app/admin-view/toolbar/toolbar.component.ts
Normal file
26
src/app/admin-view/toolbar/toolbar.component.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Component, Input, ViewChild } from '@angular/core';
|
||||
import { MatDrawer } from '@angular/material/sidenav';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import { ToolbarService } from './toolbar.service';
|
||||
import { MatMenuTrigger } from '@angular/material/menu';
|
||||
|
||||
@Component({
|
||||
selector: 'app-toolbar',
|
||||
templateUrl: './toolbar.component.html',
|
||||
styleUrl: './toolbar.component.scss'
|
||||
})
|
||||
export class ToolbarComponent {
|
||||
@Input() drawer!: MatDrawer;
|
||||
@ViewChild(MatMenuTrigger) trigger!: MatMenuTrigger;
|
||||
|
||||
protected _menu?: typeof this.toolbar.menu
|
||||
|
||||
constructor(readonly title: Title, protected toolbar: ToolbarService) {
|
||||
|
||||
}
|
||||
|
||||
openMenu () {
|
||||
this._menu = this.toolbar.menu
|
||||
this.trigger.openMenu()
|
||||
}
|
||||
}
|
||||
16
src/app/admin-view/toolbar/toolbar.service.spec.ts
Normal file
16
src/app/admin-view/toolbar/toolbar.service.spec.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ToolbarService } from './toolbar.service';
|
||||
|
||||
describe('ToolbarService', () => {
|
||||
let service: ToolbarService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ToolbarService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
11
src/app/admin-view/toolbar/toolbar.service.ts
Normal file
11
src/app/admin-view/toolbar/toolbar.service.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ToolbarService {
|
||||
|
||||
public comp?: any;
|
||||
public menu?: {title: string, check?: boolean, icon?: string, fn: string}[]
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user