Refactored dashboard

This commit is contained in:
2026-09-29 11:41:14 +02:00
parent c805a31824
commit 8643b2625b
11 changed files with 11906 additions and 15 deletions
+42 -12
View File
@@ -1,11 +1,23 @@
import React from 'react';
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
import { QueryClientProvider } from '@tanstack/react-query';
import { queryClient } from './lib/queryClient';
import { AuthProvider, useAuth } from './auth/AuthProvider';
import { LandingPage } from './components/landing/LandingPage';
import { AppNavbar } from './components/layout/AppNavbar';
import { DashboardPage } from './components/dashboard/DashboardPage';
function AppContent() {
function AuthenticatedLayout() {
return (
<div className="min-h-screen bg-slate-950 text-slate-100 flex flex-col selection:bg-emerald-500/20 selection:text-emerald-300">
<main className="flex-1 w-full max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 md:py-12">
<DashboardPage />
</main>
</div>
);
}
function AppRoutes() {
const { isAuthenticated, isLoading, login } = useAuth();
if (isLoading) {
@@ -19,17 +31,33 @@ function AppContent() {
);
}
if (!isAuthenticated) {
return <LandingPage onLogin={login} isLoading={isLoading} />;
}
return (
<div className="min-h-screen flex flex-col bg-slate-950 text-slate-100">
<AppNavbar />
<main className="flex-1 mx-auto w-full max-w-7xl px-4 sm:px-6 lg:px-8 py-8">
{/* Clean empty workspace ready for user instructions */}
</main>
</div>
<Routes>
<Route
path="/"
element={
isAuthenticated ? (
<Navigate to="/dashboard" replace />
) : (
<LandingPage onLogin={login} isLoading={isLoading} />
)
}
/>
<Route
path="/dashboard"
element={
isAuthenticated ? (
<AuthenticatedLayout />
) : (
<LandingPage onLogin={login} isLoading={isLoading} />
)
}
/>
<Route
path="*"
element={<Navigate to={isAuthenticated ? "/dashboard" : "/"} replace />}
/>
</Routes>
);
}
@@ -37,7 +65,9 @@ export default function App() {
return (
<QueryClientProvider client={queryClient}>
<AuthProvider>
<AppContent />
<BrowserRouter>
<AppRoutes />
</BrowserRouter>
</AuthProvider>
</QueryClientProvider>
);