diff --git a/src/components/settings/tabs/plugins/PluginModal.tsx b/src/components/settings/tabs/plugins/PluginModal.tsx index 8175ecf6f..59de61aa2 100644 --- a/src/components/settings/tabs/plugins/PluginModal.tsx +++ b/src/components/settings/tabs/plugins/PluginModal.tsx @@ -295,8 +295,17 @@ function resetSettings(plugin: Plugin, warningModalProps?: ModalProps, pluginMod pluginModalProps?.onClose(); } -export function openWarningModal(plugin: Plugin, pluginModalProps: ModalProps, onRestartNeeded?: (pluginName: string) => void) { - if (Settings.ignoreResetWarning) return resetSettings(plugin, pluginModalProps, pluginModalProps, onRestartNeeded); +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 => ( - You are about to reset all settings for {plugin.name} to their default values. + {text} THIS ACTION IS IRREVERSIBLE! @@ -324,8 +333,8 @@ export function openWarningModal(plugin: Plugin, pluginModalProps: ModalProps, o - - + + - {!Settings.ignoreResetWarning && ( - - )} - - - - - - - )); - } - // Code directly taken from supportHelper.tsx const isApiPlugin = (plugin: string) => plugin.endsWith("API") || Plugins[plugin].required; @@ -402,7 +331,7 @@ export default function PluginSettings() { return ( - +