Revert Admin Panel submenus
This commit is contained in:
@@ -47,7 +47,13 @@ import {
|
||||
Receipt,
|
||||
ChefHat,
|
||||
Grid3x3,
|
||||
Package
|
||||
Package,
|
||||
Globe,
|
||||
Compass,
|
||||
Map,
|
||||
Shield,
|
||||
Radio,
|
||||
Sparkles
|
||||
} from 'lucide-react';
|
||||
|
||||
const DashboardLayout = ({ children }: { children: React.ReactNode }) => {
|
||||
@@ -77,7 +83,33 @@ const DashboardLayout = ({ children }: { children: React.ReactNode }) => {
|
||||
{ icon: Users, label: 'Usuarios', path: '/dashboard/admin?tab=users' },
|
||||
{ icon: MapPin, label: 'Proveedores', path: '/dashboard/admin?tab=services' },
|
||||
{ icon: DollarSign, label: 'Financiero', path: '/dashboard/admin?tab=financial' },
|
||||
{ icon: FileText, label: 'Contenido', path: '/dashboard/admin?tab=content' },
|
||||
{
|
||||
icon: FileText,
|
||||
label: 'Contenido',
|
||||
path: '/dashboard/admin?tab=content',
|
||||
subItems: [
|
||||
{ icon: Globe, label: 'Destinos', path: '/dashboard/admin?tab=content-destinations' },
|
||||
{ icon: MapPin, label: 'Lugares', path: '/dashboard/admin?tab=content-places' },
|
||||
{ icon: BookOpen, label: 'Guías', path: '/dashboard/admin?tab=content-guides' },
|
||||
{ icon: Car, label: 'Taxis', path: '/dashboard/admin?tab=content-taxis' },
|
||||
{ icon: Navigation, label: 'Geolocalización', path: '/dashboard/admin?tab=content-geolocation' },
|
||||
{ icon: Megaphone, label: 'Promocional', path: '/dashboard/admin?tab=content-promotional' },
|
||||
{ icon: Sparkles, label: 'AI Guías', path: '/dashboard/admin?tab=content-ai-guides' },
|
||||
{ icon: Eye, label: 'AR Content', path: '/dashboard/admin?tab=content-ar' }
|
||||
]
|
||||
},
|
||||
{
|
||||
icon: Map,
|
||||
label: 'Geolocalización',
|
||||
path: '/dashboard/admin?tab=geofences',
|
||||
subItems: [
|
||||
{ icon: Target, label: 'Geofences', path: '/dashboard/admin?tab=geofences' },
|
||||
{ icon: BarChart3, label: 'Analytics', path: '/dashboard/admin?tab=analytics' },
|
||||
{ icon: Zap, label: 'Testing', path: '/dashboard/admin?tab=testing' },
|
||||
{ icon: Shield, label: 'Emergencia Geo', path: '/dashboard/admin?tab=emergency-geo' },
|
||||
{ icon: Compass, label: 'Navegación', path: '/dashboard/admin?tab=navigation' }
|
||||
]
|
||||
},
|
||||
{ icon: AlertTriangle, label: 'Emergencias', path: '/dashboard/admin?tab=emergency' },
|
||||
{ icon: MessageSquare, label: 'Soporte', path: '/dashboard/admin?tab=support' },
|
||||
{ icon: Settings, label: 'Configuración', path: '/dashboard/admin?tab=config' }
|
||||
@@ -233,17 +265,58 @@ const DashboardLayout = ({ children }: { children: React.ReactNode }) => {
|
||||
<div className="mt-1 ml-10 space-y-1">
|
||||
{item.subItems.map((sub) => {
|
||||
const SubIcon = sub.icon;
|
||||
const activeSubPath = location.pathname === sub.path || location.pathname.startsWith(sub.path);
|
||||
const activeSubPath = location.pathname === sub.path || location.pathname.startsWith(sub.path) || (sub.path.includes('?tab=') && location.search.includes(sub.path.split('?tab=')[1]));
|
||||
const hasSubSubItems = sub.subItems && sub.subItems.length > 0;
|
||||
const isSubExpanded = expandedItems[sub.path] || (hasSubSubItems && sub.subItems.some(subsub => location.search.includes(subsub.path.split('?tab=')[1])));
|
||||
|
||||
return (
|
||||
<div key={sub.path}>
|
||||
<div className="flex items-center justify-between">
|
||||
<Link
|
||||
key={sub.path}
|
||||
to={sub.path}
|
||||
className={`flex items-center space-x-2 px-3 py-2 rounded-md text-sm ${activeSubPath ? 'bg-orange-50 text-orange-800' : 'text-gray-600 hover:text-orange-600 hover:bg-gray-50'}`}
|
||||
className={`flex items-center space-x-2 px-3 py-2 rounded-md text-sm flex-1 ${activeSubPath ? 'bg-orange-50 text-orange-800' : 'text-gray-600 hover:text-orange-600 hover:bg-gray-50'}`}
|
||||
>
|
||||
<SubIcon className="h-4 w-4" />
|
||||
<span>{sub.label}</span>
|
||||
</Link>
|
||||
{hasSubSubItems && (
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
toggleExpanded(sub.path);
|
||||
}}
|
||||
className="p-1 hover:bg-gray-200 rounded mr-1"
|
||||
>
|
||||
{isSubExpanded ? (
|
||||
<ChevronDown className="w-3 h-3" />
|
||||
) : (
|
||||
<ChevronRight className="w-3 h-3" />
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Sub-sub-items */}
|
||||
{hasSubSubItems && isSubExpanded && (
|
||||
<div className="mt-1 ml-6 space-y-1">
|
||||
{sub.subItems.map((subsub) => {
|
||||
const SubSubIcon = subsub.icon;
|
||||
const activeSubSubPath = location.search.includes(subsub.path.split('?tab=')[1]);
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={subsub.path}
|
||||
to={subsub.path}
|
||||
className={`flex items-center space-x-2 px-3 py-1.5 rounded-md text-xs ${activeSubSubPath ? 'bg-orange-50 text-orange-800' : 'text-gray-500 hover:text-orange-600 hover:bg-gray-50'}`}
|
||||
>
|
||||
<SubSubIcon className="h-3 w-3" />
|
||||
<span>{subsub.label}</span>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user