2021-06-19 17:37:12 -04:00
|
|
|
import { Text } from "preact-i18n";
|
|
|
|
import Category from "../../components/ui/Category";
|
|
|
|
import { GenericSettings } from "./GenericSettings";
|
|
|
|
import { useServer } from "../../context/revoltjs/hooks";
|
|
|
|
import { Route, useHistory, useParams } from "react-router-dom";
|
2021-06-30 16:28:56 -04:00
|
|
|
import { ListUl, Share, Group, ListCheck } from "@styled-icons/boxicons-regular";
|
2021-06-27 06:17:59 -04:00
|
|
|
import { XSquare } from "@styled-icons/boxicons-solid";
|
2021-06-19 17:37:12 -04:00
|
|
|
import RequiresOnline from "../../context/revoltjs/RequiresOnline";
|
|
|
|
|
|
|
|
import { Overview } from "./server/Overview";
|
|
|
|
import { Members } from "./server/Members";
|
|
|
|
import { Invites } from "./server/Invites";
|
|
|
|
import { Bans } from "./server/Bans";
|
2021-06-30 16:28:56 -04:00
|
|
|
import { Roles } from "./server/Roles";
|
2021-06-19 17:37:12 -04:00
|
|
|
|
|
|
|
export default function ServerSettings() {
|
|
|
|
const { server: sid } = useParams<{ server: string; }>();
|
|
|
|
const server = useServer(sid);
|
|
|
|
if (!server) return null;
|
|
|
|
|
|
|
|
const history = useHistory();
|
|
|
|
function switchPage(to?: string) {
|
|
|
|
if (to) {
|
|
|
|
history.replace(`/server/${sid}/settings/${to}`);
|
|
|
|
} else {
|
|
|
|
history.replace(`/server/${sid}/settings`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<GenericSettings
|
|
|
|
pages={[
|
|
|
|
{
|
2021-06-28 03:55:05 -04:00
|
|
|
category: <Category variant="uniform" text={server.name} />, //TOFIX: Just add the server.name as a string, otherwise it makes a duplicate category
|
2021-06-19 17:37:12 -04:00
|
|
|
id: 'overview',
|
2021-06-27 06:17:59 -04:00
|
|
|
icon: <ListUl size={20} />,
|
2021-06-19 17:37:12 -04:00
|
|
|
title: <Text id="app.settings.channel_pages.overview.title" />
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'members',
|
2021-06-27 06:17:59 -04:00
|
|
|
icon: <Group size={20} />,
|
2021-06-19 17:37:12 -04:00
|
|
|
title: "Members"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'invites',
|
2021-06-27 06:17:59 -04:00
|
|
|
icon: <Share size={20} />,
|
2021-06-19 17:37:12 -04:00
|
|
|
title: "Invites"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'bans',
|
2021-06-27 06:17:59 -04:00
|
|
|
icon: <XSquare size={20} />,
|
2021-06-19 17:37:12 -04:00
|
|
|
title: "Bans"
|
2021-06-30 16:28:56 -04:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'roles',
|
|
|
|
icon: <ListCheck size={20} />,
|
|
|
|
title: "Roles"
|
2021-06-19 17:37:12 -04:00
|
|
|
}
|
|
|
|
]}
|
|
|
|
children={[
|
|
|
|
<Route path="/server/:server/settings/members"><RequiresOnline><Members server={server} /></RequiresOnline></Route>,
|
|
|
|
<Route path="/server/:server/settings/invites"><RequiresOnline><Invites server={server} /></RequiresOnline></Route>,
|
|
|
|
<Route path="/server/:server/settings/bans"><RequiresOnline><Bans server={server} /></RequiresOnline></Route>,
|
2021-06-30 16:28:56 -04:00
|
|
|
<Route path="/server/:server/settings/roles"><RequiresOnline><Roles server={server} /></RequiresOnline></Route>,
|
2021-06-19 17:37:12 -04:00
|
|
|
<Route path="/"><Overview server={server} /></Route>
|
|
|
|
]}
|
|
|
|
category="server_pages"
|
|
|
|
switchPage={switchPage}
|
|
|
|
defaultPage="overview"
|
|
|
|
showExitButton
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|