feat(SW-2264): Added campaign overview page
Approved-by: Matilda Landström
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { generateTag, generateTagsFromSystem } from "@/utils/generateTag"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
|
||||
import type { System } from "@/types/requests/system"
|
||||
import type { CampaignOverviewPageRefs } from "@/types/trpc/routers/contentstack/campaignOverviewPage"
|
||||
|
||||
export function generatePageTags(
|
||||
validatedData: CampaignOverviewPageRefs,
|
||||
lang: Lang
|
||||
): string[] {
|
||||
const connections = getConnections(validatedData)
|
||||
return [
|
||||
generateTagsFromSystem(lang, connections),
|
||||
generateTag(lang, validatedData.campaign_overview_page.system.uid),
|
||||
].flat()
|
||||
}
|
||||
|
||||
export function getConnections({
|
||||
campaign_overview_page,
|
||||
}: CampaignOverviewPageRefs) {
|
||||
const connections: System["system"][] = [campaign_overview_page.system]
|
||||
|
||||
if (campaign_overview_page.header.navigation_links) {
|
||||
campaign_overview_page.header.navigation_links.forEach((link) => {
|
||||
if (link.link) {
|
||||
connections.push(link.link)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return connections
|
||||
}
|
||||
Reference in New Issue
Block a user