fix: links issues, translations and layouts

This commit is contained in:
Christel Westerberg
2024-07-05 14:25:35 +02:00
parent 1e3bbed6d1
commit e49065124b
4 changed files with 22 additions and 9 deletions

View File

@@ -3,6 +3,9 @@ import "@scandic-hotels/design-system/style.css"
import TrpcProvider from "@/lib/trpc/Provider" import TrpcProvider from "@/lib/trpc/Provider"
import { getIntl } from "@/i18n"
import ServerIntlProvider from "@/i18n/Provider"
import styles from "./layout.module.css" import styles from "./layout.module.css"
import type { Metadata } from "next" import type { Metadata } from "next"
@@ -13,14 +16,17 @@ export const metadata: Metadata = {
title: "Webview", title: "Webview",
} }
export default function RootLayout({ export default async function RootLayout({
children, children,
params, params,
}: React.PropsWithChildren<LayoutArgs<LangParams>>) { }: React.PropsWithChildren<LayoutArgs<LangParams>>) {
const { defaultLocale, locale, messages } = await getIntl()
return ( return (
<html lang={params.lang}> <html lang={params.lang}>
<body className={styles.layout}> <body className={styles.layout}>
<TrpcProvider lang={params.lang}>{children}</TrpcProvider> <ServerIntlProvider intl={{ defaultLocale, locale, messages }}>
<TrpcProvider lang={params.lang}>{children}</TrpcProvider>
</ServerIntlProvider>
</body> </body>
</html> </html>
) )

View File

@@ -19,13 +19,11 @@ export default async function AboutScandicFriends({ lang }: LangParams) {
<section className={styles.content}> <section className={styles.content}>
<LinkToOverview lang={lang} /> <LinkToOverview lang={lang} />
{loyaltyPage.sidebar ? ( {loyaltyPage.sidebar.length ? (
<section className={styles.sidebar}> <Sidebar blocks={loyaltyPage.sidebar} lang={lang} />
<Sidebar blocks={loyaltyPage.sidebar} lang={lang} />
</section>
) : null} ) : null}
<MaxWidth tag="main"> <MaxWidth tag="main" className={styles.blocks}>
<Title>{loyaltyPage.heading}</Title> <Title>{loyaltyPage.heading}</Title>
<Blocks blocks={loyaltyPage.blocks} lang={lang} /> <Blocks blocks={loyaltyPage.blocks} lang={lang} />
</MaxWidth> </MaxWidth>

View File

@@ -8,3 +8,8 @@
margin-left: calc(var(--Spacing-x2) * -1); margin-left: calc(var(--Spacing-x2) * -1);
margin-right: calc(var(--Spacing-x2) * -1); margin-right: calc(var(--Spacing-x2) * -1);
} }
.blocks {
display: grid;
gap: var(--Spacing-x5);
}

View File

@@ -23,7 +23,7 @@ function DynamicComponent({ component, props }: AccountPageContentProps) {
return ( return (
<Overview <Overview
lang={props.lang} lang={props.lang}
link={undefined} link={props.link}
subtitle={null} subtitle={null}
title={props.title} title={props.title}
/> />
@@ -56,7 +56,11 @@ export default function Content({ lang, content }: ContentProps) {
href: href:
item.dynamic_content.link.linkConnection.edges[0].node item.dynamic_content.link.linkConnection.edges[0].node
.original_url || .original_url ||
`/${lang}/webview${item.dynamic_content.link.linkConnection.edges[0].node.url}`, modWebviewLink(
item.dynamic_content.link.linkConnection.edges[0].node
.url,
lang
),
text: item.dynamic_content.link.link_text, text: item.dynamic_content.link.link_text,
} }
: null : null