import { ListUl, ListCheck, ListMinus, Trash, } from "@styled-icons/boxicons-regular"; import { XSquare, Share, Group } from "@styled-icons/boxicons-solid"; import { observer } from "mobx-react-lite"; import { Route, Switch, useHistory, useParams } from "react-router-dom"; import styles from "./Settings.module.scss"; import { Text } from "preact-i18n"; import { useIntermediate } from "../../context/intermediate/Intermediate"; import RequiresOnline from "../../context/revoltjs/RequiresOnline"; import { useClient } from "../../context/revoltjs/RevoltClient"; import Category from "../../components/ui/Category"; import LineDivider from "../../components/ui/LineDivider"; import ButtonItem from "../../components/navigation/items/ButtonItem"; import { GenericSettings } from "./GenericSettings"; import { Bans } from "./server/Bans"; import { Categories } from "./server/Categories"; import { Invites } from "./server/Invites"; import { Members } from "./server/Members"; import { Overview } from "./server/Overview"; import { Roles } from "./server/Roles"; export default observer(() => { const { openScreen } = useIntermediate(); const { server: sid } = useParams<{ server: string }>(); const client = useClient(); const server = client.servers.get(sid); if (!server) return null; const owner = server.owner === client.user?._id; const history = useHistory(); function switchPage(to?: string) { if (to) { history.replace(`/server/${sid}/settings/${to}`); } else { history.replace(`/server/${sid}/settings`); } } return ( , id: "overview", icon: , title: ( ), }, { id: "categories", icon: , title: ( ), hideTitle: true, }, { id: "members", icon: , title: ( ), }, { id: "invites", icon: , title: ( ), }, { id: "bans", icon: , title: , }, { id: "roles", icon: , title: , hideTitle: true, }, ]} children={ } category="server_pages" switchPage={switchPage} defaultPage="overview" custom={ owner ? ( <> openScreen({ id: "special_prompt", type: "delete_server", target: server, }) } className={styles.deleteServer} compact> ) : undefined } showExitButton /> ); });