From f5d22bf83efd4a8bae6f0eba02a9b88ee12b1941 Mon Sep 17 00:00:00 2001 From: 230421 <230421@epvc.pt> Date: Tue, 12 May 2026 16:57:41 +0100 Subject: [PATCH] =?UTF-8?q?adicao=20de=20sistema=20de=20login=20para=20adm?= =?UTF-8?q?ins=20e=20menu=20de=20defini=C3=A7=C3=B5es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 2 +- src/App.tsx | 64 ++++-- src/components/clubs/ClubCard.tsx | 14 +- src/components/layout/Sidebar.tsx | 63 ++++-- src/hooks/useScorers.ts | 45 ++++ src/lib/AuthContext.tsx | 43 ++++ src/pages/Clubs.tsx | 355 +++++++++++++++++++++++++++++- src/pages/Login.tsx | 124 +++++++++++ src/pages/Players.tsx | 354 +++++++++++++++++++++++++++++ src/pages/Scorers.tsx | 257 +++++++++++++++++++++ src/pages/Settings.tsx | 162 ++++++++++++++ src/types/database.ts | 10 + 12 files changed, 1443 insertions(+), 50 deletions(-) create mode 100644 src/hooks/useScorers.ts create mode 100644 src/lib/AuthContext.tsx create mode 100644 src/pages/Login.tsx create mode 100644 src/pages/Players.tsx create mode 100644 src/pages/Scorers.tsx create mode 100644 src/pages/Settings.tsx 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 ( -