mirror of
https://github.com/escalante29/WealthySmart.git
synced 2026-05-19 08:28:48 +02:00
All checks were successful
Deploy to VPS / deploy (push) Successful in 14s
Eye/EyeOff icon next to theme toggle. Persists in localStorage. Applies CSS blur to all elements marked with data-sensitive attribute across Dashboard, Budget, Pensions, Salarios, and Transactions pages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
60 lines
1.8 KiB
TypeScript
60 lines
1.8 KiB
TypeScript
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
|
import { AuthProvider, useAuth } from './AuthContext';
|
|
import { ThemeProvider } from './ThemeContext';
|
|
import { PrivacyProvider } from './PrivacyContext';
|
|
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';
|
|
import Salarios from './pages/Salarios';
|
|
import Pensions from './pages/Pensions';
|
|
|
|
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 />} />
|
|
<Route path="/salarios" element={<Salarios />} />
|
|
<Route path="/pensions" element={<Pensions />} />
|
|
{/* 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>
|
|
<PrivacyProvider>
|
|
<AuthProvider>
|
|
<AppRoutes />
|
|
</AuthProvider>
|
|
</PrivacyProvider>
|
|
</ThemeProvider>
|
|
</BrowserRouter>
|
|
);
|
|
}
|