From 723ffce34b75f6ec659efa9811cf87af02f92708 Mon Sep 17 00:00:00 2001 From: bender Date: Wed, 11 Mar 2026 20:29:35 +0000 Subject: [PATCH] Add src/app/dashboard/page.tsx --- src/app/dashboard/page.tsx | 219 +++++++++++++++++++++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 src/app/dashboard/page.tsx diff --git a/src/app/dashboard/page.tsx b/src/app/dashboard/page.tsx new file mode 100644 index 0000000..2163113 --- /dev/null +++ b/src/app/dashboard/page.tsx @@ -0,0 +1,219 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { useRouter } from "next/navigation"; +import { ThemeProvider } from "@/providers/themeProvider/ThemeProvider"; +import NavbarStyleCentered from '@/components/navbar/NavbarStyleCentered/NavbarStyleCentered'; +import FooterBase from '@/components/sections/footer/FooterBase'; +import { LogOut, User, Settings, Bell } from 'lucide-react'; + +interface UserSession { + email: string; + loginTime: string; + token: string; +} + +export default function DashboardPage() { + const router = useRouter(); + const [isLoading, setIsLoading] = useState(true); + const [userSession, setUserSession] = useState(null); + const [lastActivityTime, setLastActivityTime] = useState(""); + + useEffect(() => { + // Check if user is logged in + const isLoggedIn = sessionStorage.getItem('isLoggedIn'); + if (!isLoggedIn) { + router.push('/login'); + return; + } + + // Retrieve session data + const sessionData = localStorage.getItem('userSession'); + if (sessionData) { + const parsed = JSON.parse(sessionData); + setUserSession(parsed); + const loginTime = new Date(parsed.loginTime); + setLastActivityTime(loginTime.toLocaleString('pt-BR')); + } + + setIsLoading(false); + }, [router]); + + const handleLogout = () => { + if (window.confirm('Deseja sair da sua conta?')) { + localStorage.removeItem('userSession'); + sessionStorage.removeItem('isLoggedIn'); + router.push('/'); + } + }; + + if (isLoading) { + return ( +
+
+
+ ); + } + + return ( + + + +
+
+ {/* Welcome Header */} +
+

Bem-vindo de Volta! 👋

+

Sua jornada de fitness começa aqui

+
+ + {/* User Info Card */} + {userSession && ( +
+
+
+
+ +
+
+

Email da Conta

+

{userSession.email}

+

Login: {lastActivityTime}

+
+
+
+ + +
+
+
+ )} + + {/* Dashboard Grid */} +
+ {/* Stats Card 1 */} +
+

Treinos Completos

+

12

+

↑ 2 mais que a semana passada

+
+ + {/* Stats Card 2 */} +
+

Calorias Queimadas

+

2,450

+

Meta: 2,000 calorias

+
+ + {/* Stats Card 3 */} +
+

Sequência de Dias

+

8

+

dias consecutivos ✨

+
+
+ + {/* Quick Actions */} +
+
+

🏋️ Iniciar Treino

+

Comece um treino personalizado com base em sua biometria

+ +
+ +
+

🥗 Plano Nutricional

+

Veja suas refeições planejadas para hoje e suas macros

+ +
+
+ + {/* Session Info */} +
+

Informações da Sessão

+
+

🔐 Token de Sessão: {userSession?.token?.substring(0, 20)}...

+

📱 Navegador: {typeof navigator !== 'undefined' ? navigator.userAgent.substring(0, 50) : 'N/A'}...

+

🌐 Plataforma: {typeof window !== 'undefined' ? window.location.hostname : 'N/A'}

+
+
+ + {/* Logout Button */} +
+ +
+
+
+ + +
+ ); +} \ No newline at end of file