From ccdd7031c3a7dac633d563a3091cf23754aae973 Mon Sep 17 00:00:00 2001 From: Ole Wieners Date: Mon, 12 Aug 2024 14:27:35 +0200 Subject: [PATCH] Adjust some typings Most notably the series title (in Tobira context) was made optional, so we don't have to pass an empty string to Tobira when it's not specified. --- .../events/partials/ModalTabsAndPages/NewTobiraPage.tsx | 3 +-- src/components/events/partials/wizards/NewSeriesSummary.tsx | 2 +- src/components/events/partials/wizards/NewSeriesWizard.tsx | 4 ++-- src/configs/modalConfig.ts | 2 +- src/slices/seriesSlice.ts | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/events/partials/ModalTabsAndPages/NewTobiraPage.tsx b/src/components/events/partials/ModalTabsAndPages/NewTobiraPage.tsx index df23036658..b2f2ea6877 100644 --- a/src/components/events/partials/ModalTabsAndPages/NewTobiraPage.tsx +++ b/src/components/events/partials/ModalTabsAndPages/NewTobiraPage.tsx @@ -109,7 +109,7 @@ const NewTobiraPage = ({ goto(formik.values.breadcrumbs.splice(index)[0]); }; - const select = (page: TobiraPage | undefined) => { + const select = (page?: TobiraPage) => { if (!page || !page.new) { stopEditing(); } @@ -161,7 +161,6 @@ const NewTobiraPage = ({ new: true, children: [], ancestors: [], - title: "", path: "", subpages: "", blocks: [], diff --git a/src/components/events/partials/wizards/NewSeriesSummary.tsx b/src/components/events/partials/wizards/NewSeriesSummary.tsx index fa7c58b64b..d6d5ffd192 100644 --- a/src/components/events/partials/wizards/NewSeriesSummary.tsx +++ b/src/components/events/partials/wizards/NewSeriesSummary.tsx @@ -20,7 +20,7 @@ import { TobiraPage } from "../../../../slices/seriesSlice"; interface RequiredFormProps { theme: string, acls: TransformedAcl[], - selectedPage: TobiraPage | undefined, + selectedPage?: TobiraPage, } const NewSeriesSummary = ({ diff --git a/src/components/events/partials/wizards/NewSeriesWizard.tsx b/src/components/events/partials/wizards/NewSeriesWizard.tsx index e4fe4c3fae..43401b8ca9 100644 --- a/src/components/events/partials/wizards/NewSeriesWizard.tsx +++ b/src/components/events/partials/wizards/NewSeriesWizard.tsx @@ -88,7 +88,7 @@ const NewSeriesWizard: React.FC<{ acls: TransformedAcl[]; theme: string; breadcrumbs: TobiraPage[]; - selectedPage: TobiraPage | undefined; + selectedPage?: TobiraPage; } ) => { setSnapshot(values); @@ -110,7 +110,7 @@ const NewSeriesWizard: React.FC<{ acls: TransformedAcl[]; theme: string; breadcrumbs: TobiraPage[]; - selectedPage: TobiraPage | undefined; + selectedPage?: TobiraPage; }, twoPagesBack?: boolean ) => { diff --git a/src/configs/modalConfig.ts b/src/configs/modalConfig.ts index d2df88a680..588f6acb24 100644 --- a/src/configs/modalConfig.ts +++ b/src/configs/modalConfig.ts @@ -95,7 +95,7 @@ export const initialFormValuesNewSeries: { theme: string, breadcrumbs: TobiraPage[], - selectedPage: TobiraPage | undefined, + selectedPage?: TobiraPage, [key: string]: any, // Metadata fields that are getting added later } = { acls: [ diff --git a/src/slices/seriesSlice.ts b/src/slices/seriesSlice.ts index 921a4b6c23..8faec7e80e 100644 --- a/src/slices/seriesSlice.ts +++ b/src/slices/seriesSlice.ts @@ -42,7 +42,7 @@ type Theme = { } export interface TobiraPage { - title: string | undefined, + title?: string, path: string, segment: string, children: TobiraPage[],