mirror of
https://github.com/Sqaaakoi/vc-newPluginsManager.git
synced 2024-11-16 14:54:37 -05:00
Add Don't show this again checkbox, Fix dismiss button, detect registered settings instead of saved settings
This commit is contained in:
parent
1820dc001a
commit
9a02e43cfb
3 changed files with 30 additions and 13 deletions
|
@ -9,3 +9,7 @@
|
|||
.vc-newPluginsManager-restart-list li {
|
||||
list-style: disc;
|
||||
}
|
||||
|
||||
.vc-newPluginsManager-close > div {
|
||||
display: flex;
|
||||
}
|
||||
|
|
|
@ -4,12 +4,16 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { useSettings } from "@api/Settings";
|
||||
import "./NewPluginsModal.css";
|
||||
|
||||
import { Settings, useSettings } from "@api/Settings";
|
||||
import { classNameFactory } from "@api/Styles";
|
||||
import { PluginCard } from "@components/PluginSettings";
|
||||
import { ChangeList } from "@utils/ChangeList";
|
||||
import { classes, Margins } from "@utils/index";
|
||||
import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
|
||||
import { useForceUpdater } from "@utils/react";
|
||||
import { findByPropsLazy } from "@webpack";
|
||||
import { Button, Flex, Forms, React, Text, Tooltip, useMemo } from "@webpack/common";
|
||||
import { JSX } from "react";
|
||||
|
||||
|
@ -19,9 +23,7 @@ import { getNewPlugins, getNewSettings, KnownPluginSettingsMap, writeKnownSettin
|
|||
|
||||
const cl = classNameFactory("vc-plugins-");
|
||||
|
||||
import "./NewPluginsModal.css";
|
||||
|
||||
import { Margins } from "@utils/index";
|
||||
const { Checkbox } = findByPropsLazy("FormItem", "Button");
|
||||
|
||||
let hasSeen = false;
|
||||
|
||||
|
@ -105,14 +107,15 @@ export function NewPluginsModal({ modalProps, newPlugins, newSettings }: { modal
|
|||
|
||||
return <ModalRoot {...modalProps} size={ModalSize.MEDIUM} >
|
||||
<ModalHeader>
|
||||
<Text variant="heading-lg/semibold">New Plugins and Settings ({[...plugins, ...requiredPlugins].length})</Text>
|
||||
<Text variant="heading-lg/semibold" style={{ flexGrow: 1 }}>New Plugins and Settings ({[...plugins, ...requiredPlugins].length})</Text>
|
||||
<Tooltip text="Dismiss for this session">
|
||||
{tooltipProps =>
|
||||
<ModalCloseButton
|
||||
{...tooltipProps}
|
||||
onClick={modalProps.onClose}
|
||||
className={cl("close")}
|
||||
/>
|
||||
<div {...tooltipProps}>
|
||||
<ModalCloseButton
|
||||
onClick={modalProps.onClose}
|
||||
className={classes(cl("close"), "vc-newPluginsManager-close")}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
</Tooltip>
|
||||
</ModalHeader>
|
||||
|
@ -129,6 +132,17 @@ export function NewPluginsModal({ modalProps, newPlugins, newSettings }: { modal
|
|||
callback={(v: () => void) => updateContinueButton = v}
|
||||
/>
|
||||
</Flex>
|
||||
<Flex direction={Flex.Direction.HORIZONTAL}>
|
||||
<Checkbox
|
||||
type={Checkbox.Types.INVERTED}
|
||||
value={!settings?.plugins?.NewPluginsManager?.enabled}
|
||||
onChange={() => {
|
||||
Settings.plugins.NewPluginsManager.enabled = !settings?.plugins?.NewPluginsManager?.enabled;
|
||||
}}
|
||||
>
|
||||
<Text>Don't show this again</Text>
|
||||
</Checkbox>
|
||||
</Flex>
|
||||
</ModalFooter>
|
||||
</ModalRoot>;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
import { DataStore } from "@api/index";
|
||||
import { Settings } from "@api/Settings";
|
||||
|
||||
import plugins from "~plugins";
|
||||
|
||||
|
@ -15,7 +14,7 @@ export const KNOWN_PLUGINS_LEGACY_DATA_KEY = "NewPluginsManager_KnownPlugins";
|
|||
export const KNOWN_SETTINGS_DATA_KEY = "NewPluginsManager_KnownSettings";
|
||||
|
||||
function getSettingsSetForPlugin(plugin: string): Set<string> {
|
||||
const settings = Settings.plugins[plugin] || {};
|
||||
const settings = plugins[plugin]?.settings?.def || {};
|
||||
return new Set(Object.keys(settings).filter(setting => setting !== "enabled"));
|
||||
}
|
||||
|
||||
|
@ -84,7 +83,7 @@ export async function debugWipeSomeData() {
|
|||
await DataStore.set(KNOWN_SETTINGS_DATA_KEY, settings);
|
||||
}
|
||||
|
||||
export async function editRawData(patcher: (data: KnownPluginSettingsMap) => (Promise<KnownPluginSettingsMap> | KnownPluginSettingsMap)) {
|
||||
export async function editRawData(patcher: (data: KnownPluginSettingsMap) => (Promise<any> | any)) {
|
||||
if (!patcher) return;
|
||||
const map = await DataStore.get(KNOWN_SETTINGS_DATA_KEY) as KnownPluginSettingsMap;
|
||||
const newMap = new Map(map);
|
||||
|
|
Loading…
Reference in a new issue