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: 'M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.573-1.066zM15 12a3 3 0 11-6 0 3 3 0 016 0z', label: 'تنظیمات', route: '/settings', }, ]); readonly chatHistory = input([]); readonly close = output(); readonly navClick = output(); readonly open = output(); 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(); } } }