Skip to content

Commit 01a98a3

Browse files
committed
th-125: * updates router: wraps all pages in PageLayout
1 parent 8e80dc2 commit 01a98a3

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

frontend/src/libs/components/page-layout/page-layout.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { type FC } from 'react';
22

3+
import { Header, RouterOutlet } from '~/libs/components/components.js';
34
import { useCallback, useState } from '~/libs/hooks/hooks.js';
45
import { type TabName } from '~/libs/types/types.js';
56
import { Sidebar } from '~/pages/dashboard/components/sidebar/sidebar.js';
67

7-
import { Header } from '../components.js';
88
import styles from './styles.module.scss';
99

1010
type Properties = {
1111
isHeaderHidden?: boolean;
1212
isSidebarHidden?: boolean;
13-
children: JSX.Element;
13+
children?: JSX.Element;
1414
};
1515

1616
const PageLayout: FC<Properties> = ({
@@ -37,7 +37,10 @@ const PageLayout: FC<Properties> = ({
3737
<Sidebar selectedTab={selectedTab} onTabClick={handleTabSelect} />
3838
</div>
3939
)}
40-
<main className={styles.content}>{children}</main>
40+
<main className={styles.content}>
41+
<RouterOutlet />
42+
{children}
43+
</main>
4144
</div>
4245
);
4346
};

frontend/src/libs/components/router/router.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ import { Dashboard } from '~/pages/dashboard/dashboard.js';
77
import { NotFound } from '~/pages/not-found/not-found.js';
88
import { WelcomePage } from '~/pages/welcome/welcome.js';
99

10-
import { App } from '../app/app.js';
1110
import { ProtectedRoute } from '../components.js';
1211
import { PageLayout } from '../page-layout/page-layout.js';
1312
import { RouterProvider } from '../router-provider/router-provider.js';
1413

1514
const Router = (): JSX.Element => (
1615
<RouterProvider>
17-
<Route path={AppRoute.ROOT} element={<App />}>
16+
<Route path={AppRoute.ROOT} element={<PageLayout isSidebarHidden />}>
1817
<Route path={AppRoute.WELCOME} element={<WelcomePage />} />
1918
<Route path={AppRoute.SIGN_IN} element={<Auth />} />
2019
<Route path={AppRoute.SIGN_UP} element={<Auth />} />

0 commit comments

Comments
 (0)