From 09879d2f4a10e06563de627ec29daebb49645dcb Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Mon, 2 Jun 2025 09:37:20 +0000 Subject: [PATCH] feat(SW-2134): Added support for images inside accordions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Approved-by: Matilda Landström --- .../lib/graphql/Fragments/Blocks/Accordion.graphql | 7 +++++++ .../routers/contentstack/schemas/blocks/accordion.ts | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/scandic-web/lib/graphql/Fragments/Blocks/Accordion.graphql b/apps/scandic-web/lib/graphql/Fragments/Blocks/Accordion.graphql index e8f3b7400..619124266 100644 --- a/apps/scandic-web/lib/graphql/Fragments/Blocks/Accordion.graphql +++ b/apps/scandic-web/lib/graphql/Fragments/Blocks/Accordion.graphql @@ -1,3 +1,5 @@ +#import "../Image.graphql" + #import "../PageLink/AccountPageLink.graphql" #import "../PageLink/CollectionPageLink.graphql" #import "../PageLink/ContentPageLink.graphql" @@ -31,6 +33,7 @@ fragment AccordionBlock on Accordion { edges { node { __typename + ...Image ...AccountPageLink ...CollectionPageLink ...ContentPageLink @@ -57,6 +60,7 @@ fragment GlobalAccordionBlock on GlobalAccordion { edges { node { __typename + ...Image ...AccountPageLink ...CollectionPageLink ...ContentPageLink @@ -109,6 +113,7 @@ fragment SpecificAccordion_ContentPage on ContentPageBlocksAccordionBlockAccordi edges { node { __typename + ...Image ...AccountPageLink ...CollectionPageLink ...ContentPageLink @@ -209,6 +214,7 @@ fragment SpecificAccordion_DestinationCityPage on DestinationCityPageBlocksAccor edges { node { __typename + ...Image ...AccountPageLink ...CollectionPageLink ...ContentPageLink @@ -309,6 +315,7 @@ fragment SpecificAccordion_DestinationCountryPage on DestinationCountryPageBlock edges { node { __typename + ...Image ...AccountPageLink ...CollectionPageLink ...ContentPageLink diff --git a/apps/scandic-web/server/routers/contentstack/schemas/blocks/accordion.ts b/apps/scandic-web/server/routers/contentstack/schemas/blocks/accordion.ts index 7529d7d79..f5e84da59 100644 --- a/apps/scandic-web/server/routers/contentstack/schemas/blocks/accordion.ts +++ b/apps/scandic-web/server/routers/contentstack/schemas/blocks/accordion.ts @@ -5,9 +5,12 @@ import { linkUnionSchema, transformPageLink, } from "../pageLinks" +import { imageSchema } from "./image" import { BlocksEnums } from "@/types/enums/blocks" +export const embeddedContentSchema = z.union([linkUnionSchema, imageSchema]) + export const accordionItemsSchema = z.array( z.object({ question: z.string(), @@ -16,7 +19,7 @@ export const accordionItemsSchema = z.array( embedded_itemsConnection: z.object({ edges: z.array( z.object({ - node: linkUnionSchema.transform((data) => { + node: embeddedContentSchema.transform((data) => { const link = transformPageLink(data) if (link) { return link