diff options
author | Nuckyz <61953774+Nuckyz@users.noreply.github.com> | 2023-04-04 10:26:53 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-04 15:26:53 +0200 |
commit | 96dc2e12d030ac6d725bdfc58f1c47d35aae67a8 (patch) | |
tree | 54085a1db7d8bdf07d6694c16b38fe50ea2f859b /src | |
parent | d931790ed0dd41b22df01584dc63d9b2b78ab6a6 (diff) | |
download | Vencord-96dc2e12d030ac6d725bdfc58f1c47d35aae67a8.tar.gz Vencord-96dc2e12d030ac6d725bdfc58f1c47d35aae67a8.tar.bz2 Vencord-96dc2e12d030ac6d725bdfc58f1c47d35aae67a8.zip |
Fix Web & Game Activity Toggle (#777)
Diffstat (limited to 'src')
-rw-r--r-- | src/components/PluginSettings/index.tsx | 3 | ||||
-rw-r--r-- | src/plugins/consoleShortcuts.ts | 1 | ||||
-rw-r--r-- | src/plugins/devCompanion.dev.tsx | 6 | ||||
-rw-r--r-- | src/plugins/gameActivityToggle/index.tsx | 45 | ||||
-rw-r--r-- | src/plugins/gameActivityToggle/style.css | 16 |
5 files changed, 32 insertions, 39 deletions
diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx index 02d89f8..f3a5cd3 100644 --- a/src/components/PluginSettings/index.tsx +++ b/src/components/PluginSettings/index.tsx @@ -46,6 +46,7 @@ const cl = classNameFactory("vc-plugins-"); const logger = new Logger("PluginSettings", "#a6d189"); const InputStyles = findByPropsLazy("inputDefault", "inputWrapper"); +const ButtonClasses = findByPropsLazy("button", "disabled", "enabled"); const CogWheel = LazyComponent(() => findByCode("18.564C15.797 19.099 14.932 19.498 14 19.738V22H10V19.738C9.069")); const InfoIcon = LazyComponent(() => findByCode("4.4408921e-16 C4.4771525,-1.77635684e-15 4.4408921e-16")); @@ -154,7 +155,7 @@ function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLe <Text variant="text-md/bold" className={cl("name")}> {plugin.name}{isNew && <Badge text="NEW" color="#ED4245" />} </Text> - <button role="switch" onClick={() => openModal()} className={classes("button-12Fmur", cl("info-button"))}> + <button role="switch" onClick={() => openModal()} className={classes(ButtonClasses.button, cl("info-button"))}> {plugin.options ? <CogWheel /> : <InfoIcon width="24" height="24" />} diff --git a/src/plugins/consoleShortcuts.ts b/src/plugins/consoleShortcuts.ts index 056d246..0489c2c 100644 --- a/src/plugins/consoleShortcuts.ts +++ b/src/plugins/consoleShortcuts.ts @@ -72,6 +72,7 @@ export default definePlugin({ findAllByProps: (...props: string[]) => findAll(filters.byProps(...props)), findByCode: newFindWrapper(filters.byCode), findAllByCode: (code: string) => findAll(filters.byCode(code)), + findStore: newFindWrapper(filters.byStoreName), PluginsApi: Vencord.Plugins, plugins: Vencord.Plugins.plugins, React, diff --git a/src/plugins/devCompanion.dev.tsx b/src/plugins/devCompanion.dev.tsx index c675fc2..b84dd75 100644 --- a/src/plugins/devCompanion.dev.tsx +++ b/src/plugins/devCompanion.dev.tsx @@ -161,7 +161,11 @@ function initWs(isManual = false) { return reply("Expected exactly one 'find' matches, found " + keys.length); const mod = candidates[keys[0]]; - let src = String(mod.original ?? mod); + let src = String(mod.original ?? mod).replaceAll("\n", ""); + + if (src.startsWith("function(")) { + src = "0," + src; + } let i = 0; diff --git a/src/plugins/gameActivityToggle/index.tsx b/src/plugins/gameActivityToggle/index.tsx index 6926505..c656f3c 100644 --- a/src/plugins/gameActivityToggle/index.tsx +++ b/src/plugins/gameActivityToggle/index.tsx @@ -21,36 +21,39 @@ import { disableStyle, enableStyle } from "@api/Styles"; import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import definePlugin from "@utils/types"; -import { Tooltip } from "@webpack/common"; +import { findByCodeLazy } from "@webpack"; import style from "./style.css?managed"; const ShowCurrentGame = getSettingStoreLazy<boolean>("status", "showCurrentGame"); +const Button = findByCodeLazy("Button.Sizes.NONE,disabled:"); + +function makeIcon(showCurrentGame?: boolean) { + return function () { + return ( + <svg + width="24" + height="24" + viewBox="0 96 960 960" + > + <path fill="currentColor" d="M182 856q-51 0-79-35.5T82 734l42-300q9-60 53.5-99T282 296h396q60 0 104.5 39t53.5 99l42 300q7 51-21 86.5T778 856q-21 0-39-7.5T706 826l-90-90H344l-90 90q-15 15-33 22.5t-39 7.5Zm498-240q17 0 28.5-11.5T720 576q0-17-11.5-28.5T680 536q-17 0-28.5 11.5T640 576q0 17 11.5 28.5T680 616Zm-80-120q17 0 28.5-11.5T640 456q0-17-11.5-28.5T600 416q-17 0-28.5 11.5T560 456q0 17 11.5 28.5T600 496ZM310 616h60v-70h70v-60h-70v-70h-60v70h-70v60h70v70Z" /> + {!showCurrentGame && <line x1="920" y1="280" x2="40" y2="880" stroke="var(--status-danger)" stroke-width="80" />} + </svg> + ); + }; +} function GameActivityToggleButton() { const showCurrentGame = ShowCurrentGame?.useSetting(); return ( - <Tooltip text="Toggle Game Activity"> - {tooltipProps => ( - <button - {...tooltipProps} - className="game-activity-toggle-btn" - onClick={() => ShowCurrentGame?.updateSetting(old => !old)} - > - <svg - width="24" - height="24" - viewBox="0 96 960 960" - > - <g fill="currentColor"> - <path d="M182 856q-51 0-79-35.5T82 734l42-300q9-60 53.5-99T282 296h396q60 0 104.5 39t53.5 99l42 300q7 51-21 86.5T778 856q-21 0-39-7.5T706 826l-90-90H344l-90 90q-15 15-33 22.5t-39 7.5Zm498-240q17 0 28.5-11.5T720 576q0-17-11.5-28.5T680 536q-17 0-28.5 11.5T640 576q0 17 11.5 28.5T680 616Zm-80-120q17 0 28.5-11.5T640 456q0-17-11.5-28.5T600 416q-17 0-28.5 11.5T560 456q0 17 11.5 28.5T600 496ZM310 616h60v-70h70v-60h-70v-70h-60v70h-70v60h70v70Z" /> - {!showCurrentGame && <line x1="920" y1="280" x2="40" y2="880" stroke="var(--status-danger)" stroke-width="80" />} - </g> - </svg> - </button> - )} - </Tooltip> + <Button + tooltipText="Toggle Game Activity" + icon={makeIcon(showCurrentGame)} + role="switch" + aria-checked={!showCurrentGame} + onClick={() => ShowCurrentGame?.updateSetting(old => !old)} + /> ); } diff --git a/src/plugins/gameActivityToggle/style.css b/src/plugins/gameActivityToggle/style.css index b6abf47..c25b366 100644 --- a/src/plugins/gameActivityToggle/style.css +++ b/src/plugins/gameActivityToggle/style.css @@ -1,19 +1,3 @@ [class*="withTagAsButton"] { min-width: 88px; } - -.game-activity-toggle-btn { - all: unset; - color: var(--interactive-normal); - width: 32px; - height: 32px; - border-radius: 4px; - display: flex; - justify-content: center; - align-items: center; -} - -.game-activity-toggle-btn:hover { - color: var(--interactive-hover); - background-color: var(--background-modifier-selected); -} |