-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add plugin ui customisation options #3693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
48eca4e
add plugin ui customisation options
Vendicated 3e4aa50
improve layout
Vendicated 93b5b1a
Merge branch 'dev' into plugin-ui-elements
Vendicated 7e7b4c0
make all plugins export their chatbar and popover button icons
Vendicated a7e27cc
combine render & icon props into single object prop
Vendicated a777634
update ui
Vendicated 1e10a1c
finish
Vendicated e915a63
add context menu
Vendicated 8f1ddb5
fix typo
Vendicated 5da34c4
Merge branch 'dev' into plugin-ui-elements
Vendicated 1df486e
Merge branch 'dev' into plugin-ui-elements
Vendicated 5b61419
temporarily drop plugins/index.ts changes
Vendicated c1e6b72
Merge branch 'dev' into plugin-ui-elements
Vendicated 2b7f031
add back PluginManager changes
Vendicated 1db9a95
fix outdated import
Vendicated 5ab7356
useSettings: add prefix path matching
Vendicated f6320d8
Merge branch 'useSettings-wildcard' into plugin-ui-elements
Vendicated c971def
use wildcards in useSettings
Vendicated 208b0f6
fix useSettings type
Vendicated 024c1c0
Merge branch 'useSettings-wildcard' into plugin-ui-elements
Vendicated 7c0176c
fix incorrect merge
Vendicated cf015e5
use wildcards in more places
Vendicated faf8d28
lmao
Vendicated 760b329
Merge branch 'dev' into plugin-ui-elements
Vendicated 054e741
how did this get here
Vendicated 4469a00
improve descriptions and use card component
Vendicated 9455b67
don't use Iterator array methods (too new)
Vendicated File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| .vc-plugin-ui-elements-button { | ||
| display: flex; | ||
| align-items: center; | ||
| background-color: var(--card-primary-bg); | ||
| color: var(--interactive-normal); | ||
| border: 1px solid var(--border-subtle); | ||
| border-radius: var(--radius-sm); | ||
| padding: 1em; | ||
| margin-top: 0.5em; | ||
| cursor: pointer; | ||
|
|
||
| &:hover { | ||
| background-color: var(--background-modifier-hover); | ||
| color: var(--interactive-hover); | ||
| } | ||
| } | ||
|
|
||
| .vc-plugin-ui-elements-button-arrow { | ||
| margin-left: auto; | ||
| width: 24px; | ||
| height: 24px; | ||
| } | ||
|
|
||
| .vc-plugin-ui-elements-modal-content { | ||
| padding: 1em; | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 1.5em; | ||
| } | ||
|
|
||
| .vc-plugin-ui-elements-switches { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: 1em; | ||
| } | ||
|
|
||
| .vc-plugin-ui-elements-switches-row { | ||
| display: flex; | ||
| gap: 1em; | ||
| width: 100%; | ||
| align-items: center; | ||
|
|
||
| :last-child { | ||
| margin-left: auto; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| /* | ||
| * Vencord, a Discord client mod | ||
| * Copyright (c) 2025 Vendicated and contributors | ||
| * SPDX-License-Identifier: GPL-3.0-or-later | ||
| */ | ||
|
|
||
| import "./UIElements.css"; | ||
|
|
||
| import { ChatBarButtonMap } from "@api/ChatButtons"; | ||
| import { MessagePopoverButtonMap } from "@api/MessagePopover"; | ||
| import { SettingsPluginUiElements, useSettings } from "@api/Settings"; | ||
| import { classNameFactory } from "@api/Styles"; | ||
| import { PlaceholderIcon } from "@components/Icons"; | ||
| import { Switch } from "@components/settings/Switch"; | ||
| import { Margins } from "@utils/margins"; | ||
| import { classes } from "@utils/misc"; | ||
| import { ModalContent, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; | ||
| import { IconComponent } from "@utils/types"; | ||
| import { Clickable, Text } from "@webpack/common"; | ||
|
|
||
|
|
||
| const cl = classNameFactory("vc-plugin-ui-elements-"); | ||
|
|
||
| export function UIElementsButton() { | ||
| return ( | ||
| <Clickable | ||
| className={cl("button")} | ||
| onClick={() => openModal(modalProps => <UIElementsModal {...modalProps} />)} | ||
| > | ||
| <div className={cl("button-description")}> | ||
| <Text variant="text-md/semibold"> | ||
| Manage plugin UI elements | ||
| </Text> | ||
| <Text variant="text-xs/normal"> | ||
| Allows you to hide buttons you don't like | ||
| </Text> | ||
| </div> | ||
| <svg | ||
| className={cl("button-arrow")} | ||
| aria-hidden="true" | ||
| viewBox="0 0 24 24" | ||
| > | ||
| <path fill="currentColor" d="M9.3 5.3a1 1 0 0 0 0 1.4l5.29 5.3-5.3 5.3a1 1 0 1 0 1.42 1.4l6-6a1 1 0 0 0 0-1.4l-6-6a1 1 0 0 0-1.42 0Z" /> | ||
| </svg> | ||
| </Clickable > | ||
| ); | ||
| } | ||
|
|
||
| function Section(props: { | ||
| title: string; | ||
| description: string; | ||
| settings: SettingsPluginUiElements; | ||
| buttonMap: Map<string, { icon: IconComponent; }>; | ||
| }) { | ||
| const { buttonMap, description, title, settings } = props; | ||
|
|
||
| return ( | ||
| <section> | ||
| <Text tag="h3" variant="heading-xl/bold">{title}</Text> | ||
| <Text variant="text-sm/normal" className={classes(Margins.top8, Margins.bottom20)}>{description}</Text> | ||
|
|
||
| <div className={cl("switches")}> | ||
| {buttonMap.entries().map(([name, { icon }]) => { | ||
Vendicated marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const Icon = icon ?? PlaceholderIcon; | ||
| return ( | ||
| <Text variant="text-md/semibold" key={name} className={cl("switches-row")}> | ||
| <Icon height={20} width={20} /> | ||
| {name} | ||
| <Switch | ||
| checked={settings[name]?.enabled ?? true} | ||
| onChange={() => { | ||
| settings[name] ??= { enabled: true }; | ||
| settings[name].enabled = !settings[name].enabled; | ||
| }} | ||
| /> | ||
| </Text> | ||
| ); | ||
| })} | ||
| </div> | ||
| </section> | ||
| ); | ||
| } | ||
|
|
||
| function UIElementsModal(props: ModalProps) { | ||
| const { uiElements } = useSettings(); | ||
|
|
||
| return ( | ||
| <ModalRoot {...props} size={ModalSize.MEDIUM}> | ||
| <ModalContent className={cl("modal-content")}> | ||
| <Section | ||
| title="Chatbar Buttons" | ||
| description="These buttons appear in the chat input." | ||
| buttonMap={ChatBarButtonMap} | ||
| settings={uiElements.chatBarButtons} | ||
| /> | ||
| <Section | ||
| title="Message Popover Buttons" | ||
| description="These buttons appear when you hover over a message." | ||
| buttonMap={MessagePopoverButtonMap} | ||
| settings={uiElements.messagePopoverButtons} | ||
| /> | ||
| </ModalContent> | ||
| </ModalRoot> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.