Files
faq_chatbot_frontend/src/app/shared/ui/sidebar/sidebar.component.ts
T
Peyman Honarjoo ff7fcbc4bb build(ui): expand application shell and implement administrative dashboard pages
This commit significantly expands the application's routing, navigation, and administrative capabilities. It introduces several new functional modules and refines the core layout for a more professional, dashboard-oriented experience.

- **Routing & Navigation**:
  - Added routes for `wallboard`, `call-center`, `call-center/calls`, and `chat-questions`.
  - Updated `SidebarComponent` to include all new navigation items.
  - Enhanced `LayoutComponent` with dynamic navigation based on user roles (admin vs. user).
- **New Administrative Pages**:
  - `WallboardPage`: Implements a real-time KPI dashboard with call activity trends and outcome distributions.
  - `CallCenterPage`: Provides a symbolic interface for managing call center connectivity and synchronization.
  - `CallCenterCallsPage`: Implements a call history retrieval interface with filtering capabilities.
  - `ChatQuestionsPage`: Adds a module for reviewing user questions from web and mobile channels.
- **Core Infrastructure & Refinement**:
  - Updated `AppConfig` to include an `APP_INITIALIZER` for validating user identity via `AuthService` on startup.
  - Refined `HomeComponent` layout to a "Claude-style" continuous chat column.
  - Implemented global themed scrollbars and integrated the 'Lahze' font family.
  - Added `proxy.conf.json` and updated `angular.json` to support local backend development.
- **Documentation**:
  - Added comprehensive API handoff guides for frontend-backend connection and MVP API catalog.
2026-10-10 00:20:00 +03:30

101 lines
3.1 KiB
TypeScript

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<boolean>(false);
readonly userName = input<string>('Peyman Honarjoo');
readonly navItems = input<NavItem[]>([
{
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<ChatHistoryItem[]>([]);
readonly close = output<void>();
readonly navClick = output<void>();
readonly open = output<void>();
readonly profileClick = output<void>();
readonly logoutClick = output<void>();
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();
}
}
}