diff options
author | Lewis Crichton <lewi@lewisakura.moe> | 2023-03-01 20:35:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-01 21:35:08 +0100 |
commit | e6ccb751a04ce383c998d717196340c1b4b1da5f (patch) | |
tree | a0c82ba89fc1a1e41250cb2791b987001f42b175 /src/components | |
parent | dfc7a15083188f07dd9921155dda8139c43a32eb (diff) | |
download | Vencord-e6ccb751a04ce383c998d717196340c1b4b1da5f.tar.gz Vencord-e6ccb751a04ce383c998d717196340c1b4b1da5f.tar.bz2 Vencord-e6ccb751a04ce383c998d717196340c1b4b1da5f.zip |
Fix for latest Discord Update (#550)
Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Co-authored-by: Vendicated <vendicated@riseup.net>
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/PatchHelper.tsx | 11 | ||||
-rw-r--r-- | src/components/PluginSettings/index.tsx | 15 | ||||
-rw-r--r-- | src/components/VencordSettings/BackupRestoreTab.tsx | 9 | ||||
-rw-r--r-- | src/components/VencordSettings/ThemesTab.tsx | 7 | ||||
-rw-r--r-- | src/components/VencordSettings/Updater.tsx | 13 | ||||
-rw-r--r-- | src/components/VencordSettings/index.tsx | 7 |
6 files changed, 34 insertions, 28 deletions
diff --git a/src/components/PatchHelper.tsx b/src/components/PatchHelper.tsx index cb60980..6524528 100644 --- a/src/components/PatchHelper.tsx +++ b/src/components/PatchHelper.tsx @@ -17,10 +17,11 @@ */ import { debounce } from "@utils/debounce"; +import { Margins } from "@utils/margins"; import { makeCodeblock } from "@utils/misc"; import { canonicalizeMatch, canonicalizeReplace, ReplaceFn } from "@utils/patches"; import { search } from "@webpack"; -import { Button, Clipboard, Forms, Margins, Parser, React, Switch, Text, TextInput } from "@webpack/common"; +import { Button, Clipboard, Forms, Parser, React, Switch, Text, TextInput } from "@webpack/common"; import { CheckedTextInput } from "./CheckedTextInput"; import ErrorBoundary from "./ErrorBoundary"; @@ -128,7 +129,7 @@ function ReplacementComponent({ module, match, replacement, setReplacementError )} {!!diff?.length && ( - <Button className={Margins.marginTop20} onClick={() => { + <Button className={Margins.top20} onClick={() => { try { Function(patchedCode.replace(/^function\(/, "function patchedModule(")); setCompileResult([true, "Compiled successfully"]); @@ -202,7 +203,7 @@ function ReplacementInput({ replacement, setReplacement, replacementError }) { )} <Switch - className={Margins.marginTop8} + className={Margins.top8} value={isFunc} onChange={setIsFunc} note="'replacement' will be evaled if this is toggled" @@ -256,7 +257,7 @@ function PatchHelper() { return ( <Forms.FormSection> - <Text variant="heading-md/normal" tag="h2" className={Margins.marginBottom8}>Patch Helper</Text> + <Text variant="heading-md/normal" tag="h2" className={Margins.bottom8}>Patch Helper</Text> <Forms.FormTitle>find</Forms.FormTitle> <TextInput type="text" @@ -296,7 +297,7 @@ function PatchHelper() { {!!(find && match && replacement) && ( <> - <Forms.FormTitle className={Margins.marginTop20}>Code</Forms.FormTitle> + <Forms.FormTitle className={Margins.top20}>Code</Forms.FormTitle> <div style={{ userSelect: "text" }}>{Parser.parse(makeCodeblock(code, "ts"))}</div> <Button onClick={() => Clipboard.copy(code)}>Copy to Clipboard</Button> </> diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx index 4e64eb8..3d69a60 100644 --- a/src/components/PluginSettings/index.tsx +++ b/src/components/PluginSettings/index.tsx @@ -30,11 +30,12 @@ import PluginModal from "@components/PluginSettings/PluginModal"; import { Switch } from "@components/Switch"; import { ChangeList } from "@utils/ChangeList"; import Logger from "@utils/Logger"; +import { Margins } from "@utils/margins"; import { classes, LazyComponent, useAwaiter } from "@utils/misc"; import { openModalLazy } from "@utils/modal"; import { Plugin } from "@utils/types"; import { findByCode, findByPropsLazy } from "@webpack"; -import { Alerts, Button, Card, Forms, Margins, Parser, React, Select, Text, TextInput, Toasts, Tooltip } from "@webpack/common"; +import { Alerts, Button, Card, Forms, Parser, React, Select, Text, TextInput, Toasts, Tooltip } from "@webpack/common"; import Plugins from "~plugins"; @@ -296,15 +297,15 @@ export default ErrorBoundary.wrap(function PluginSettings() { } return ( - <Forms.FormSection className={Margins.marginTop16}> + <Forms.FormSection className={Margins.top16}> <ReloadRequiredCard required={changes.hasChanges} /> - <Forms.FormTitle tag="h5" className={classes(Margins.marginTop20, Margins.marginBottom8)}> + <Forms.FormTitle tag="h5" className={classes(Margins.top20, Margins.bottom8)}> Filters </Forms.FormTitle> <div className={cl("filter-controls")}> - <TextInput autoFocus value={searchValue.value} placeholder="Search for a plugin..." onChange={onSearch} className={Margins.marginBottom20} /> + <TextInput autoFocus value={searchValue.value} placeholder="Search for a plugin..." onChange={onSearch} className={Margins.bottom20} /> <div className={InputStyles.inputWrapper}> <Select className={InputStyles.inputDefault} @@ -321,15 +322,15 @@ export default ErrorBoundary.wrap(function PluginSettings() { </div> </div> - <Forms.FormTitle className={Margins.marginTop20}>Plugins</Forms.FormTitle> + <Forms.FormTitle className={Margins.top20}>Plugins</Forms.FormTitle> <div className={cl("grid")}> {plugins} </div> - <Forms.FormDivider className={Margins.marginTop20} /> + <Forms.FormDivider className={Margins.top20} /> - <Forms.FormTitle tag="h5" className={classes(Margins.marginTop20, Margins.marginBottom8)}> + <Forms.FormTitle tag="h5" className={classes(Margins.top20, Margins.bottom8)}> Required Plugins </Forms.FormTitle> <div className={cl("grid")}> diff --git a/src/components/VencordSettings/BackupRestoreTab.tsx b/src/components/VencordSettings/BackupRestoreTab.tsx index 2ea0452..7a3729d 100644 --- a/src/components/VencordSettings/BackupRestoreTab.tsx +++ b/src/components/VencordSettings/BackupRestoreTab.tsx @@ -18,25 +18,26 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { Flex } from "@components/Flex"; +import { Margins } from "@utils/margins"; import { classes } from "@utils/misc"; import { downloadSettingsBackup, uploadSettingsBackup } from "@utils/settingsSync"; -import { Button, Card, Forms, Margins, Text } from "@webpack/common"; +import { Button, Card, Forms, Text } from "@webpack/common"; function BackupRestoreTab() { return ( - <Forms.FormSection title="Settings Sync" className={Margins.marginTop16}> + <Forms.FormSection title="Settings Sync" className={Margins.top16}> <Card className={classes("vc-settings-card", "vc-backup-restore-card")}> <Flex flexDirection="column"> <strong>Warning</strong> <span>Importing a settings file will overwrite your current settings.</span> </Flex> </Card> - <Text variant="text-md/normal" className={Margins.marginBottom8}> + <Text variant="text-md/normal" className={Margins.bottom8}> You can import and export your Vencord settings as a JSON file. This allows you to easily transfer your settings to another device, or recover your settings after reinstalling Vencord or Discord. </Text> - <Text variant="text-md/normal" className={Margins.marginBottom8}> + <Text variant="text-md/normal" className={Margins.bottom8}> Settings Export contains: <ul> <li>— Custom QuickCSS</li> diff --git a/src/components/VencordSettings/ThemesTab.tsx b/src/components/VencordSettings/ThemesTab.tsx index b2cf85b..b8381f7 100644 --- a/src/components/VencordSettings/ThemesTab.tsx +++ b/src/components/VencordSettings/ThemesTab.tsx @@ -19,9 +19,10 @@ import { useSettings } from "@api/settings"; import ErrorBoundary from "@components/ErrorBoundary"; import { Link } from "@components/Link"; +import { Margins } from "@utils/margins"; import { useAwaiter } from "@utils/misc"; import { findLazy } from "@webpack"; -import { Card, Forms, Margins, React, TextArea } from "@webpack/common"; +import { Card, Forms, React, TextArea } from "@webpack/common"; const TextAreaProps = findLazy(m => typeof m.textarea === "string"); @@ -51,7 +52,7 @@ function Validators({ themeLinks }: { themeLinks: string[]; }) { return ( <> - <Forms.FormTitle className={Margins.marginTop20} tag="h5">Validator</Forms.FormTitle> + <Forms.FormTitle className={Margins.top20} tag="h5">Validator</Forms.FormTitle> <Forms.FormText>This section will tell you whether your themes can successfully be loaded</Forms.FormText> <div> {themeLinks.map(link => ( @@ -93,7 +94,7 @@ export default ErrorBoundary.wrap(function () { <Forms.FormTitle tag="h5">Paste links to .css / .theme.css files here</Forms.FormTitle> <Forms.FormText>One link per line</Forms.FormText> <Forms.FormText>Make sure to use the raw links or github.io links!</Forms.FormText> - <Forms.FormDivider className={Margins.marginTop8 + " " + Margins.marginBottom8} /> + <Forms.FormDivider className={Margins.top8 + " " + Margins.bottom8} /> <Forms.FormTitle tag="h5">Find Themes:</Forms.FormTitle> <div style={{ marginBottom: ".5em" }}> <Link style={{ marginRight: ".5em" }} href="https://betterdiscord.app/themes"> diff --git a/src/components/VencordSettings/Updater.tsx b/src/components/VencordSettings/Updater.tsx index b5243f2..caed4f7 100644 --- a/src/components/VencordSettings/Updater.tsx +++ b/src/components/VencordSettings/Updater.tsx @@ -22,9 +22,10 @@ import { ErrorCard } from "@components/ErrorCard"; import { Flex } from "@components/Flex"; import { handleComponentFailed } from "@components/handleComponentFailed"; import { Link } from "@components/Link"; +import { Margins } from "@utils/margins"; import { classes, useAwaiter } from "@utils/misc"; import { changes, checkForUpdates, getRepo, isNewer, rebuild, update, updateError, UpdateLogger } from "@utils/updater"; -import { Alerts, Button, Card, Forms, Margins, Parser, React, Switch, Toasts } from "@webpack/common"; +import { Alerts, Button, Card, Forms, Parser, React, Switch, Toasts } from "@webpack/common"; import gitHash from "~git-hash"; @@ -109,14 +110,14 @@ function Updatable(props: CommonProps) { </ErrorCard> </> ) : ( - <Forms.FormText className={Margins.marginBottom8}> + <Forms.FormText className={Margins.bottom8}> {isOutdated ? `There are ${updates.length} Updates` : "Up to Date!"} </Forms.FormText> )} {isOutdated && <Changes updates={updates} {...props} />} - <Flex className={classes(Margins.marginBottom8, Margins.marginTop8)}> + <Flex className={classes(Margins.bottom8, Margins.top8)}> {isOutdated && <Button size={Button.Sizes.SMALL} disabled={isUpdating || isChecking} @@ -175,7 +176,7 @@ function Updatable(props: CommonProps) { function Newer(props: CommonProps) { return ( <> - <Forms.FormText className={Margins.marginBottom8}> + <Forms.FormText className={Margins.bottom8}> Your local copy has more recent commits. Please stash or reset them. </Forms.FormText> <Changes {...props} updates={changes} /> @@ -199,7 +200,7 @@ function Updater() { }; return ( - <Forms.FormSection className={Margins.marginTop16}> + <Forms.FormSection className={Margins.top16}> <Forms.FormTitle tag="h5">Updater Settings</Forms.FormTitle> <Switch value={settings.notifyAboutUpdates} @@ -225,7 +226,7 @@ function Updater() { </Link> )} (<HashLink hash={gitHash} repo={repo} disabled={repoPending} />)</Forms.FormText> - <Forms.FormDivider className={Margins.marginTop8 + " " + Margins.marginBottom8} /> + <Forms.FormDivider className={Margins.top8 + " " + Margins.bottom8} /> <Forms.FormTitle tag="h5">Updates</Forms.FormTitle> diff --git a/src/components/VencordSettings/index.tsx b/src/components/VencordSettings/index.tsx index acd81c3..6c946a1 100644 --- a/src/components/VencordSettings/index.tsx +++ b/src/components/VencordSettings/index.tsx @@ -20,6 +20,7 @@ import "./settingsStyles.css"; import { classNameFactory } from "@api/Styles"; import ErrorBoundary from "@components/ErrorBoundary"; +import { handleComponentFailed } from "@components/handleComponentFailed"; import { findByCodeLazy } from "@webpack"; import { Forms, SettingsRouter, Text } from "@webpack/common"; @@ -61,8 +62,8 @@ function Settings(props: SettingsProps) { <Text variant="heading-md/normal" tag="h2">Vencord Settings</Text> <TabBar - type={TabBar.Types.TOP} - look={TabBar.Looks.BRAND} + type="top" + look="brand" className={cl("tab-bar")} selectedItem={tab} onItemSelect={SettingsRouter.open} @@ -83,7 +84,7 @@ function Settings(props: SettingsProps) { } export default function (props: SettingsProps) { - return <ErrorBoundary> + return <ErrorBoundary onError={handleComponentFailed}> <Settings tab={props.tab} /> </ErrorBoundary>; } |