import { ChangeDetectionStrategy, Component, input, output, computed, inject } from '@angular/core'; import { CommonModule } from '@angular/common'; import { CdkMenuModule } from '@angular/cdk/menu'; import { RouterModule } from '@angular/router'; import { ThemeService } from '../../../services/theme/theme.service'; export interface NavItem { icon: string; label: string; route?: string; } export interface ChatHistoryItem { id: string; title: string; } @Component({ selector: 'app-sidebar', standalone: true, imports: [CommonModule, RouterModule, CdkMenuModule], changeDetection: ChangeDetectionStrategy.OnPush, templateUrl: './sidebar.component.html', styleUrl: './sidebar.component.css', }) export class SidebarComponent { private readonly themeService = inject(ThemeService); readonly isOpen = input(false); readonly userName = input('Peyman Honarjoo'); readonly navItems = input([ { icon: 'M12 5v14M5 12h14', label: 'چت جدید', route: '/', }, { icon: 'M4 4v16h16M8 20V11M12.5 20V6M17 20V9', label: 'گزارشات', route: '/reports', }, { icon: 'M2 4h20v12H2zM8 20h8M12 16v4', label: 'والبورد', route: '/wallboard', }, { icon: 'M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71', label: 'ارتباط با کال سنتر', route: '/call-center', }, { icon: 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3', label: 'بازخوانی تماس‌ها از کال سنتر', route: '/call-center/calls', }, { icon: 'M7.9 20A9 9 0 1 0 4 16.1L2 22Z', label: 'سوالات چت وب اپلیکیشن', route: '/chat-questions', }, { icon: 'M19.14 12.94c.04-.3.06-.61.06-.94s-.02-.64-.07-.94l2.03-1.58a.5.5 0 0 0 .12-.64l-1.92-3.32a.5.5 0 0 0-.61-.22l-2.39.96a7.3 7.3 0 0 0-1.63-.94l-.36-2.54A.49.49 0 0 0 13.87 2h-3.84a.49.49 0 0 0-.49.42L9.18 4.96c-.59.23-1.14.55-1.63.94l-2.39-.96a.5.5 0 0 0-.61.22L2.63 8.48a.5.5 0 0 0 .12.64l2.03 1.58a7 7 0 0 0 0 1.88l-2.03 1.58a.5.5 0 0 0-.12.64l1.92 3.32c.13.22.39.31.61.22l2.39-.96c.49.39 1.04.71 1.63.94l.36 2.54c.03.24.24.42.49.42h3.84c.25 0 .46-.18.49-.42l.36-2.54c.59-.23 1.14-.55 1.63-.94l2.39.96c.22.09.48 0 .61-.22l1.92-3.32a.5.5 0 0 0-.12-.64zM12 15.5a3.5 3.5 0 1 1 0-7 3.5 3.5 0 0 1 0 7z', label: 'تنظیمات', route: '/settings', }, ]); readonly chatHistory = input([]); readonly close = output(); readonly navClick = output(); readonly open = output(); // Profile page is disabled; the account-menu entry is commented out in the template. // readonly profileClick = output(); readonly logoutClick = output(); readonly userInitials = computed(() => { const name = this.userName(); return name .split(' ') .map((n) => n[0]) .join('') .slice(0, 2) .toUpperCase(); }); readonly isDarkMode = this.themeService.isDarkMode; toggleTheme(): void { this.themeService.toggleDarkMode(); } onNavClick(): void { this.navClick.emit(); } onLogoClick(): void { if (!this.isOpen()) { this.open.emit(); } } }