2021-03-06 18:54:43 +03:00
|
|
|
import { FC, ReactNode } from 'react';
|
2022-02-13 22:20:20 +03:00
|
|
|
import { Navigate, Routes, Route } from 'react-router-dom';
|
2021-12-30 12:02:31 +03:00
|
|
|
import { NoMenuLayout } from '../common/NoMenuLayout';
|
2022-02-13 22:20:20 +03:00
|
|
|
import { NavPills } from '../utils/NavPills';
|
2020-04-18 21:31:20 +03:00
|
|
|
|
2022-02-13 22:20:20 +03:00
|
|
|
const SettingsSections: FC<{ items: ReactNode[] }> = ({ items }) => (
|
2021-03-06 18:54:43 +03:00
|
|
|
<>
|
2022-02-13 22:20:20 +03:00
|
|
|
{items.map((child, index) => <div key={index} className="mb-3">{child}</div>)}
|
2021-03-06 18:54:43 +03:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
|
2021-12-24 16:15:28 +03:00
|
|
|
const Settings = (
|
|
|
|
RealTimeUpdates: FC,
|
|
|
|
ShortUrlCreation: FC,
|
|
|
|
ShortUrlsList: FC,
|
|
|
|
UserInterface: FC,
|
|
|
|
Visits: FC,
|
|
|
|
Tags: FC,
|
|
|
|
) => () => (
|
2020-04-25 10:49:54 +03:00
|
|
|
<NoMenuLayout>
|
2022-02-13 22:20:20 +03:00
|
|
|
<NavPills
|
2021-03-06 18:54:43 +03:00
|
|
|
items={[
|
2022-02-13 22:20:20 +03:00
|
|
|
{ to: 'app', children: 'App' },
|
|
|
|
{ to: 'short-urls', children: 'Short URLs' },
|
|
|
|
{ to: 'others', children: 'Others' },
|
2021-03-06 18:54:43 +03:00
|
|
|
]}
|
|
|
|
/>
|
2022-02-13 22:20:20 +03:00
|
|
|
|
|
|
|
<Routes>
|
|
|
|
<Route path="app" element={<SettingsSections items={[ <UserInterface key="one" />, <RealTimeUpdates key="two" /> ]} />} />
|
|
|
|
<Route path="short-urls" element={<SettingsSections items={[ <ShortUrlCreation key="one" />, <ShortUrlsList key="two" /> ]} />} />
|
|
|
|
<Route path="others" element={<SettingsSections items={[ <Tags key="one" />, <Visits key="two" /> ]} />} />
|
|
|
|
<Route path="*" element={<Navigate replace to="app" />} />
|
|
|
|
</Routes>
|
2020-04-25 10:49:54 +03:00
|
|
|
</NoMenuLayout>
|
|
|
|
);
|
2020-04-18 21:31:20 +03:00
|
|
|
|
|
|
|
export default Settings;
|