feat: add ability to access localized entries of Hotel pages through language switcher
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
|||||||
UIDParams,
|
UIDParams,
|
||||||
} from "@/types/params"
|
} from "@/types/params"
|
||||||
|
|
||||||
export default function ContentTypeLayout({
|
export default async function ContentTypeLayout({
|
||||||
breadcrumbs,
|
breadcrumbs,
|
||||||
children,
|
children,
|
||||||
}: React.PropsWithChildren<
|
}: React.PropsWithChildren<
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export default async function HotelPage({ lang }: LangParams) {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<section className={styles.content}>
|
<section className={styles.content}>
|
||||||
<Title>ID: {hotelPage.hotel_page_id}</Title>
|
<Title>{hotelPage.title}</Title>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,3 +5,39 @@ query GetHotelPage($locale: String!, $uid: String!) {
|
|||||||
title
|
title
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
query GetDaDeEnUrlsHotelPage($uid: String!) {
|
||||||
|
de: all_hotel_page(where: { uid: $uid }, locale: "de") {
|
||||||
|
items {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
en: all_hotel_page(where: { uid: $uid }, locale: "en") {
|
||||||
|
items {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
da: all_hotel_page(where: { uid: $uid }, locale: "da") {
|
||||||
|
items {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query GetFiNoSvUrlsHotelPage($uid: String!) {
|
||||||
|
fi: all_hotel_page(where: { uid: $uid }, locale: "fi") {
|
||||||
|
items {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
no: all_hotel_page(where: { uid: $uid }, locale: "no") {
|
||||||
|
items {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sv: all_hotel_page(where: { uid: $uid }, locale: "sv") {
|
||||||
|
items {
|
||||||
|
url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ import {
|
|||||||
GetDaDeEnUrlsAccountPage,
|
GetDaDeEnUrlsAccountPage,
|
||||||
GetFiNoSvUrlsAccountPage,
|
GetFiNoSvUrlsAccountPage,
|
||||||
} from "@/lib/graphql/Query/AccountPage.graphql"
|
} from "@/lib/graphql/Query/AccountPage.graphql"
|
||||||
|
import {
|
||||||
|
GetDaDeEnUrlsHotelPage,
|
||||||
|
GetFiNoSvUrlsHotelPage,
|
||||||
|
} from "@/lib/graphql/Query/HotelPage.graphql"
|
||||||
import {
|
import {
|
||||||
GetDaDeEnUrlsCurrentBlocksPage,
|
GetDaDeEnUrlsCurrentBlocksPage,
|
||||||
GetFiNoSvUrlsCurrentBlocksPage,
|
GetFiNoSvUrlsCurrentBlocksPage,
|
||||||
@@ -84,6 +88,19 @@ async function getLanguageSwitcher(options: LanguageSwitcherVariables) {
|
|||||||
tags: tagsFiNoSv,
|
tags: tagsFiNoSv,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
case PageTypeEnum.hotelPage:
|
||||||
|
return await batchRequest<LanguageSwitcherQueryDataRaw>([
|
||||||
|
{
|
||||||
|
document: GetDaDeEnUrlsHotelPage,
|
||||||
|
variables,
|
||||||
|
tags: tagsDaDeEn,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
document: GetFiNoSvUrlsHotelPage,
|
||||||
|
variables,
|
||||||
|
tags: tagsFiNoSv,
|
||||||
|
},
|
||||||
|
])
|
||||||
default:
|
default:
|
||||||
console.info(`type: [${options.contentType}]`)
|
console.info(`type: [${options.contentType}]`)
|
||||||
console.error(`Trying to get a content type that is not supported`)
|
console.error(`Trying to get a content type that is not supported`)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export enum PageTypeEnum {
|
export enum PageTypeEnum {
|
||||||
accountPage = "account-page",
|
accountPage = "account-page",
|
||||||
loyaltyPage = "loyalty-page",
|
loyaltyPage = "loyalty-page",
|
||||||
|
hotelPage = "hotel-page",
|
||||||
currentBlocksPage = "current-blocks-page",
|
currentBlocksPage = "current-blocks-page",
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user