Merged in feat/SW-1450-destination-page-cs-components (pull request #1204)

feat(SW-1450): added components in destination pages from cs

* feat(SW-1450): added components in destination pages from cs

* feat(SW-1450): added correct refs and removed classNames


Approved-by: Fredrik Thorsson
This commit is contained in:
Erik Tiekstra
2025-01-24 12:06:43 +00:00
parent 7343d873c2
commit a88a033e30
45 changed files with 1237 additions and 195 deletions
@@ -0,0 +1,32 @@
import { generateTag, generateTagsFromSystem } from "@/utils/generateTag"
import type { System } from "@/types/requests/system"
import type { GetDestinationCountryPageRefsSchema } from "@/types/trpc/routers/contentstack/destinationCountryPage"
import type { Lang } from "@/constants/languages"
export function generatePageTags(
validatedData: GetDestinationCountryPageRefsSchema,
lang: Lang
): string[] {
const connections = getConnections(validatedData)
return [
generateTagsFromSystem(lang, connections),
generateTag(lang, validatedData.destination_country_page.system.uid),
].flat()
}
export function getConnections({
destination_country_page,
}: GetDestinationCountryPageRefsSchema) {
const connections: System["system"][] = [destination_country_page.system]
if (destination_country_page.sidepeek_content) {
destination_country_page.sidepeek_content.content.embedded_itemsConnection.edges.forEach(
({ node }) => {
connections.push(node.system)
}
)
}
return connections
}