07fec02ea1
- Added logo image to assets. - Implemented RTL support styles in rtlSupport.scss for various components including breadcrumb, datatable, and tree node toggle button. chore: configure environment files for production, staging, and development - Created environment.prod.ts for production settings. - Created environment.staging.ts for staging settings. - Created environment.ts for local development settings. feat: define custom theme preset - Added presets.ts to define a custom theme preset using PrimeUIX with specific component styles and semantic colors. chore: set up proxy configuration for local development
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { MessageService, ToastMessageOptions } from 'primeng/api';
|
|
|
|
interface IToast extends Pick<ToastMessageOptions, 'sticky' | 'life'> {
|
|
title?: string;
|
|
text: string;
|
|
}
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class ToastService {
|
|
constructor(private messageService: MessageService) {}
|
|
|
|
add(message: ToastMessageOptions) {
|
|
if (!message.detail) return;
|
|
this.messageService.add(message);
|
|
}
|
|
|
|
info(message: IToast) {
|
|
const { title = 'اطلاع', text } = message;
|
|
this.add({ ...message, summary: title, detail: text, severity: 'info' });
|
|
}
|
|
|
|
success(message: IToast) {
|
|
const { title = 'موفقیت', text } = message;
|
|
this.add({ ...message, summary: title, detail: text, severity: 'success' });
|
|
}
|
|
|
|
warn(message: IToast) {
|
|
const { title = 'هشدار', text } = message;
|
|
this.add({ ...message, summary: title, detail: text, severity: 'warn' });
|
|
}
|
|
|
|
error(message: IToast) {
|
|
const { title = 'خطا', text } = message;
|
|
this.add({ ...message, summary: title, detail: text, severity: 'error' });
|
|
}
|
|
}
|