MCPcopy Create free account
hub / github.com/Botloader/botloader / ScriptEnableToggle

Function ScriptEnableToggle

frontend/src/components/ScriptEnableToggle.tsx:6–19  ·  view source on GitHub ↗
({ script }: { script: Script })

Source from the content-addressed store, hash-verified

4import { useCurrentGuildScripts } from "../modules/guilds/GuildScriptsProvider";
5
6export function ScriptEnableToggle({ script }: { script: Script }) {
7 const [isToggling, setIsToggling] = useState(false)
8 const { toggleScript } = useCurrentGuildScripts();
9
10 return <Switch
11 checked={script.enabled}
12 disabled={isToggling}
13 color={"success"}
14 onChange={(evt) => {
15 setIsToggling(true)
16 toggleScript(script.id, evt.target.checked)
17 .finally(() => setIsToggling(false))
18 }} />
19}

Callers

nothing calls this directly

Calls 2

useCurrentGuildScriptsFunction · 0.90
toggleScriptFunction · 0.50

Tested by

no test coverage detected