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-14 21:58:20 +03:00
|
|
|
import { NavPillItem, 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-03-05 18:08:30 +03:00
|
|
|
<NavPills className="mb-3">
|
2022-02-14 22:28:28 +03:00
|
|
|
<NavPillItem to="general">General</NavPillItem>
|
2022-02-14 21:58:20 +03:00
|
|
|
<NavPillItem to="short-urls">Short URLs</NavPillItem>
|
2022-03-07 13:03:41 +03:00
|
|
|
<NavPillItem to="other-items">Other items</NavPillItem>
|
2022-02-14 21:58:20 +03:00
|
|
|
</NavPills>
|
2022-02-13 22:20:20 +03:00
|
|
|
|
|
|
|
<Routes>
|
2022-03-26 14:17:42 +03:00
|
|
|
<Route path="general" element={<SettingsSections items={[<UserInterface />, <RealTimeUpdates />]} />} />
|
|
|
|
<Route path="short-urls" element={<SettingsSections items={[<ShortUrlCreation />, <ShortUrlsList />]} />} />
|
|
|
|
<Route path="other-items" element={<SettingsSections items={[<Tags />, <Visits />]} />} />
|
2022-02-14 22:28:28 +03:00
|
|
|
<Route path="*" element={<Navigate replace to="general" />} />
|
2022-02-13 22:20:20 +03:00
|
|
|
</Routes>
|
2020-04-25 10:49:54 +03:00
|
|
|
</NoMenuLayout>
|
|
|
|
);
|
2020-04-18 21:31:20 +03:00
|
|
|
|
|
|
|
export default Settings;
|