mirror of
https://github.com/escalante29/WealthySmart.git
synced 2026-05-19 08:48:48 +02:00
All checks were successful
Deploy to VPS / deploy (push) Successful in 34s
Budget: recurring items CRUD, yearly/monthly projections with no-double-count logic, and full UI (overview, monthly detail, recurring items manager). Push notifications: Web Push via VAPID keys, triggered on transaction creation from n8n. Includes service worker handlers, frontend subscription flow, and a test button on the Dashboard (temporary). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
|
import { AuthProvider, useAuth } from './AuthContext';
|
|
import { ThemeProvider } from './ThemeContext';
|
|
import Layout from './components/Layout';
|
|
import Login from './pages/Login';
|
|
import Dashboard from './pages/Dashboard';
|
|
import Budget from './pages/Budget';
|
|
import Analytics from './pages/Analytics';
|
|
|
|
function ProtectedRoute({ children }: { children: React.ReactNode }) {
|
|
const { isAuthenticated } = useAuth();
|
|
return isAuthenticated ? <>{children}</> : <Navigate to="/login" replace />;
|
|
}
|
|
|
|
function AppRoutes() {
|
|
const { isAuthenticated } = useAuth();
|
|
|
|
return (
|
|
<Routes>
|
|
<Route
|
|
path="/login"
|
|
element={isAuthenticated ? <Navigate to="/" replace /> : <Login />}
|
|
/>
|
|
<Route
|
|
element={
|
|
<ProtectedRoute>
|
|
<Layout />
|
|
</ProtectedRoute>
|
|
}
|
|
>
|
|
<Route path="/" element={<Dashboard />} />
|
|
<Route path="/budget" element={<Budget />} />
|
|
<Route path="/analytics" element={<Analytics />} />
|
|
{/* Redirect old routes */}
|
|
<Route path="/transactions" element={<Navigate to="/budget" replace />} />
|
|
<Route path="/transfers" element={<Navigate to="/budget" replace />} />
|
|
</Route>
|
|
</Routes>
|
|
);
|
|
}
|
|
|
|
export default function App() {
|
|
return (
|
|
<BrowserRouter>
|
|
<ThemeProvider>
|
|
<AuthProvider>
|
|
<AppRoutes />
|
|
</AuthProvider>
|
|
</ThemeProvider>
|
|
</BrowserRouter>
|
|
);
|
|
}
|