= {};
let restartNeeded = false;
@@ -287,7 +286,6 @@ function resetSettings(plugin: Plugin, warningModalProps?: ModalProps, pluginMod
}
}
-
const currentSettings = plugin.settings?.store;
if (currentSettings) {
Object.assign(currentSettings, newSettings);
@@ -305,87 +303,35 @@ function resetSettings(plugin: Plugin, warningModalProps?: ModalProps, pluginMod
position: Toasts.Position.TOP
}
});
-
- warningModalProps?.onClose();
- pluginModalProps?.onClose();
}
-export function openWarningModal(plugin?: Plugin | null, pluginModalProps?: ModalProps | null, onRestartNeeded?: (pluginName: string) => void, isPlugin = true, enabledPlugins?: number | null, reset?: any) {
- if (Settings.ignoreResetWarning && isPlugin) {
- if (plugin && pluginModalProps) return resetSettings(plugin, pluginModalProps, pluginModalProps, onRestartNeeded);
- return;
- } else if (Settings.ignoreResetWarning && !isPlugin) {
- return reset();
- }
-
- const text = isPlugin
- ? `You are about to reset all settings for ${plugin?.name} to their default values.`
- : `You are about to disable ${enabledPlugins} plugins!`;
-
- openModal(warningModalProps => (
- void, isPlugin = true, enabledPlugins?: number | null, reset?: () => void) {
+ openModal(props => (
+ {
+ if (isPlugin && plugin) {
+ resetSettings(plugin, onRestartNeeded);
+ } else {
+ reset?.();
+ }
+ }}
+ onCancel={props.onClose}
>
-
- Dangerous Action
-
-
-
-
-
-
- {text}
-
-
- THIS ACTION IS IRREVERSIBLE!
-
-
- If you are certain you want to proceed, click Confirm Reset. Otherwise, click Cancel.
-
-
-
-
-
-
-
-
- {!Settings.ignoreResetWarning && (
-
- )}
-
-
-
-
-
+
+ {isPlugin
+ ? <>Are you sure you want to reset all settings for {plugin?.name} to their default values?>
+ : `Are you sure you want to disable ${enabledPlugins} plugins?`
+ }
+
+
+
+ This action cannot be undone.
+
+
));
}
diff --git a/src/components/settings/tabs/plugins/index.tsx b/src/components/settings/tabs/plugins/index.tsx
index 84a7cb01a..6f8bdbc80 100644
--- a/src/components/settings/tabs/plugins/index.tsx
+++ b/src/components/settings/tabs/plugins/index.tsx
@@ -86,7 +86,7 @@ function ReloadRequiredCard({ required, enabledPlugins, openWarningModal, resetC
size="small"
className={"vc-plugins-disable-warning vc-modal-align-reset"}
onClick={() => {
- return openWarningModal(null, null, null, false, enabledPlugins.length, resetCheckAndDo);
+ return openWarningModal(null, undefined, false, enabledPlugins.length, resetCheckAndDo);
}}
>
Disable All Plugins