apply lint

This commit is contained in:
Vendicated
2023-04-09 22:49:50 +02:00
committed by V
parent df53ea549a
commit ddebb6563a
29 changed files with 274 additions and 103 deletions

View File

@@ -1,18 +1,43 @@
import { getValueAndOnChange, useSettings } from "renderer/settings";
import { Common, Util } from "../vencord";
/*
* SPDX-License-Identifier: GPL-3.0
* Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
import "./settings.css";
import { useSettings } from "renderer/settings";
import { Common, Util } from "../vencord";
const { Margins } = Util;
export default function SettingsUi() {
const Settings = useSettings();
const { Forms: { FormSection, FormText, FormDivider, FormSwitch, FormTitle }, Text, Select, Button } = Common;
const {
Forms: { FormSection, FormText, FormDivider, FormSwitch, FormTitle },
Text,
Select,
Button
} = Common;
const switches: [keyof typeof Settings, string, string, boolean?][] = [
["minimizeToTray", "Minimize to tray", "Hitting X will make Vencord Desktop minimize to the tray instead of closing", true],
["disableMinSize", "Disable minimum window size", "Allows you to make the window as small as your heart desires"],
["openLinksWithElectron", "Open Links in app (experimental)", "Opens links in a new Vencord Desktop window instead of your web browser"],
[
"minimizeToTray",
"Minimize to tray",
"Hitting X will make Vencord Desktop minimize to the tray instead of closing",
true
],
[
"disableMinSize",
"Disable minimum window size",
"Allows you to make the window as small as your heart desires"
],
[
"openLinksWithElectron",
"Open Links in app (experimental)",
"Opens links in a new Vencord Desktop window instead of your web browser"
]
];
return (
@@ -21,18 +46,16 @@ export default function SettingsUi() {
Vencord Desktop Settings
</Text>
<FormTitle className={Margins.top16}>
Discord Branch
</FormTitle>
<FormTitle className={Margins.top16}>Discord Branch</FormTitle>
<Select
placeholder="Stable"
options={[
{ label: "Stable", value: "stable", default: true },
{ label: "Canary", value: "canary" },
{ label: "PTB", value: "ptb" },
{ label: "PTB", value: "ptb" }
]}
closeOnSelect={true}
select={v => Settings.discordBranch = v}
select={v => (Settings.discordBranch = v)}
isSelected={v => v === Settings.discordBranch}
serialize={s => s}
/>
@@ -42,7 +65,7 @@ export default function SettingsUi() {
{switches.map(([key, text, note, def]) => (
<FormSwitch
value={Settings[key] ?? def ?? false}
onChange={v => Settings[key] = v}
onChange={v => (Settings[key] = v)}
note={note}
key={key}
>
@@ -52,22 +75,20 @@ export default function SettingsUi() {
<FormTitle>Vencord Location</FormTitle>
<FormText>
Vencord files are loaded from
{" "}
{Settings.vencordDir
? (
<a
href="about:blank"
onClick={e => {
e.preventDefault();
VencordDesktopNative.fileManager.showItemInFolder(Settings.vencordDir!);
}}
>
{Settings.vencordDir}
</a>
)
: "the default location"
}
Vencord files are loaded from{" "}
{Settings.vencordDir ? (
<a
href="about:blank"
onClick={e => {
e.preventDefault();
VencordDesktopNative.fileManager.showItemInFolder(Settings.vencordDir!);
}}
>
{Settings.vencordDir}
</a>
) : (
"the default location"
)}
</FormText>
<div className="vcd-location-btns">
<Button
@@ -88,11 +109,11 @@ export default function SettingsUi() {
<Button
size={Button.Sizes.SMALL}
color={Button.Colors.RED}
onClick={() => Settings.vencordDir = void 0}
onClick={() => (Settings.vencordDir = void 0)}
>
Reset
</Button>
</div>
</FormSection >
</FormSection>
);
}

View File

@@ -1 +1,7 @@
/*
* SPDX-License-Identifier: GPL-3.0
* Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
export { default as Settings } from "./Settings";

View File

@@ -1,4 +1,11 @@
/*
* SPDX-License-Identifier: GPL-3.0
* Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
import "./hideGarbage.css";
import { isFirstRun, localStorage } from "./utils";
// Make clicking Notifications focus the window

View File

@@ -1,7 +1,12 @@
/*
* SPDX-License-Identifier: GPL-3.0
* Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
import "./fixes";
console.log("read if cute :3");
export * as Components from "./components";
export { PlainSettings, Settings } from "./settings";

View File

@@ -1,5 +1,12 @@
/*
* SPDX-License-Identifier: GPL-3.0
* Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
import type { Settings as TSettings } from "shared/settings";
import { makeChangeListenerProxy } from "shared/utils/makeChangeListenerProxy";
import { Common } from "./vencord";
const signals = new Set<() => void>();
@@ -23,6 +30,6 @@ export function useSettings() {
export function getValueAndOnChange(key: keyof TSettings) {
return {
value: Settings[key] as any,
onChange: (value: any) => Settings[key] = value
onChange: (value: any) => (Settings[key] = value)
};
}

View File

@@ -1,4 +1,10 @@
export const localStorage = window.vcdLS = window.localStorage;
/*
* SPDX-License-Identifier: GPL-3.0
* Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
export const localStorage = (window.vcdLS = window.localStorage);
export const isFirstRun = (() => {
const key = "VCD_FIRST_RUN";

View File

@@ -1,13 +1,13 @@
/*
* SPDX-License-Identifier: GPL-3.0
* Vencord Desktop, a desktop app aiming to give you a snappier Discord Experience
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
// FIXME: this is terrible
const { Webpack, Plugins, Util } = Vencord;
const { Common } = Webpack;
const { plugins } = Plugins;
export {
Webpack,
Common,
Util,
Plugins,
plugins
};
export { Common, Plugins, plugins, Util, Webpack };