fix: add link to overview

This commit is contained in:
Christel Westerberg
2024-05-22 15:26:30 +02:00
parent bac513ec4c
commit ad5fb9c89d
8 changed files with 34 additions and 105 deletions

View File

@@ -3,4 +3,5 @@
gap: 4.2rem;
padding-left: 2rem;
padding-right: 2rem;
padding-top: 2rem;
}

View File

@@ -1,9 +1,9 @@
import { serverClient } from "@/lib/trpc/server"
import BackButton from "@/components/BackButton"
import { Blocks } from "@/components/Loyalty/Blocks/WebView"
import Sidebar from "@/components/Loyalty/Sidebar"
import MaxWidth from "@/components/MaxWidth"
import LinkToOverview from "@/components/Webviews/LinkToOverview"
import styles from "./page.module.css"
@@ -15,10 +15,9 @@ export default async function AboutScandicFriends({
const loyaltyPage = await serverClient().contentstack.loyaltyPage.get()
return (
<section className={styles.content}>
<LinkToOverview lang={params.lang} />
{loyaltyPage.sidebar ? <Sidebar blocks={loyaltyPage.sidebar} /> : null}
<MaxWidth className={styles.blocks} tag="main">
<BackButton />
<Blocks blocks={loyaltyPage.blocks} lang={params.lang} />
</MaxWidth>
</section>

View File

@@ -3,4 +3,5 @@
gap: 4.2rem;
padding-left: 2rem;
padding-right: 2rem;
padding-top: 2rem;
}

View File

@@ -1,13 +1,12 @@
import "@/app/globals.css"
import "@scandic-hotels/design-system/style.css"
import { overview } from "@/constants/routes/myPages"
import { _ } from "@/lib/translation"
import { overview } from "@/constants/routes/webviews"
import { serverClient } from "@/lib/trpc/server"
import BackButton from "@/components/BackButton"
import MaxWidth from "@/components/MaxWidth"
import Content from "@/components/MyPages/AccountPage/Webview/Content"
import LinkToOverview from "@/components/Webviews/LinkToOverview"
import styles from "./page.module.css"
@@ -16,11 +15,12 @@ import { LangParams, PageArgs } from "@/types/params"
export default async function MyPages({ params }: PageArgs<LangParams>) {
const accountPage = await serverClient().contentstack.accountPage.get()
const isNotOverviewPage = accountPage.url !== overview[params.lang]
const linkToOverview =
`/${params.lang}/webview${accountPage.url}` !== overview[params.lang]
return (
<MaxWidth className={styles.blocks} tag="main">
{isNotOverviewPage ? <BackButton /> : null}
{linkToOverview ? <LinkToOverview lang={params.lang} /> : null}
<Content lang={params.lang} content={accountPage.content} />
</MaxWidth>
)