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/plugins | |
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/plugins')
-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 |
4 files changed, 30 insertions, 38 deletions
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); -} |