Files
web/apps/scandic-web/app/[lang]/(live)/(protected)/my-pages/[...path]/page.tsx
Anton Gunnarsson 002d093af4 Merged in feat/sw-2863-move-contentstack-router-to-trpc-package (pull request #2389)
feat(SW-2863): Move contentstack router to trpc package

* Add exports to packages and lint rule to prevent relative imports

* Add env to trpc package

* Add eslint to trpc package

* Apply lint rules

* Use direct imports from trpc package

* Add lint-staged config to trpc

* Move lang enum to common

* Restructure trpc package folder structure

* WIP first step

* update internal imports in trpc

* Fix most errors in scandic-web

Just 100 left...

* Move Props type out of trpc

* Fix CategorizedFilters types

* Move more schemas in hotel router

* Fix deps

* fix getNonContentstackUrls

* Fix import error

* Fix entry error handling

* Fix generateMetadata metrics

* Fix alertType enum

* Fix duplicated types

* lint:fix

* Merge branch 'master' into feat/sw-2863-move-contentstack-router-to-trpc-package

* Fix broken imports

* Merge branch 'master' into feat/sw-2863-move-contentstack-router-to-trpc-package


Approved-by: Linus Flood
2025-06-26 07:53:01 +00:00

75 lines
2.0 KiB
TypeScript

import { Typography } from "@scandic-hotels/design-system/Typography"
import { serverClient } from "@/lib/trpc/server"
import Blocks from "@/components/Blocks"
import Image from "@/components/Image"
import SectionHeader from "@/components/Section/Header"
import TrackingSDK from "@/components/TrackingSDK"
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}
sizes="100vw"
fill
priority
/>
) : null}
</header>
) : (
<SectionHeader
title={heading}
preamble={preamble}
headingAs="h1"
headingLevel="h1"
/>
)}
{content?.length ? (
<Blocks blocks={content} />
) : (
<p>
{intl.formatMessage({
defaultMessage: "No content published",
})}
</p>
)}
</main>
<TrackingSDK pageData={tracking} />
</>
)
}