// components/Navbar.tsx 'use client'; import React from 'react'; import { LayoutDashboard, CalendarCheck, GitPullRequest, GraduationCap, Settings, Plus, Download, Upload, Database, Sparkles, } from 'lucide-react'; interface NavbarProps { activeTab: string; setActiveTab: (tab: any) => void; overdueCount?: number; dueTodayCount?: number; onOpenNewLead?: () => void; onNewLead?: () => void; onExportExcel?: () => void; onImportExcel?: () => void; onImportSuccess?: () => void; } export function Navbar({ activeTab, setActiveTab, overdueCount = 0, dueTodayCount = 0, onOpenNewLead, onNewLead, onExportExcel, onImportExcel, onImportSuccess, }: NavbarProps) { const fileInputRef = React.useRef(null); const [isImporting, setIsImporting] = React.useState(false); const handleUploadFile = async (e: React.ChangeEvent) => { const file = e.target.files?.[0]; if (!file) return; const formData = new FormData(); formData.append('file', file); setIsImporting(true); try { const res = await fetch('/api/import', { method: 'POST', body: formData, }); if (res.ok) { alert('فایل اکسل با موفقیت وارد و لیدها ثبت شدند.'); if (onImportSuccess) onImportSuccess(); } else { const d = await res.json(); alert('خطا در ایمپورت اکسل: ' + (d.error || 'فرمت نامعتبر')); } } catch (err: any) { alert('خطا در آپلود فایل: ' + err.message); } finally { setIsImporting(false); if (e.target) e.target.value = ''; } }; const handleOpenNewLead = onOpenNewLead || onNewLead || (() => {}); const handleOpenImport = () => { if (fileInputRef.current) fileInputRef.current.click(); else if (onImportExcel) onImportExcel(); }; const navItems = [ { id: 'dashboard', label: 'داشبورد مدیریتی', icon: LayoutDashboard }, { id: 'today', label: 'وظایف امروز', icon: CalendarCheck, badge: dueTodayCount, isAlert: overdueCount > 0, }, { id: 'pipeline', label: 'پایپ‌لاین فروش', icon: GitPullRequest }, { id: 'onboarding', label: 'آنبوردینگ مشتریان', icon: GraduationCap }, { id: 'settings', label: 'تنظیمات و قوانین', icon: Settings }, ]; return (
{/* Logo & Platform Info */}
E
اکیپا CRM اتاق‌های فرار

سیستم جذب، فروش و آنبوردینگ

{/* Segmented Pill Tabs */} {/* Action Toolbar */}
{/* Mobile Subnav */}
{navItems.map((item) => { const Icon = item.icon; const isActive = activeTab === item.id; return ( ); })}
); }