({ script }: { script: Script })
| 4 | import { useCurrentGuildScripts } from "../modules/guilds/GuildScriptsProvider"; |
| 5 | |
| 6 | export 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 | } |
nothing calls this directly
no test coverage detected