feat: implement tenant branding system and global toast notification service
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
|
||||
import { NgClass } from '@angular/common';
|
||||
import { ToastService, Toast } from '../../../core/services/toast.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-toast-container',
|
||||
imports: [NgClass],
|
||||
templateUrl: './toast-container.component.html',
|
||||
styleUrl: './toast-container.component.scss',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class ToastContainerComponent {
|
||||
private readonly toastService = inject(ToastService);
|
||||
|
||||
readonly toasts = this.toastService.toasts;
|
||||
|
||||
dismiss(id: string): void {
|
||||
this.toastService.dismiss(id);
|
||||
}
|
||||
|
||||
getToastIconClass(type: Toast['type']): string {
|
||||
const icons: Record<Toast['type'], string> = {
|
||||
success: 'fa-solid fa-circle-check',
|
||||
danger: 'fa-solid fa-circle-exclamation',
|
||||
info: 'fa-solid fa-circle-info'
|
||||
};
|
||||
return icons[type] || 'fa-solid fa-bell';
|
||||
}
|
||||
|
||||
getToastBgClass(type: Toast['type']): string {
|
||||
const classes: Record<Toast['type'], string> = {
|
||||
success: 'text-bg-success',
|
||||
danger: 'text-bg-danger',
|
||||
info: 'text-bg-primary'
|
||||
};
|
||||
return classes[type] || 'text-bg-primary';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user