Refactor sidebar and menu items

This commit is contained in:
gpt-engineer-app[bot]
2025-10-11 15:33:49 +00:00
parent f373119fe4
commit 447eadd88c
3 changed files with 128 additions and 24 deletions

View File

@@ -273,14 +273,6 @@ const AppRouter = () => (
</ProtectedRoute> </ProtectedRoute>
} /> } />
<Route path="/dashboard/security" element={
<ProtectedRoute>
<DashboardLayout>
<Security />
</DashboardLayout>
</ProtectedRoute>
} />
<Route path="/dashboard/vehicle-management" element={ <Route path="/dashboard/vehicle-management" element={
<ProtectedRoute> <ProtectedRoute>
<DashboardLayout> <DashboardLayout>
@@ -514,13 +506,6 @@ const AppRouter = () => (
</DashboardLayout> </DashboardLayout>
</ProtectedRoute> </ProtectedRoute>
} /> } />
<Route path="/dashboard/personalization" element={
<ProtectedRoute>
<DashboardLayout>
<Personalization />
</DashboardLayout>
</ProtectedRoute>
} />
{/* Catch-all route */} {/* Catch-all route */}
<Route path="*" element={<NotFound />} /> <Route path="*" element={<NotFound />} />

View File

@@ -115,7 +115,10 @@ const DashboardLayout = ({ children }: { children: React.ReactNode }) => {
}, },
{ icon: AlertTriangle, label: 'Emergencias', path: '/dashboard/admin?tab=emergency' }, { icon: AlertTriangle, label: 'Emergencias', path: '/dashboard/admin?tab=emergency' },
{ icon: MessageSquare, label: 'Soporte', path: '/dashboard/admin?tab=support' }, { icon: MessageSquare, label: 'Soporte', path: '/dashboard/admin?tab=support' },
{ icon: Settings, label: 'Configuración', path: '/dashboard/admin?tab=config' } { icon: Settings, label: 'Configuración', path: '/dashboard/admin?tab=config' },
{ icon: BarChart3, label: 'Analytics', path: '/dashboard/analytics' },
{ icon: Search, label: 'Buscar Lugares', path: '/dashboard/search-places' },
{ icon: Store, label: 'Buscar Comercios', path: '/dashboard/search-establishments' }
] ]
}, },
{ {
@@ -157,8 +160,6 @@ const DashboardLayout = ({ children }: { children: React.ReactNode }) => {
{ icon: Users, label: t('staff'), path: '/dashboard/restaurant/staff' } { icon: Users, label: t('staff'), path: '/dashboard/restaurant/staff' }
] ]
}, },
{ icon: Brain, label: 'Personalization', path: '/dashboard/personalization' },
{ icon: Shield, label: 'Security', path: '/dashboard/security' },
{ icon: Car, label: 'Vehicle Management', path: '/dashboard/vehicle-management' }, { icon: Car, label: 'Vehicle Management', path: '/dashboard/vehicle-management' },
{ icon: Leaf, label: 'Sustainability', path: '/dashboard/sustainability' }, { icon: Leaf, label: 'Sustainability', path: '/dashboard/sustainability' },
{ {

View File

@@ -1,5 +1,5 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { Settings, Cog, Database, Wifi, Shield, Server, Key, Users, Activity, RefreshCw, TestTube, Edit, Save, X, CreditCard, Eye, EyeOff } from 'lucide-react'; import { Settings, Cog, Database, Wifi, Shield, Server, Key, Users, Activity, RefreshCw, TestTube, Edit, Save, X, CreditCard, Eye, EyeOff, Brain } from 'lucide-react';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input'; import { Input } from '@/components/ui/input';
import { Switch } from '@/components/ui/switch'; import { Switch } from '@/components/ui/switch';
@@ -7,6 +7,14 @@ import { Badge } from '@/components/ui/badge';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { useSystemConfig } from '@/hooks/useSystemConfig'; import { useSystemConfig } from '@/hooks/useSystemConfig';
import ThreatDetection from '@/components/security/ThreatDetection';
import AccessControl from '@/components/security/AccessControl';
import AuditLogs from '@/components/security/AuditLogs';
import ComplianceMonitor from '@/components/security/ComplianceMonitor';
import AIRecommendations from '@/components/personalization/AIRecommendations';
import UserPreferences from '@/components/personalization/UserPreferences';
import BehaviorAnalytics from '@/components/personalization/BehaviorAnalytics';
import SegmentManagement from '@/components/personalization/SegmentManagement';
interface ConfigTabProps { interface ConfigTabProps {
isAdmin: boolean; isAdmin: boolean;
@@ -85,7 +93,7 @@ const ConfigTab: React.FC<ConfigTabProps> = ({ isSuperAdmin }) => {
<h2 className="text-xl font-semibold text-gray-900">Configuración del Sistema</h2> <h2 className="text-xl font-semibold text-gray-900">Configuración del Sistema</h2>
<Tabs defaultValue="apis" className="w-full"> <Tabs defaultValue="apis" className="w-full">
<TabsList className="grid w-full grid-cols-6"> <TabsList className="grid w-full grid-cols-8 lg:grid-cols-8">
<TabsTrigger value="apis" className="flex items-center gap-2"> <TabsTrigger value="apis" className="flex items-center gap-2">
<Server className="w-4 h-4" /> <Server className="w-4 h-4" />
APIs APIs
@@ -102,14 +110,22 @@ const ConfigTab: React.FC<ConfigTabProps> = ({ isSuperAdmin }) => {
<Wifi className="w-4 h-4" /> <Wifi className="w-4 h-4" />
Integraciones Integraciones
</TabsTrigger> </TabsTrigger>
<TabsTrigger value="security" className="flex items-center gap-2"> <TabsTrigger value="system-security" className="flex items-center gap-2">
<Shield className="w-4 h-4" /> <Shield className="w-4 h-4" />
Seguridad Seguridad Sistema
</TabsTrigger> </TabsTrigger>
<TabsTrigger value="audit" className="flex items-center gap-2"> <TabsTrigger value="audit" className="flex items-center gap-2">
<Activity className="w-4 h-4" /> <Activity className="w-4 h-4" />
Auditoría Auditoría
</TabsTrigger> </TabsTrigger>
<TabsTrigger value="security" className="flex items-center gap-2">
<Shield className="w-4 h-4" />
Security Center
</TabsTrigger>
<TabsTrigger value="personalization" className="flex items-center gap-2">
<Brain className="w-4 h-4" />
Personalización
</TabsTrigger>
</TabsList> </TabsList>
<TabsContent value="apis" className="space-y-4"> <TabsContent value="apis" className="space-y-4">
@@ -548,12 +564,12 @@ const ConfigTab: React.FC<ConfigTabProps> = ({ isSuperAdmin }) => {
</Card> </Card>
</TabsContent> </TabsContent>
<TabsContent value="security" className="space-y-4"> <TabsContent value="system-security" className="space-y-4">
<Card> <Card>
<CardHeader> <CardHeader>
<CardTitle className="flex items-center gap-2"> <CardTitle className="flex items-center gap-2">
<Shield className="w-5 h-5" /> <Shield className="w-5 h-5" />
Configuración de Seguridad Configuración de Seguridad del Sistema
</CardTitle> </CardTitle>
</CardHeader> </CardHeader>
<CardContent> <CardContent>
@@ -632,6 +648,108 @@ const ConfigTab: React.FC<ConfigTabProps> = ({ isSuperAdmin }) => {
</CardContent> </CardContent>
</Card> </Card>
</TabsContent> </TabsContent>
<TabsContent value="security" className="space-y-6">
<div className="space-y-6">
<div className="flex items-center gap-3">
<Shield className="w-8 h-8 text-orange-600" />
<div>
<h3 className="text-2xl font-bold text-gray-900">Security Center</h3>
<p className="text-gray-600">Monitor y gestión de seguridad del sistema</p>
</div>
</div>
<Tabs defaultValue="threats" className="space-y-6">
<TabsList className="grid w-full grid-cols-4 lg:w-auto">
<TabsTrigger value="threats">Threat Detection</TabsTrigger>
<TabsTrigger value="access">Access Control</TabsTrigger>
<TabsTrigger value="audit-logs">Audit Logs</TabsTrigger>
<TabsTrigger value="compliance">Compliance</TabsTrigger>
</TabsList>
<TabsContent value="threats">
<ThreatDetection />
</TabsContent>
<TabsContent value="access">
<AccessControl />
</TabsContent>
<TabsContent value="audit-logs">
<AuditLogs />
</TabsContent>
<TabsContent value="compliance">
<ComplianceMonitor />
</TabsContent>
</Tabs>
</div>
</TabsContent>
<TabsContent value="personalization" className="space-y-6">
<div className="space-y-6">
<div className="flex items-center gap-3">
<Brain className="w-8 h-8 text-orange-600" />
<div>
<h3 className="text-2xl font-bold text-gray-900">Personalización con IA</h3>
<p className="text-gray-600">Gestión de recomendaciones y segmentación de usuarios</p>
</div>
</div>
<Tabs defaultValue="recommendations" className="space-y-6">
<TabsList className="grid w-full grid-cols-4 lg:w-auto">
<TabsTrigger value="recommendations">Recomendaciones</TabsTrigger>
<TabsTrigger value="preferences">Preferencias</TabsTrigger>
<TabsTrigger value="analytics-behavior">Analytics</TabsTrigger>
<TabsTrigger value="segments">Segmentos</TabsTrigger>
</TabsList>
<TabsContent value="recommendations">
<Card>
<CardHeader>
<CardTitle>Recomendaciones IA</CardTitle>
</CardHeader>
<CardContent>
<AIRecommendations />
</CardContent>
</Card>
</TabsContent>
<TabsContent value="preferences">
<Card>
<CardHeader>
<CardTitle>Preferencias de Usuario</CardTitle>
</CardHeader>
<CardContent>
<UserPreferences />
</CardContent>
</Card>
</TabsContent>
<TabsContent value="analytics-behavior">
<Card>
<CardHeader>
<CardTitle>Analytics de Comportamiento</CardTitle>
</CardHeader>
<CardContent>
<BehaviorAnalytics />
</CardContent>
</Card>
</TabsContent>
<TabsContent value="segments">
<Card>
<CardHeader>
<CardTitle>Gestión de Segmentos</CardTitle>
</CardHeader>
<CardContent>
<SegmentManagement />
</CardContent>
</Card>
</TabsContent>
</Tabs>
</div>
</TabsContent>
</Tabs> </Tabs>
</div> </div>
); );