fix: error page for language switcher
This commit is contained in:
6
app/[lang]/(live)/@languageSwitcher/[...paths]/error.tsx
Normal file
6
app/[lang]/(live)/@languageSwitcher/[...paths]/error.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
"use client"
|
||||
|
||||
export default function Error({ error }: any) {
|
||||
// Don't return any content if error
|
||||
return null
|
||||
}
|
||||
6
app/[lang]/(live-current)/@languageSwitcher/error.tsx
Normal file
6
app/[lang]/(live-current)/@languageSwitcher/error.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
"use client"
|
||||
|
||||
export default function Error() {
|
||||
// Don't return any content if error
|
||||
return null
|
||||
}
|
||||
@@ -80,11 +80,11 @@ export default async function RootLayout({
|
||||
</head>
|
||||
<body className="theme-00Corecolours theme-X0Oldcorecolours">
|
||||
<LangPopup lang={params.lang} />
|
||||
<SkipToMainContent lang={params.lang} />
|
||||
<SkipToMainContent />
|
||||
<ServerIntlProvider intl={{ defaultLocale, locale, messages }}>
|
||||
<Header lang={params.lang} languageSwitcher={languageSwitcher} />
|
||||
{children}
|
||||
<Footer lang={params.lang} />
|
||||
<Header lang={params.lang} languageSwitcher={languageSwitcher} />
|
||||
{children}
|
||||
<Footer lang={params.lang} />
|
||||
</ServerIntlProvider>
|
||||
<Script id="page-tracking">{`
|
||||
typeof _satellite !== "undefined" && _satellite.pageBottom();
|
||||
|
||||
@@ -23,7 +23,9 @@ export default async function TopMenu({
|
||||
</a>
|
||||
|
||||
<ul className={styles.list}>
|
||||
<li className={styles.langSwitcher}>{languageSwitcher}</li>
|
||||
{languageSwitcher ? (
|
||||
<li className={styles.langSwitcher}>{languageSwitcher}</li>
|
||||
) : null}
|
||||
|
||||
{links.map(({ link }, i) => (
|
||||
<li key={link.href + i}>
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { login } from "@/constants/routes/handleAuth"
|
||||
|
||||
import { ScandicFriends } from "@/components/Levels"
|
||||
import Button from "@/components/TempDesignSystem/Button"
|
||||
import Link from "@/components/TempDesignSystem/Link"
|
||||
@@ -11,11 +13,12 @@ import Contact from "./Contact"
|
||||
import styles from "./joinLoyalty.module.css"
|
||||
|
||||
import type { JoinLoyaltyContactProps } from "@/types/components/loyalty/sidebar"
|
||||
import { LangParams } from "@/types/params"
|
||||
|
||||
export default async function JoinLoyaltyContact({
|
||||
block,
|
||||
lang,
|
||||
}: JoinLoyaltyContactProps) {
|
||||
}: JoinLoyaltyContactProps & LangParams) {
|
||||
const { formatMessage } = await getIntl()
|
||||
return (
|
||||
<section className={styles.container}>
|
||||
@@ -28,11 +31,9 @@ export default async function JoinLoyaltyContact({
|
||||
<Body textAlign="center">{block.preamble}</Body>
|
||||
) : null}
|
||||
<Button asChild className={styles.link} intent="primary">
|
||||
<Link href="#">
|
||||
{formatMessage({ id: "Join Scandic Friends" })}
|
||||
</Link>
|
||||
<Link href="#">{formatMessage({ id: "Join Scandic Friends" })}</Link>
|
||||
</Button>
|
||||
<Link href={`/${lang}/login`}>
|
||||
<Link href={login[lang]}>
|
||||
<Footnote textAlign="center" textTransform="bold">
|
||||
{formatMessage({ id: "Already a friend?" })} <br />
|
||||
{formatMessage({ id: "Click here to log in" })}
|
||||
|
||||
@@ -6,10 +6,14 @@ import styles from "./sidebar.module.css"
|
||||
|
||||
import { SidebarTypenameEnum } from "@/types/components/loyalty/enums"
|
||||
import { SidebarProps } from "@/types/components/loyalty/sidebar"
|
||||
import { LangParams } from "@/types/params"
|
||||
|
||||
export default function SidebarLoyalty({ blocks, lang }: SidebarProps) {
|
||||
export default function SidebarLoyalty({
|
||||
blocks,
|
||||
lang,
|
||||
}: SidebarProps & LangParams) {
|
||||
return (
|
||||
<aside className={styles.aside}>
|
||||
<aside className={styles.aside}>
|
||||
{blocks.map((block, idx) => {
|
||||
switch (block.__typename) {
|
||||
case SidebarTypenameEnum.LoyaltyPageSidebarContent:
|
||||
|
||||
@@ -9,10 +9,15 @@ import {
|
||||
} from "@/lib/graphql/Query/CurrentHeader.graphql"
|
||||
import { request } from "@/lib/graphql/request"
|
||||
import { internalServerError, notFound } from "@/server/errors/trpc"
|
||||
import { contentstackBaseProcedure, router } from "@/server/trpc"
|
||||
import {
|
||||
contentstackBaseProcedure,
|
||||
publicProcedure,
|
||||
router,
|
||||
} from "@/server/trpc"
|
||||
|
||||
import { generateTag } from "@/utils/generateTag"
|
||||
|
||||
import { langInput } from "./input"
|
||||
import {
|
||||
type ContactConfigData,
|
||||
FooterDataRaw,
|
||||
@@ -47,23 +52,21 @@ export const baseQueryRouter = router({
|
||||
|
||||
return validatedContactConfigConfig.data.all_contact_config.items[0]
|
||||
}),
|
||||
header: contentstackBaseProcedure.query(async ({ ctx }) => {
|
||||
header: publicProcedure.input(langInput).query(async ({ input }) => {
|
||||
const responseRef = await request<HeaderRefDataRaw>(GetCurrentHeaderRef, {
|
||||
locale: ctx.lang,
|
||||
locale: input.lang,
|
||||
})
|
||||
|
||||
const response = await request<HeaderDataRaw>(
|
||||
GetCurrentHeader,
|
||||
{ locale: ctx.lang },
|
||||
{ locale: input.lang },
|
||||
{
|
||||
next: {
|
||||
tags: [
|
||||
generateTag(
|
||||
ctx.lang,
|
||||
responseRef.data.all_current_header.items[0].system.uid
|
||||
),
|
||||
],
|
||||
},
|
||||
tags: [
|
||||
generateTag(
|
||||
input.lang,
|
||||
responseRef.data.all_current_header.items[0].system.uid
|
||||
),
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
@@ -88,25 +91,23 @@ export const baseQueryRouter = router({
|
||||
logo,
|
||||
} as HeaderData
|
||||
}),
|
||||
footer: contentstackBaseProcedure.query(async ({ ctx }) => {
|
||||
footer: publicProcedure.input(langInput).query(async ({ input }) => {
|
||||
const responseRef = await request<FooterRefDataRaw>(GetCurrentFooterRef, {
|
||||
locale: ctx.lang,
|
||||
locale: input.lang,
|
||||
})
|
||||
|
||||
const response = await request<FooterDataRaw>(
|
||||
GetCurrentFooter,
|
||||
{
|
||||
locale: ctx.lang,
|
||||
locale: input.lang,
|
||||
},
|
||||
{
|
||||
next: {
|
||||
tags: [
|
||||
generateTag(
|
||||
ctx.lang,
|
||||
responseRef.data.all_current_footer.items[0].system.uid
|
||||
),
|
||||
],
|
||||
},
|
||||
tags: [
|
||||
generateTag(
|
||||
input.lang,
|
||||
responseRef.data.all_current_footer.items[0].system.uid
|
||||
),
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ export type MainMenuProps = {
|
||||
links: CurrentHeaderLink[]
|
||||
logo: Image
|
||||
topMenuMobileLinks: TopMenuHeaderLink[]
|
||||
languageSwitcher: React.ReactNode
|
||||
languageSwitcher: React.ReactNode | null
|
||||
bookingHref: string
|
||||
isLoggedIn: boolean
|
||||
lang: Lang
|
||||
|
||||
@@ -6,6 +6,6 @@ export type TopMenuProps = {
|
||||
frontpageLinkText: string
|
||||
homeHref: string
|
||||
links: TopMenuHeaderLink[]
|
||||
languageSwitcher: React.ReactNode
|
||||
languageSwitcher: React.ReactNode | null
|
||||
lang: Lang
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user