refactor: colocate frontend component files
Frontend security / security (push) Successful in 9s
Frontend verify / verify (push) Successful in 5m10s
Conventional commits / commits (pull_request) Successful in 25s
Frontend security / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Successful in 5m10s
Frontend security / security (push) Successful in 9s
Frontend verify / verify (push) Successful in 5m10s
Conventional commits / commits (pull_request) Successful in 25s
Frontend security / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Successful in 5m10s
This commit is contained in:
@@ -0,0 +1,244 @@
|
||||
import type { FC } from "react";
|
||||
import { lazy } from "react";
|
||||
import { Navigate, Route, Routes } from "react-router";
|
||||
import { LazyPage } from "../RouteFallback";
|
||||
import { Protected, Public } from "../RouteGuards";
|
||||
|
||||
const CardPage = lazy(async () => {
|
||||
const { CardPage } = await import("@/pages/card");
|
||||
return { default: CardPage };
|
||||
});
|
||||
const CardsPage = lazy(async () => {
|
||||
const { CardsPage } = await import("@/pages/cards");
|
||||
return { default: CardsPage };
|
||||
});
|
||||
const BondPage = lazy(async () => {
|
||||
const { BondPage } = await import("@/pages/bond");
|
||||
return { default: BondPage };
|
||||
});
|
||||
const BondsPage = lazy(async () => {
|
||||
const { BondsPage } = await import("@/pages/bonds");
|
||||
return { default: BondsPage };
|
||||
});
|
||||
const StockPage = lazy(async () => {
|
||||
const { StockPage } = await import("@/pages/stock");
|
||||
return { default: StockPage };
|
||||
});
|
||||
const StocksPage = lazy(async () => {
|
||||
const { StocksPage } = await import("@/pages/stocks");
|
||||
return { default: StocksPage };
|
||||
});
|
||||
const AccountPage = lazy(async () => {
|
||||
const { AccountPage } = await import("@/pages/account");
|
||||
return { default: AccountPage };
|
||||
});
|
||||
const AccountEventsPage = lazy(async () => {
|
||||
const { AccountEventsPage } = await import("@/pages/account-events");
|
||||
return { default: AccountEventsPage };
|
||||
});
|
||||
const AccountOperationsPage = lazy(async () => {
|
||||
const { AccountOperationsPage } = await import("@/pages/account-operations");
|
||||
return { default: AccountOperationsPage };
|
||||
});
|
||||
const AccountIncomePage = lazy(async () => {
|
||||
const { AccountIncomePage } = await import("@/pages/account-income");
|
||||
return { default: AccountIncomePage };
|
||||
});
|
||||
const AccountsPage = lazy(async () => {
|
||||
const { AccountsPage } = await import("@/pages/accounts");
|
||||
return { default: AccountsPage };
|
||||
});
|
||||
const LoginPage = lazy(async () => {
|
||||
const { LoginPage } = await import("@/pages/login");
|
||||
return { default: LoginPage };
|
||||
});
|
||||
const NotFoundPage = lazy(async () => {
|
||||
const { NotFoundPage } = await import("@/pages/not-found");
|
||||
return { default: NotFoundPage };
|
||||
});
|
||||
const RegisterPage = lazy(async () => {
|
||||
const { RegisterPage } = await import("@/pages/register");
|
||||
return { default: RegisterPage };
|
||||
});
|
||||
const SettingsPage = lazy(async () => {
|
||||
const { SettingsPage } = await import("@/pages/settings");
|
||||
return { default: SettingsPage };
|
||||
});
|
||||
const ProtectedLayout = lazy(async () => {
|
||||
const { ProtectedLayout } = await import("../ProtectedLayout");
|
||||
return { default: ProtectedLayout };
|
||||
});
|
||||
|
||||
const AppRoutes: FC = () => (
|
||||
<Routes>
|
||||
<Route path="/" element={<Navigate to="/accounts" replace />} />
|
||||
<Route
|
||||
path="/login"
|
||||
element={
|
||||
<Public>
|
||||
<LazyPage variant="auth">
|
||||
<LoginPage />
|
||||
</LazyPage>
|
||||
</Public>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/register"
|
||||
element={
|
||||
<Public>
|
||||
<LazyPage variant="auth">
|
||||
<RegisterPage />
|
||||
</LazyPage>
|
||||
</Public>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
element={
|
||||
<Protected>
|
||||
<LazyPage variant="shell">
|
||||
<ProtectedLayout />
|
||||
</LazyPage>
|
||||
</Protected>
|
||||
}
|
||||
>
|
||||
<Route
|
||||
path="/cards/:cardId"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<CardPage />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/cards"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<CardsPage />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/bonds"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<BondsPage />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/bonds/:bondId"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<BondPage />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/stocks"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<StocksPage />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/stocks/:stockId"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<StockPage />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/accounts"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<AccountsPage />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/accounts/all"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<AccountPage accountId="all" />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/accounts/all/operations"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<AccountOperationsPage accountId="all" />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/accounts/all/income"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<AccountIncomePage accountId="all" />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/accounts/all/events"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<AccountEventsPage accountId="all" />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/accounts/:accountId"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<AccountPage />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/accounts/:accountId/events"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<AccountEventsPage />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/accounts/:accountId/income"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<AccountIncomePage />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/accounts/:accountId/operations"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<AccountOperationsPage />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
<Route
|
||||
path="/settings"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<SettingsPage />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
</Route>
|
||||
<Route
|
||||
path="*"
|
||||
element={
|
||||
<LazyPage variant="content">
|
||||
<NotFoundPage />
|
||||
</LazyPage>
|
||||
}
|
||||
/>
|
||||
</Routes>
|
||||
);
|
||||
|
||||
export { AppRoutes };
|
||||
Reference in New Issue
Block a user