کانینا | ادمینپنل
@@ -92,6 +112,11 @@ export default function Sidebar({ isOpen, setIsOpen }: SidebarProps) {
>
{item.label}
+ {item.label === 'سفارشات' && newOrdersCount > 0 && (
+
+ {newOrdersCount}
+
+ )}
);
})}
diff --git a/frontend/admin-panel/src/components/Topbar.tsx b/frontend/admin-panel/src/components/Topbar.tsx
index 5c7a334..666c29c 100644
--- a/frontend/admin-panel/src/components/Topbar.tsx
+++ b/frontend/admin-panel/src/components/Topbar.tsx
@@ -1,13 +1,57 @@
+import { useState, useRef, useEffect } from 'react';
+import { useNavigate } from 'react-router-dom';
import { Bell, Search, UserCircle, Menu } from 'lucide-react';
interface TopbarProps {
toggleMenu: () => void;
}
+const SEARCHABLE_PAGES = [
+ { label: 'داشبورد (خلاصه وضعیت فروشگاه)', path: '/' },
+ { label: 'گزارشات کامل فروش و بازدیدها', path: '/reports' },
+ { label: 'مدیریت سفارشات مشتریان', path: '/orders' },
+ { label: 'مدیریت محصولات فروشگاه', path: '/products' },
+ { label: 'دستهبندیهای محصولات (Categories)', path: '/categories' },
+ { label: 'کدهای تخفیف و کوپنهای خرید', path: '/coupons' },
+ { label: 'مدیریت کاربران و مشتریان سایت', path: '/users' },
+ { label: 'مدیریت سگها و گربهها (Pets)', path: '/pets' },
+ { label: 'مدیریت مقالات وبلاگ', path: '/blogs' },
+ { label: 'مدیریت دانشنامه و مقالات علمی (Wiki)', path: '/wiki' },
+ { label: 'تنظیمات کلی سیستم و درگاه پرداخت', path: '/settings' },
+ { label: 'متون رابط کاربری و ترجمهها', path: '/ui-texts' },
+ { label: 'مدیریت رسانه، عکسها و گالری', path: '/media' },
+];
+
export default function Topbar({ toggleMenu }: TopbarProps) {
+ const navigate = useNavigate();
+ const [searchQuery, setSearchQuery] = useState('');
+ const [showResults, setShowResults] = useState(false);
+ const searchContainerRef = useRef
(null);
+
+ // Close search results dropdown on clicking outside
+ useEffect(() => {
+ const handleClickOutside = (event: MouseEvent) => {
+ if (searchContainerRef.current && !searchContainerRef.current.contains(event.target as Node)) {
+ setShowResults(false);
+ }
+ };
+ document.addEventListener('mousedown', handleClickOutside);
+ return () => document.removeEventListener('mousedown', handleClickOutside);
+ }, []);
+
+ const filteredResults = SEARCHABLE_PAGES.filter(page =>
+ page.label.toLowerCase().includes(searchQuery.toLowerCase())
+ );
+
+ const handleResultClick = (path: string) => {
+ navigate(path);
+ setSearchQuery('');
+ setShowResults(false);
+ };
+
return (
-
+
);
})}