Files
Novault-Frontend-web/src/router/index.tsx

114 lines
2.8 KiB
TypeScript

import { createBrowserRouter, Navigate } from 'react-router-dom';
import Home from '../pages/Home';
import Transactions from '../pages/Transactions';
import RecurringTransactions from '../pages/RecurringTransactions';
import Accounts from '../pages/Accounts';
import Budget from '../pages/Budget';
import AllocationRules from '../pages/AllocationRules';
import Reports from '../pages/Reports';
import Settings from '../pages/Settings';
import ExchangeRates from '../pages/ExchangeRates';
import LedgerManagePage from '../pages/LedgerManagePage';
import ToolsPage from '../pages/ToolsPage';
import LoanCalculatorPage from '../pages/LoanCalculatorPage';
import TaxCalculatorPage from '../pages/TaxCalculatorPage';
import Login from '../pages/Login/Login';
import Profile from '../pages/Profile';
import GitHubCallback from '../pages/GitHubCallback';
import Notifications from '../pages/Notifications';
import Layout from '../components/common/Layout';
import ProtectedRoute from '../components/common/ProtectedRoute';
/**
* Application Router Configuration
* Defines all routes for the accounting application
*/
export const router = createBrowserRouter([
{
path: '/login',
element: <Login mode="login" />,
},
{
path: '/register',
element: <Login mode="register" />,
},
{
path: '/auth/github/callback',
element: <GitHubCallback />,
},
{
path: '/',
element: <ProtectedRoute><Layout /></ProtectedRoute>,
children: [
{
index: true,
element: <Navigate to="/home" replace />,
},
{
path: 'home',
element: <Home />,
},
{
path: 'transactions',
element: <Transactions />,
},
{
path: 'recurring-transactions',
element: <RecurringTransactions />,
},
{
path: 'accounts',
element: <Accounts />,
},
{
path: 'budget',
element: <Budget />,
},
{
path: 'allocation-rules',
element: <AllocationRules />,
},
{
path: 'reports',
element: <Reports />,
},
{
path: 'notifications',
element: <Notifications />,
},
{
path: 'exchange-rates',
element: <ExchangeRates />,
},
{
path: 'ledgers/manage',
element: <LedgerManagePage />,
},
{
path: 'tools',
element: <ToolsPage />,
},
{
path: 'tools/loan-calculator',
element: <LoanCalculatorPage />,
},
{
path: 'tools/tax-calculator',
element: <TaxCalculatorPage />,
},
{
path: 'settings',
element: <Settings />,
},
{
path: 'profile',
element: <Profile />,
},
{
path: '*',
element: <Navigate to="/home" replace />,
},
],
},
]);