1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-09-18 01:50:50 +00:00

refactor: clean up disabled condition

This commit is contained in:
Ash Keel 2022-12-07 11:02:59 +01:00
parent 18adbc2397
commit 75a9a7183e
No known key found for this signature in database
GPG key ID: BAD8D93E7314ED3E

View file

@ -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 (
<form
@ -103,7 +104,7 @@ function TwitchBotSettings() {
type="text"
id="bot-channel"
required={active}
disabled={!active || status?.type === 'pending'}
disabled={disabled}
value={botConfig?.channel ?? ''}
onChange={(ev) =>
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(