From 69bac68eae2cb9400744eb29d5dcf70420b87a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vilde=20Oppeg=C3=A5rd?= Date: Tue, 4 Jul 2023 09:45:51 +0200 Subject: [PATCH] fix(edit): created new type for removing footer --- next-tavla/src/Admin/components/FooterInput/index.tsx | 3 +-- next-tavla/src/Admin/scenarios/Edit/reducer.tsx | 7 +++++++ next-tavla/src/Shared/types/settings.ts | 3 +-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/next-tavla/src/Admin/components/FooterInput/index.tsx b/next-tavla/src/Admin/components/FooterInput/index.tsx index 0df52e8c1..4079e9a75 100644 --- a/next-tavla/src/Admin/components/FooterInput/index.tsx +++ b/next-tavla/src/Admin/components/FooterInput/index.tsx @@ -20,8 +20,7 @@ function FooterInput({ footer }: { footer?: string }) { clearable={true} onClear={() => dispatch({ - type: 'addFooter', - footer: '', + type: 'removeFooter', }) } /> diff --git a/next-tavla/src/Admin/scenarios/Edit/reducer.tsx b/next-tavla/src/Admin/scenarios/Edit/reducer.tsx index a5b29e551..50c943b76 100644 --- a/next-tavla/src/Admin/scenarios/Edit/reducer.tsx +++ b/next-tavla/src/Admin/scenarios/Edit/reducer.tsx @@ -27,6 +27,7 @@ export type Action = } | { type: 'toggleLine'; tileId: string; lineId: string } | { type: 'addFooter'; footer: string } + | { type: 'removeFooter' } export function settingsReducer( settings: TSettings, @@ -170,5 +171,11 @@ export function settingsReducer( footer: action.footer, } } + case 'removeFooter': { + return { + ...settings, + footer: '', + } + } } } diff --git a/next-tavla/src/Shared/types/settings.ts b/next-tavla/src/Shared/types/settings.ts index c5efd5d9a..f2789d575 100644 --- a/next-tavla/src/Shared/types/settings.ts +++ b/next-tavla/src/Shared/types/settings.ts @@ -1,11 +1,10 @@ import { TTile } from './tile' export type TTheme = 'entur' | 'dark' | 'light' -export type TFooter = string export type TSettings = { tiles: TTile[] version?: number theme?: TTheme - footer?: TFooter + footer?: string }