diff --git a/src/App.js b/src/App.js index cba1eaf..f51dcc8 100644 --- a/src/App.js +++ b/src/App.js @@ -4,27 +4,41 @@ import { Sidebar, Header } from './components/Layout'; import { DashboardCards } from './components/Dashboard'; import RequestTable from './components/Requests/RequestTable'; import RequestForm from './components/Requests/RequestForm'; +import ScheduledPage from './components/Scheduled/ScheduledPage'; function App() { const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); + const [activeView, setActiveView] = useState('dashboard'); // 'dashboard' | 'scheduled' const handleToggleMobileMenu = () => setIsMobileMenuOpen(!isMobileMenuOpen); + const handleNavigate = (key) => { + setActiveView(key); + setIsMobileMenuOpen(false); + }; + + const headerTitle = activeView === 'scheduled' ? 'Solicitudes Programadas' : 'Dashboard'; return (
-
-
- -
- - -
-
+
+ {activeView === 'scheduled' ? ( + + ) : ( +
+ +
+ + +
+
+ )}
); diff --git a/src/components/Layout/Header.js b/src/components/Layout/Header.js index 1125410..bdc002f 100644 --- a/src/components/Layout/Header.js +++ b/src/components/Layout/Header.js @@ -1,7 +1,7 @@ import React from 'react'; import '../../styles/components.css'; -const Header = () => { +const Header = ({ title = 'Dashboard' }) => { const handleLogout = () => { try { localStorage.setItem('auth', 'false'); @@ -10,11 +10,13 @@ const Header = () => { window.location.reload(); }; + const iconClass = title === 'Solicitudes Programadas' ? 'fas fa-calendar-alt' : 'fas fa-tachometer-alt'; + return (
- - Dashboard + + {title}
diff --git a/src/components/Layout/Sidebar.js b/src/components/Layout/Sidebar.js index d9f46c7..475cb4b 100644 --- a/src/components/Layout/Sidebar.js +++ b/src/components/Layout/Sidebar.js @@ -1,16 +1,21 @@ import React from 'react'; import '../../styles/components.css'; -const Sidebar = ({ isMobileMenuOpen, onToggleMobileMenu }) => { +const Sidebar = ({ isMobileMenuOpen, onToggleMobileMenu, activeView = 'dashboard', onNavigate }) => { const navItems = [ - { icon: 'fas fa-tachometer-alt', label: 'Dashboard', active: true, badge: null }, - { icon: 'fas fa-list', label: 'Solicitudes Programadas', active: false, badge: '12' }, - { icon: 'fas fa-plus-circle', label: 'Crear Solicitud', active: false, badge: null }, - { icon: 'fas fa-history', label: 'Historial', active: false, badge: null }, - { icon: 'fas fa-cog', label: 'Configuración', active: false, badge: null }, - { icon: 'fas fa-question-circle', label: 'Ayuda', active: false, badge: null } + { key: 'dashboard', icon: 'fas fa-tachometer-alt', label: 'Dashboard', badge: null }, + { key: 'scheduled', icon: 'fas fa-list', label: 'Solicitudes Programadas', badge: null }, + { key: 'create', icon: 'fas fa-plus-circle', label: 'Crear Solicitud', badge: null }, + { key: 'history', icon: 'fas fa-history', label: 'Historial', badge: null }, + { key: 'settings', icon: 'fas fa-cog', label: 'Configuración', badge: null }, + { key: 'help', icon: 'fas fa-question-circle', label: 'Ayuda', badge: null } ]; + const handleClick = (e, key) => { + e.preventDefault(); + onNavigate?.(key); + }; + return ( <> + )} +
+
+
+ + +
+
+
+ + +
+
+ + +
+
+ + {item.scheduleType === 'cron' ? ( +
+ + +
+ ) : ( +
+ + +
+ )} + +
+ +