From 47ac58f37b64d230aa4b809a74cbec16addf3a2c Mon Sep 17 00:00:00 2001 From: prism Date: Tue, 16 Dec 2025 01:13:02 +0100 Subject: [PATCH] more modal tweaks (#564) * more modal tweaks * t --- src/components/Button.css | 2 +- src/components/FormSwitch.css | 1 - .../settings/tabs/plugins/LinkIconButton.css | 12 -- .../settings/tabs/plugins/LinkIconButton.tsx | 38 ++--- .../settings/tabs/plugins/PluginModal.css | 18 ++ .../settings/tabs/plugins/PluginModal.tsx | 160 ++++++------------ .../settings/tabs/plugins/index.tsx | 2 +- 7 files changed, 87 insertions(+), 146 deletions(-) delete mode 100644 src/components/settings/tabs/plugins/LinkIconButton.css diff --git a/src/components/Button.css b/src/components/Button.css index 6f70510b5..ab57403d4 100644 --- a/src/components/Button.css +++ b/src/components/Button.css @@ -195,4 +195,4 @@ .vc-text-btn-link { color: var(--text-link); -} \ No newline at end of file +} diff --git a/src/components/FormSwitch.css b/src/components/FormSwitch.css index 077bd772b..527b74f34 100644 --- a/src/components/FormSwitch.css +++ b/src/components/FormSwitch.css @@ -19,7 +19,6 @@ .vc-form-switch-disabled { opacity: 0.5; - pointer-events: none; cursor: not-allowed; } diff --git a/src/components/settings/tabs/plugins/LinkIconButton.css b/src/components/settings/tabs/plugins/LinkIconButton.css deleted file mode 100644 index cae80ef09..000000000 --- a/src/components/settings/tabs/plugins/LinkIconButton.css +++ /dev/null @@ -1,12 +0,0 @@ -.vc-settings-modal-link-icon { - height: 32px; - width: 32px; - border-radius: 50%; - border: 4px solid var(--background-base-lowest); - box-sizing: border-box -} - -.vc-settings-modal-links { - display: flex; - gap: 0.2em; -} diff --git a/src/components/settings/tabs/plugins/LinkIconButton.tsx b/src/components/settings/tabs/plugins/LinkIconButton.tsx index 9f9ecfebb..d6b725f3c 100644 --- a/src/components/settings/tabs/plugins/LinkIconButton.tsx +++ b/src/components/settings/tabs/plugins/LinkIconButton.tsx @@ -4,38 +4,28 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -import "./LinkIconButton.css"; - +import { Button } from "@components/Button"; import { GithubIcon, WebsiteIcon } from "@components/Icons"; -import { getTheme, Theme } from "@utils/discord"; -import { MaskedLink, Tooltip } from "@webpack/common"; - -export function GithubLinkIcon() { - const theme = getTheme() === Theme.Light ? "#000000" : "#FFFFFF"; - return ; -} - -export function WebsiteLinkIcon() { - const theme = getTheme() === Theme.Light ? "#000000" : "#FFFFFF"; - return ; -} interface Props { text: string; href: string; } -function LinkIcon({ text, href, Icon }: Props & { Icon: React.ComponentType; }) { +export function WebsiteButton({ text, href }: Props) { return ( - - {props => ( - - - - )} - + ); } -export const WebsiteButton = (props: Props) => ; -export const GithubButton = (props: Props) => ; +export function GithubButton({ text, href }: Props) { + return ( + + ); +} diff --git a/src/components/settings/tabs/plugins/PluginModal.css b/src/components/settings/tabs/plugins/PluginModal.css index f6261c6ad..bab1bbf19 100644 --- a/src/components/settings/tabs/plugins/PluginModal.css +++ b/src/components/settings/tabs/plugins/PluginModal.css @@ -36,3 +36,21 @@ gap: 4px; margin-left: auto; } + +.vc-plugin-modal-confirm [class*="footer"] { + flex-direction: row-reverse; + gap: var(--space-8, 8px); +} + +.vc-plugin-modal-confirm [class*="footer"]>button { + flex: 1; + margin: 0; + width: 100%; +} + +.vc-plugin-modal-warning { + display: flex; + align-items: center; + gap: 4px; + color: var(--text-feedback-critical); +} diff --git a/src/components/settings/tabs/plugins/PluginModal.tsx b/src/components/settings/tabs/plugins/PluginModal.tsx index 9af902c12..8f9920b6a 100644 --- a/src/components/settings/tabs/plugins/PluginModal.tsx +++ b/src/components/settings/tabs/plugins/PluginModal.tsx @@ -19,7 +19,7 @@ import "./PluginModal.css"; import { generateId } from "@api/Commands"; -import { Settings, useSettings } from "@api/Settings"; +import { useSettings } from "@api/Settings"; import { classNameFactory } from "@api/Styles"; import { BaseText } from "@components/BaseText"; import { Button } from "@components/Button"; @@ -31,7 +31,7 @@ import { gitRemote } from "@shared/vencordUserAgent"; import { proxyLazy } from "@utils/lazy"; import { Margins } from "@utils/margins"; import { classes, isObjectEmpty } from "@utils/misc"; -import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; +import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; import { OptionType, Plugin } from "@utils/types"; import { User } from "@vencord/discord-types"; import { findByPropsLazy, findComponentByCodeLazy } from "@webpack"; @@ -48,6 +48,8 @@ const cl = classNameFactory("vc-plugin-modal-"); const AvatarStyles = findByPropsLazy("moreUsers", "emptyUser", "avatarContainer", "clickableAvatar"); const CloseButton = findComponentByCodeLazy("CLOSE_BUTTON_LABEL"); +const ConfirmModal = findComponentByCodeLazy('parentComponent:"ConfirmModal"'); +const WarningIcon = findComponentByCodeLazy("3.15H3.29c-1.74"); const UserRecord: Constructor> = proxyLazy(() => UserStore.getCurrentUser().constructor) as any; interface PluginModalProps extends ModalProps { @@ -96,7 +98,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti }, [plugin.authors]); function handleResetClick() { - openWarningModal(plugin, { onClose, transitionState }, onRestartNeeded); + openWarningModal(plugin, onRestartNeeded); } function renderSettings() { @@ -210,10 +212,10 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti {renderSettings()} - {hasSettings && ( - - - + + + + {hasSettings ? ( {({ onMouseEnter, onMouseLeave }) => ( - {!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