From 776abe186edabc551b5fe90150fc15d385b7898f Mon Sep 17 00:00:00 2001 From: Ash Keel Date: Sun, 5 Dec 2021 22:18:08 +0100 Subject: [PATCH] Remove "enabled" toggle on timer module --- frontend/src/store/api/reducer.ts | 8 ---- frontend/src/store/api/types.ts | 5 --- frontend/src/ui/pages/twitch/Timers.tsx | 54 ++++++------------------- 3 files changed, 12 insertions(+), 55 deletions(-) diff --git a/frontend/src/store/api/reducer.ts b/frontend/src/store/api/reducer.ts index 59ed610..ca8403b 100644 --- a/frontend/src/store/api/reducer.ts +++ b/frontend/src/store/api/reducer.ts @@ -155,13 +155,6 @@ export const modules = { state.moduleConfigs.twitchBotConfig = payload; }, ), - twitchBotModulesConfig: makeModule( - 'twitch/bot-modules/config', - (state) => state.twitchBot?.modules, - (state, { payload }) => { - state.twitchBot.modules = payload; - }, - ), twitchBotCommands: makeModule( 'twitch/bot-custom-commands', (state) => state.twitchBot?.commands, @@ -252,7 +245,6 @@ const initialState: APIState = { }, twitchBot: { commands: null, - modules: null, timers: null, }, moduleConfigs: { diff --git a/frontend/src/store/api/types.ts b/frontend/src/store/api/types.ts index 6c4f4e6..56f2291 100644 --- a/frontend/src/store/api/types.ts +++ b/frontend/src/store/api/types.ts @@ -31,10 +31,6 @@ interface TwitchBotConfig { chat_history: number; } -interface TwitchModulesConfig { - enable_timers: boolean; -} - export type AccessLevelType = | 'everyone' | 'subscribers' @@ -134,7 +130,6 @@ export interface APIState { }; twitchBot: { commands: TwitchBotCustomCommands; - modules: TwitchModulesConfig; timers: TwitchBotTimersConfig; }; moduleConfigs: { diff --git a/frontend/src/ui/pages/twitch/Timers.tsx b/frontend/src/ui/pages/twitch/Timers.tsx index f13e1dc..dce0c25 100644 --- a/frontend/src/ui/pages/twitch/Timers.tsx +++ b/frontend/src/ui/pages/twitch/Timers.tsx @@ -244,9 +244,6 @@ export default function TwitchBotTimersPage( props: RouteComponentProps, ): React.ReactElement { const [twitchConfig] = useModule(modules.twitchConfig); - const [moduleConfig, setModuleConfig] = useModule( - modules.twitchBotModulesConfig, - ); const [timerConfig, setTimerConfig] = useModule(modules.twitchBotTimers); const dispatch = useDispatch(); const { t } = useTranslation(); @@ -257,8 +254,6 @@ export default function TwitchBotTimersPage( const timerFilterLC = timerFilter.toLowerCase(); const botActive = twitchConfig?.enable_bot ?? false; - const timersActive = moduleConfig?.enable_timers ?? false; - const active = botActive && timersActive; const createTimer = (name: string, data: TwitchBotTimer): void => { dispatch( @@ -333,31 +328,9 @@ export default function TwitchBotTimersPage( return ( <>

{t('twitch.timers.header')}

- - -

-

@@ -366,7 +339,6 @@ export default function TwitchBotTimersPage( setTimerFilter(ev.target.value)} @@ -397,19 +369,17 @@ export default function TwitchBotTimersPage( /> ) : null}
- {timersActive - ? Object.keys(timerConfig?.timers ?? {}) - ?.filter((cmd) => cmd.toLowerCase().includes(timerFilterLC)) - .map((timer) => ( - deleteTimer(timer)} - onEdit={() => setShowModifyTimer(timer)} - onToggleState={() => toggleTimer(timer)} - /> - )) - : null} + {Object.keys(timerConfig?.timers ?? {}) + ?.filter((cmd) => cmd.toLowerCase().includes(timerFilterLC)) + .map((timer) => ( + deleteTimer(timer)} + onEdit={() => setShowModifyTimer(timer)} + onToggleState={() => toggleTimer(timer)} + /> + ))}
);