feat: implement user profile management (Fase 2)
- Add useProfile hook for managing user data - Add Profile page to view/edit user information - Add Settings layout with sidebar navigation - Add Settings pages: Profile, Password, Notifications, Account - Add user dropdown menu in Header with Profile/Settings links - Add protected routes for /settings/* pages - Implement profile update and password change functionality Completes Fase 2 of frontend missing features analysis from todo.md
This commit is contained in:
+30
-11
@@ -1,5 +1,5 @@
|
||||
import { Suspense, lazy } from 'react';
|
||||
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
||||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
|
||||
import { QueryProvider } from './providers/QueryProvider';
|
||||
import { ThemeProvider } from './providers/ThemeProvider';
|
||||
import { AuthProvider } from './contexts/AuthContext';
|
||||
@@ -22,6 +22,11 @@ const Login = lazy(() => import('./pages/Login').then(m => ({ default: m.Login }
|
||||
const Register = lazy(() => import('./pages/Register').then(m => ({ default: m.Register })));
|
||||
const ForgotPassword = lazy(() => import('./pages/ForgotPassword').then(m => ({ default: m.ForgotPassword })));
|
||||
const ResetPassword = lazy(() => import('./pages/ResetPassword').then(m => ({ default: m.ResetPassword })));
|
||||
const SettingsLayout = lazy(() => import('./pages/settings/SettingsLayout').then(m => ({ default: m.SettingsLayout })));
|
||||
const SettingsProfile = lazy(() => import('./pages/settings/SettingsProfile').then(m => ({ default: m.SettingsProfile })));
|
||||
const SettingsPassword = lazy(() => import('./pages/settings/SettingsPassword').then(m => ({ default: m.SettingsPassword })));
|
||||
const SettingsNotifications = lazy(() => import('./pages/settings/SettingsNotifications').then(m => ({ default: m.SettingsNotifications })));
|
||||
const SettingsAccount = lazy(() => import('./pages/settings/SettingsAccount').then(m => ({ default: m.SettingsAccount })));
|
||||
const ApiKeys = lazy(() => import('./pages/ApiKeys').then(m => ({ default: m.ApiKeys })));
|
||||
const AnalyticsDashboard = lazy(() => import('./pages/AnalyticsDashboard').then(m => ({ default: m.AnalyticsDashboard })));
|
||||
const NotFound = lazy(() => import('./pages/NotFound').then(m => ({ default: m.NotFound })));
|
||||
@@ -75,16 +80,30 @@ function App() {
|
||||
<Route path="/forgot-password" element={<ForgotPassword />} />
|
||||
<Route path="/reset-password" element={<ResetPassword />} />
|
||||
|
||||
{/* Protected routes with layout */}
|
||||
<Route path="/" element={<ProtectedLayout />}>
|
||||
<Route index element={<Dashboard />} />
|
||||
<Route path="scenarios" element={<ScenariosPage />} />
|
||||
<Route path="scenarios/:id" element={<ScenarioDetail />} />
|
||||
<Route path="scenarios/:id/reports" element={<Reports />} />
|
||||
<Route path="compare" element={<Compare />} />
|
||||
<Route path="settings/api-keys" element={<ApiKeys />} />
|
||||
<Route path="analytics" element={<AnalyticsDashboard />} />
|
||||
</Route>
|
||||
{/* Protected routes with layout */}
|
||||
<Route path="/" element={<ProtectedLayout />}>
|
||||
<Route index element={<Dashboard />} />
|
||||
<Route path="scenarios" element={<ScenariosPage />} />
|
||||
<Route path="scenarios/:id" element={<ScenarioDetail />} />
|
||||
<Route path="scenarios/:id/reports" element={<Reports />} />
|
||||
<Route path="compare" element={<Compare />} />
|
||||
<Route
|
||||
path="settings"
|
||||
element={
|
||||
<SettingsLayout>
|
||||
<Routes>
|
||||
<Route index element={<Navigate to="/settings/profile" replace />} />
|
||||
<Route path="profile" element={<SettingsProfile />} />
|
||||
<Route path="password" element={<SettingsPassword />} />
|
||||
<Route path="notifications" element={<SettingsNotifications />} />
|
||||
<Route path="account" element={<SettingsAccount />} />
|
||||
<Route path="api-keys" element={<ApiKeys />} />
|
||||
</Routes>
|
||||
</SettingsLayout>
|
||||
}
|
||||
/>
|
||||
<Route path="analytics" element={<AnalyticsDashboard />} />
|
||||
</Route>
|
||||
|
||||
{/* 404 */}
|
||||
<Route path="*" element={<NotFound />} />
|
||||
|
||||
Reference in New Issue
Block a user