From 75a9a7183e850efa32a1915fdbb2aca02858b8b6 Mon Sep 17 00:00:00 2001 From: Ash Keel Date: Wed, 7 Dec 2022 11:02:59 +0100 Subject: [PATCH] refactor: clean up disabled condition --- frontend/src/ui/pages/TwitchSettings.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/ui/pages/TwitchSettings.tsx b/frontend/src/ui/pages/TwitchSettings.tsx index 0c37069..0ebde8e 100644 --- a/frontend/src/ui/pages/TwitchSettings.tsx +++ b/frontend/src/ui/pages/TwitchSettings.tsx @@ -63,6 +63,7 @@ function TwitchBotSettings() { const { t } = useTranslation(); const [revealBotToken, setRevealBotToken] = useState(false); const active = twitchConfig?.enable_bot ?? false; + const disabled = !active || status?.type === 'pending'; return (
dispatch( @@ -126,7 +127,7 @@ function TwitchBotSettings() { type="text" id="bot-username" required={active} - disabled={!active || status?.type === 'pending'} + disabled={disabled} value={botConfig?.username ?? ''} onChange={(ev) => dispatch( @@ -147,7 +148,7 @@ function TwitchBotSettings() { reveal={revealBotToken} id="bot-oauth" required={active} - disabled={!active || status?.type === 'pending'} + disabled={disabled} value={botConfig?.oauth ?? ''} onChange={(ev) => dispatch( @@ -178,7 +179,7 @@ function TwitchBotSettings() { type="number" id="bot-chat-history" required={active} - disabled={!active || status?.type === 'pending'} + disabled={disabled} value={botConfig?.chat_history ?? ''} onChange={(ev) => dispatch(