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