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:
parent
18adbc2397
commit
75a9a7183e
1 changed files with 5 additions and 4 deletions
|
@ -63,6 +63,7 @@ function TwitchBotSettings() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [revealBotToken, setRevealBotToken] = useState(false);
|
const [revealBotToken, setRevealBotToken] = useState(false);
|
||||||
const active = twitchConfig?.enable_bot ?? false;
|
const active = twitchConfig?.enable_bot ?? false;
|
||||||
|
const disabled = !active || status?.type === 'pending';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form
|
<form
|
||||||
|
@ -103,7 +104,7 @@ function TwitchBotSettings() {
|
||||||
type="text"
|
type="text"
|
||||||
id="bot-channel"
|
id="bot-channel"
|
||||||
required={active}
|
required={active}
|
||||||
disabled={!active || status?.type === 'pending'}
|
disabled={disabled}
|
||||||
value={botConfig?.channel ?? ''}
|
value={botConfig?.channel ?? ''}
|
||||||
onChange={(ev) =>
|
onChange={(ev) =>
|
||||||
dispatch(
|
dispatch(
|
||||||
|
@ -126,7 +127,7 @@ function TwitchBotSettings() {
|
||||||
type="text"
|
type="text"
|
||||||
id="bot-username"
|
id="bot-username"
|
||||||
required={active}
|
required={active}
|
||||||
disabled={!active || status?.type === 'pending'}
|
disabled={disabled}
|
||||||
value={botConfig?.username ?? ''}
|
value={botConfig?.username ?? ''}
|
||||||
onChange={(ev) =>
|
onChange={(ev) =>
|
||||||
dispatch(
|
dispatch(
|
||||||
|
@ -147,7 +148,7 @@ function TwitchBotSettings() {
|
||||||
reveal={revealBotToken}
|
reveal={revealBotToken}
|
||||||
id="bot-oauth"
|
id="bot-oauth"
|
||||||
required={active}
|
required={active}
|
||||||
disabled={!active || status?.type === 'pending'}
|
disabled={disabled}
|
||||||
value={botConfig?.oauth ?? ''}
|
value={botConfig?.oauth ?? ''}
|
||||||
onChange={(ev) =>
|
onChange={(ev) =>
|
||||||
dispatch(
|
dispatch(
|
||||||
|
@ -178,7 +179,7 @@ function TwitchBotSettings() {
|
||||||
type="number"
|
type="number"
|
||||||
id="bot-chat-history"
|
id="bot-chat-history"
|
||||||
required={active}
|
required={active}
|
||||||
disabled={!active || status?.type === 'pending'}
|
disabled={disabled}
|
||||||
value={botConfig?.chat_history ?? ''}
|
value={botConfig?.chat_history ?? ''}
|
||||||
onChange={(ev) =>
|
onChange={(ev) =>
|
||||||
dispatch(
|
dispatch(
|
||||||
|
|
Loading…
Reference in a new issue