From aca3c7f398a5132e2a6cdac6addd8db91c8b5c50 Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Mon, 17 Mar 2025 08:58:29 +0000 Subject: [PATCH] feat(SW-1712): Preperation to accept multiple different icon identifiers for filters on startpage and destination overview page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Approved-by: Fredrik Thorsson Approved-by: Matilda Landström --- apps/scandic-web/components/TabFilters/index.tsx | 5 +---- .../contentstack/schemas/blocks/cardGallery.ts | 11 ++--------- .../contentstack/schemas/blocks/carouselCards.ts | 11 ++--------- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/apps/scandic-web/components/TabFilters/index.tsx b/apps/scandic-web/components/TabFilters/index.tsx index 7d6e906e2..525c3bbe6 100644 --- a/apps/scandic-web/components/TabFilters/index.tsx +++ b/apps/scandic-web/components/TabFilters/index.tsx @@ -7,11 +7,8 @@ import useScrollShadows from "@/hooks/useScrollShadows" import styles from "./tabFilters.module.css" -import type { CardGalleryFilter } from "@/types/enums/cardGallery" -import type { CarouselCardFilter } from "@/types/enums/carouselCards" - interface Filter { - identifier: CarouselCardFilter | CardGalleryFilter + identifier: string label: string } diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cardGallery.ts b/apps/scandic-web/server/routers/contentstack/schemas/blocks/cardGallery.ts index 1a8261bfe..0f5ce6672 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/cardGallery.ts +++ b/apps/scandic-web/server/routers/contentstack/schemas/blocks/cardGallery.ts @@ -9,10 +9,6 @@ import { buttonSchema } from "./utils/buttonLinkSchema" import { linkConnectionRefsSchema } from "./utils/linkConnection" import { BlocksEnums } from "@/types/enums/blocks" -import { - type CardGalleryFilter, - CardGalleryFilterEnum, -} from "@/types/enums/cardGallery" export const cardGallerySchema = z.object({ typename: z @@ -25,7 +21,7 @@ export const cardGallerySchema = z.object({ link: buttonSchema.optional(), card_groups: z.array( z.object({ - filter_identifier: z.nativeEnum(CardGalleryFilterEnum), + filter_identifier: z.string(), filter_label: z.string(), cardsConnection: z.object({ edges: z.array(z.object({ node: contentCardSchema })), @@ -35,10 +31,7 @@ export const cardGallerySchema = z.object({ }) .transform((data) => { const filterCategories = data.card_groups.reduce< - Array<{ - identifier: CardGalleryFilter - label: string - }> + Array<{ identifier: string; label: string }> >((acc, group) => { const identifier = group.filter_identifier if (!acc.some((category) => category.identifier === identifier)) { diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/carouselCards.ts b/apps/scandic-web/server/routers/contentstack/schemas/blocks/carouselCards.ts index 4a7db50aa..c7c195ebe 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/carouselCards.ts +++ b/apps/scandic-web/server/routers/contentstack/schemas/blocks/carouselCards.ts @@ -9,10 +9,6 @@ import { buttonSchema } from "./utils/buttonLinkSchema" import { linkConnectionRefsSchema } from "./utils/linkConnection" import { BlocksEnums } from "@/types/enums/blocks" -import { - type CarouselCardFilter, - CarouselCardFilterEnum, -} from "@/types/enums/carouselCards" const commonFields = { heading: z.string().optional(), @@ -24,7 +20,7 @@ const carouselCardsWithFilters = z.object({ enable_filters: z.literal(true), card_groups: z.array( z.object({ - filter_identifier: z.nativeEnum(CarouselCardFilterEnum), + filter_identifier: z.string(), filter_label: z.string(), cardConnection: z.object({ edges: z.array(z.object({ node: contentCardSchema })), @@ -78,10 +74,7 @@ export const carouselCardsSchema = z.object({ } const filterCategories = data.card_groups.reduce< - Array<{ - identifier: CarouselCardFilter - label: string - }> + Array<{ identifier: string; label: string }> >((acc, group) => { const identifier = group.filter_identifier if (!acc.some((category) => category.identifier === identifier)) {