Files
web/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx
Joakim Jäderberg aafad9781f Merged in feat/lokalise-rebuild (pull request #2993)
Feat/lokalise rebuild

* chore(lokalise): update translation ids

* chore(lokalise): easier to switch between projects

* chore(lokalise): update translation ids

* .

* .

* .

* .

* .

* .

* chore(lokalise): update translation ids

* chore(lokalise): update translation ids

* .

* .

* .

* chore(lokalise): update translation ids

* chore(lokalise): update translation ids

* .

* .

* chore(lokalise): update translation ids

* chore(lokalise): update translation ids

* chore(lokalise): new translations

* merge

* switch to errors for missing id's

* merge

* sync translations


Approved-by: Linus Flood
2025-10-22 11:00:03 +00:00

77 lines
2.1 KiB
TypeScript

import Image from "@scandic-hotels/design-system/Image"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { TrackingSDK } from "@scandic-hotels/tracking/TrackingSDK"
import { serverClient } from "@/lib/trpc/server"
import Blocks from "@/components/Blocks"
import SectionHeader from "@/components/Section/Header/Deprecated"
import { getIntl } from "@/i18n"
import styles from "./page.module.css"
import type { LangParams, PageArgs } from "@/types/params"
export { generateMetadata } from "@/utils/metadata/generateMetadata"
export default async function MyPages({}: PageArgs<
LangParams & { path: string[] }
>) {
const caller = await serverClient()
const accountPageRes = await caller.contentstack.accountPage.get()
const intl = await getIntl()
if (!accountPageRes) {
return null
}
const { tracking, accountPage } = accountPageRes
const { heading, preamble, hero_image, hero_image_active, content } =
accountPage
return (
<>
<main className={styles.blocks}>
{hero_image_active ? (
<header className={styles.header}>
<Typography variant="Title/lg">
<h1 className={styles.heading}>{heading}</h1>
</Typography>
{hero_image ? (
<Image
className={styles.image}
alt={hero_image.meta.alt || hero_image.meta.caption || ""}
src={hero_image.url}
focalPoint={hero_image.focalPoint}
dimensions={hero_image.dimensions}
sizes="100vw"
fill
priority
/>
) : null}
</header>
) : (
<SectionHeader
title={heading}
preamble={preamble}
headingAs="h1"
headingLevel="h1"
/>
)}
{content?.length ? (
<Blocks blocks={content} />
) : (
<p>
{intl.formatMessage({
id: "myPages.missingContent",
defaultMessage: "No content published",
})}
</p>
)}
</main>
<TrackingSDK pageData={tracking} />
</>
)
}