2022-03-03 02:02:30 -05:00
|
|
|
import React, { useEffect } from 'react';
|
|
|
|
import { BrowserRouter, useLocation, useNavigate } from 'react-router-dom';
|
2022-02-16 02:04:34 -05:00
|
|
|
|
2022-02-27 21:35:14 -05:00
|
|
|
import './scss/normalized.scss';
|
2022-02-16 02:04:34 -05:00
|
|
|
import * as styles from './App.module.scss';
|
2022-02-27 21:35:14 -05:00
|
|
|
import Content from './components/Content';
|
2022-03-03 02:02:30 -05:00
|
|
|
import Sidebar, { getPath, sections } from './components/Sidebar';
|
2022-02-27 21:35:14 -05:00
|
|
|
import Topbar from './components/Topbar';
|
2022-02-28 09:18:01 -05:00
|
|
|
import initI18n from './i18n/init';
|
|
|
|
|
|
|
|
void initI18n();
|
2022-02-16 02:04:34 -05:00
|
|
|
|
2022-03-03 02:02:30 -05:00
|
|
|
const Main = () => {
|
|
|
|
const location = useLocation();
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
if (location.pathname === '/') {
|
|
|
|
navigate(getPath(sections[0]?.items[0]?.title ?? ''));
|
|
|
|
}
|
|
|
|
}, [location.pathname, navigate]);
|
|
|
|
|
2022-02-27 21:35:14 -05:00
|
|
|
return (
|
2022-03-01 09:59:02 -05:00
|
|
|
<div className={styles.app}>
|
2022-02-27 21:35:14 -05:00
|
|
|
<Topbar />
|
|
|
|
<div className={styles.content}>
|
|
|
|
<Sidebar />
|
|
|
|
<Content />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
2022-02-16 02:04:34 -05:00
|
|
|
};
|
2022-03-03 02:02:30 -05:00
|
|
|
|
|
|
|
const App = () => (
|
|
|
|
<BrowserRouter>
|
|
|
|
<Main />
|
|
|
|
</BrowserRouter>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default App;
|