fix(demonstration): modify the toolbox for checkbox (#179)
Some checks are pending
Sync to Codeberg / Sync Codeberg and Github (push) Waiting to run
Test / Test (push) Waiting to run

* fix(demonstration): modify the toolbox for checkbox

* Remove Logger

* Remove IsToggled

* Fixes

---------

Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com>
This commit is contained in:
panbread 2025-03-13 21:38:10 +04:00 committed by GitHub
parent c26c9f3b64
commit 5bb6148daf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 2 deletions

View file

@ -147,6 +147,5 @@ export default definePlugin({
}, },
stop() { stop() {
document.removeEventListener("keydown", handleKeydown); document.removeEventListener("keydown", handleKeydown);
}, }
}); });

View file

@ -43,6 +43,25 @@ function VencordPopout(onClose: () => void) {
> >
{Object.entries(plugin.toolboxActions).map(([text, action]) => { {Object.entries(plugin.toolboxActions).map(([text, action]) => {
const key = `vc-toolbox-${plugin.name}-${text}`; const key = `vc-toolbox-${plugin.name}-${text}`;
if (plugin.name === "Demonstration") {
const [demonstrationToggled, setToggled] = useState(false);
return (
<Menu.MenuCheckboxItem
id="vc-toolbox-demonstration-toggle"
key={key}
checked={!!demonstrationToggled}
label={text}
action={
() => {
action();
setToggled(!demonstrationToggled);
}
}
/>
);
}
return ( return (
<Menu.MenuItem <Menu.MenuItem