aboutsummaryrefslogtreecommitdiff
path: root/src/components/VencordSettings
diff options
context:
space:
mode:
authorV <vendicated@riseup.net>2023-05-02 02:50:51 +0200
committerGitHub <noreply@github.com>2023-05-02 02:50:51 +0200
commitc62d05e1b32361425474928004a92338d98ba200 (patch)
tree63e2d718807055dbdbbe7d2624270d8aa138fa2d /src/components/VencordSettings
parent6a1cb133cd6cbe2946e4c830291318e873da1d8b (diff)
downloadVencord-c62d05e1b32361425474928004a92338d98ba200.tar.gz
Vencord-c62d05e1b32361425474928004a92338d98ba200.tar.bz2
Vencord-c62d05e1b32361425474928004a92338d98ba200.zip
Refactor ipc to be strongly typed and hide impl details (#1018)
Diffstat (limited to 'src/components/VencordSettings')
-rw-r--r--src/components/VencordSettings/Updater.tsx3
-rw-r--r--src/components/VencordSettings/VencordTab.tsx44
-rw-r--r--src/components/VencordSettings/settingsStyles.css2
3 files changed, 21 insertions, 28 deletions
diff --git a/src/components/VencordSettings/Updater.tsx b/src/components/VencordSettings/Updater.tsx
index 6dffbc8..fb78394 100644
--- a/src/components/VencordSettings/Updater.tsx
+++ b/src/components/VencordSettings/Updater.tsx
@@ -25,7 +25,7 @@ import { Link } from "@components/Link";
import { Margins } from "@utils/margins";
import { classes, useAwaiter } from "@utils/misc";
import { relaunch } from "@utils/native";
-import { changes, checkForUpdates, getRepo, isNewer, rebuild, update, updateError, UpdateLogger } from "@utils/updater";
+import { changes, checkForUpdates, getRepo, isNewer, update, updateError, UpdateLogger } from "@utils/updater";
import { Alerts, Button, Card, Forms, Parser, React, Switch, Toasts } from "@webpack/common";
import gitHash from "~git-hash";
@@ -125,7 +125,6 @@ function Updatable(props: CommonProps) {
onClick={withDispatcher(setIsUpdating, async () => {
if (await update()) {
setUpdates([]);
- await rebuild();
await new Promise<void>(r => {
Alerts.show({
title: "Update Success!",
diff --git a/src/components/VencordSettings/VencordTab.tsx b/src/components/VencordSettings/VencordTab.tsx
index 7512208..672e04e 100644
--- a/src/components/VencordSettings/VencordTab.tsx
+++ b/src/components/VencordSettings/VencordTab.tsx
@@ -23,7 +23,6 @@ import { classNameFactory } from "@api/Styles";
import DonateButton from "@components/DonateButton";
import ErrorBoundary from "@components/ErrorBoundary";
import { ErrorCard } from "@components/ErrorCard";
-import IpcEvents from "@utils/IpcEvents";
import { Margins } from "@utils/margins";
import { identity, useAwaiter } from "@utils/misc";
import { relaunch, showItemInFolder } from "@utils/native";
@@ -39,7 +38,7 @@ type KeysOfType<Object, Type> = {
}[keyof Object];
function VencordSettings() {
- const [settingsDir, , settingsDirPending] = useAwaiter(() => VencordNative.ipc.invoke<string>(IpcEvents.GET_SETTINGS_DIR), {
+ const [settingsDir, , settingsDirPending] = useAwaiter(VencordNative.settings.getSettingsDir, {
fallbackValue: "Loading..."
});
const settings = useSettings();
@@ -101,40 +100,35 @@ function VencordSettings() {
<DonateCard image={donateImage} />
<Forms.FormSection title="Quick Actions">
<Card className={cl("quick-actions-card")}>
- {IS_WEB ? (
- <Button
- onClick={() => require("../Monaco").launchMonacoEditor()}
- size={Button.Sizes.SMALL}
- disabled={settingsDir === "Loading..."}>
- Open QuickCSS File
- </Button>
- ) : (
- <React.Fragment>
+ <React.Fragment>
+ {!IS_WEB && (
<Button
onClick={relaunch}
size={Button.Sizes.SMALL}>
Restart Client
</Button>
- <Button
- onClick={() => VencordNative.ipc.invoke(IpcEvents.OPEN_MONACO_EDITOR)}
- size={Button.Sizes.SMALL}
- disabled={settingsDir === "Loading..."}>
- Open QuickCSS File
- </Button>
+ )}
+ <Button
+ onClick={() => VencordNative.quickCss.openEditor()}
+ size={Button.Sizes.SMALL}
+ disabled={settingsDir === "Loading..."}>
+ Open QuickCSS File
+ </Button>
+ {!IS_WEB && (
<Button
onClick={() => showItemInFolder(settingsDir)}
size={Button.Sizes.SMALL}
disabled={settingsDirPending}>
Open Settings Folder
</Button>
- <Button
- onClick={() => VencordNative.ipc.invoke(IpcEvents.OPEN_EXTERNAL, "https://github.com/Vendicated/Vencord")}
- size={Button.Sizes.SMALL}
- disabled={settingsDirPending}>
- Open in GitHub
- </Button>
- </React.Fragment>
- )}
+ )}
+ <Button
+ onClick={() => VencordNative.native.openExternal("https://github.com/Vendicated/Vencord")}
+ size={Button.Sizes.SMALL}
+ disabled={settingsDirPending}>
+ Open in GitHub
+ </Button>
+ </React.Fragment>
</Card>
</Forms.FormSection>
diff --git a/src/components/VencordSettings/settingsStyles.css b/src/components/VencordSettings/settingsStyles.css
index c25022a..3652756 100644
--- a/src/components/VencordSettings/settingsStyles.css
+++ b/src/components/VencordSettings/settingsStyles.css
@@ -15,7 +15,7 @@
display: flex;
gap: 1em;
align-items: center;
- justify-content: space-between;
+ justify-content: space-evenly;
flex-grow: 1;
flex-flow: row wrap;
margin-bottom: 1em;