diff --git a/index.html b/index.html index 1d2df14..6e11214 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - VdcScore Live Editor + Admin VdcScore
diff --git a/src/App.tsx b/src/App.tsx index 98d61e6..9b66da4 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,5 @@ -import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; +import { BrowserRouter as Router, Routes, Route, Navigate, Outlet } from 'react-router-dom'; +import { AuthProvider, useAuth } from './lib/AuthContext'; import Layout from './components/layout/Layout'; import Dashboard from './pages/Dashboard'; import Clubs from './pages/Clubs'; @@ -6,33 +7,58 @@ import Standings from './pages/Standings'; import Games from './pages/Games'; import LiveEditor from './pages/LiveEditor'; import LiveGames from './pages/LiveGames'; +import Players from './pages/Players'; +import Scorers from './pages/Scorers'; +import Login from './pages/Login'; +import Settings from './pages/Settings'; -// Placeholder components for other pages +// Protected Route Component +const ProtectedRoute = () => { + const { isAuthenticated } = useAuth(); + + if (!isAuthenticated) { + return ; + } + + return ; +}; + +// Placeholder for News screen if not created yet const Placeholder = ({ title }: { title: string }) => (
-

{title}

+

{title}

Esta funcionalidade será implementada brevemente.

); function App() { return ( - - - }> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - - - + + + + } /> + + {/* Wrapper containing layout for all subroutes */} + }> + }> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + + + {/* Catch all redirecting to home which is protected */} + } /> + + + ); } diff --git a/src/components/clubs/ClubCard.tsx b/src/components/clubs/ClubCard.tsx index 6342bef..9fcb185 100644 --- a/src/components/clubs/ClubCard.tsx +++ b/src/components/clubs/ClubCard.tsx @@ -4,9 +4,11 @@ import { MapPin, Trophy } from 'lucide-react'; interface ClubCardProps { club: Club; + onDetailsClick: () => void; + onEditClick: () => void; } -const ClubCard: React.FC = ({ club }) => { +const ClubCard: React.FC = ({ club, onDetailsClick, onEditClick }) => { return (
@@ -52,10 +54,16 @@ const ClubCard: React.FC = ({ club }) => {
- -
diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx index d394241..57176d3 100644 --- a/src/components/layout/Sidebar.tsx +++ b/src/components/layout/Sidebar.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import { NavLink } from 'react-router-dom'; +import { NavLink, useNavigate } from 'react-router-dom'; +import { useAuth } from '../../lib/AuthContext'; import { LayoutDashboard, Trophy, @@ -13,6 +14,15 @@ import { } from 'lucide-react'; const Sidebar = () => { + const { logout } = useAuth(); + const navigate = useNavigate(); + + + const handleLogout = () => { + logout(); + navigate('/login'); + }; + const menuItems = [ { icon: LayoutDashboard, label: 'Dashboard', path: '/' }, { icon: Zap, label: 'Jogos Live', path: '/games/live' }, @@ -20,47 +30,60 @@ const Sidebar = () => { { icon: Trophy, label: 'Classificação', path: '/standings' }, { icon: Users, label: 'Clubes', path: '/clubs' }, { icon: User, label: 'Jogadores', path: '/players' }, - { icon: BarChart, label: 'Artilheiros', path: '/scorers' }, + { icon: BarChart, label: 'Melhores Marcadores', path: '/scorers' }, ]; return ( -