feat(admin): collapsible sidebar and responsive data tables with custom scroll
This commit is contained in:
1 parent
b98c6bb457
commit
8a3adacd38
7 files changed
+171
-49
No files matched your search
@@ -1,12 +1,14 @@
|
||||
import { useState, useRef, useEffect } from 'react';
|
||||
import { useNavigate, Link } from 'react-router-dom';
|
||||
import { Search, UserCircle, Menu, Activity, ShieldCheck, MessageSquare, Calendar, Clock, RefreshCw } from 'lucide-react';
|
||||
import { Search, UserCircle, Menu, Activity, ShieldCheck, MessageSquare, Calendar, Clock, RefreshCw, PanelRightClose, PanelRightOpen } from 'lucide-react';
|
||||
import { toast } from 'react-hot-toast';
|
||||
import api from '../services/api';
|
||||
import { useAdminAuthStore } from '../store/adminAuthStore';
|
||||
|
||||
interface TopbarProps {
|
||||
toggleMenu: () => void;
|
||||
isCollapsed?: boolean;
|
||||
toggleCollapse?: () => void;
|
||||
}
|
||||
|
||||
const SEARCHABLE_PAGES = [
|
||||
@@ -57,7 +59,7 @@ interface LiveMonitoringSummary {
|
||||
};
|
||||
}
|
||||
|
||||
export default function Topbar({ toggleMenu }: TopbarProps) {
|
||||
export default function Topbar({ toggleMenu, isCollapsed, toggleCollapse }: TopbarProps) {
|
||||
const navigate = useNavigate();
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
const [showResults, setShowResults] = useState(false);
|
||||
@@ -207,6 +209,18 @@ export default function Topbar({ toggleMenu }: TopbarProps) {
|
||||
<Menu className="w-5 h-5" />
|
||||
</button>
|
||||
|
||||
{toggleCollapse && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={toggleCollapse}
|
||||
className="hidden lg:flex p-2 text-gray-500 hover:text-purple-700 hover:bg-purple-50 rounded-xl transition-colors cursor-pointer shrink-0 border border-gray-200"
|
||||
title={isCollapsed ? 'باز کردن سایدبار' : 'کوچک کردن سایدبار'}
|
||||
aria-label={isCollapsed ? 'باز کردن سایدبار' : 'کوچک کردن سایدبار'}
|
||||
>
|
||||
{isCollapsed ? <PanelRightOpen className="w-5 h-5" /> : <PanelRightClose className="w-5 h-5" />}
|
||||
</button>
|
||||
)}
|
||||
|
||||
<div className="relative w-full">
|
||||
<div className="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">
|
||||
<Search className="w-4 h-4 text-gray-400" />
|
||||
|
||||
Reference in new issue
Block a user