import { useSettings } from "../api/settings"; import { ChangeList } from "../utils/ChangeList"; import IpcEvents from "../utils/IpcEvents"; import { useAwaiter } from "../utils/misc"; import { Alerts, Button, Forms, Margins, Parser, React, Switch } from "../webpack/common"; import ErrorBoundary from "./ErrorBoundary"; import { Flex } from "./Flex"; export default ErrorBoundary.wrap(function Settings() { const [settingsDir, , settingsDirPending] = useAwaiter(() => VencordNative.ipc.invoke(IpcEvents.GET_SETTINGS_DIR), "Loading..."); const settings = useSettings(); const changes = React.useMemo(() => new ChangeList(), []); React.useEffect(() => { return () => void (changes.hasChanges && Alerts.show({ title: "Restart required", body: ( <>

The following plugins require a restart:

{changes.map((s, i) => ( <> {i > 0 && ", "} {Parser.parse("`" + s + "`")} ))}
), confirmText: "Restart now", cancelText: "Later!", onConfirm: () => location.reload() })); }, []); return ( Settings Settings Directory: {settingsDir} {!IS_WEB && } settings.useQuickCss = v} note="Loads styles from your QuickCss file" > Use QuickCss {!IS_WEB && settings.enableReactDevtools = v} note="Requires a full restart" > Enable React Developer Tools } {!IS_WEB && settings.notifyAboutUpdates = v} note="Shows a Toast on StartUp" > Get notified about new Updates } ); });