feat(SW-66, SW-348): search functionality and ui

This commit is contained in:
Simon Emanuelsson
2024-08-28 10:47:57 +02:00
parent b9dbcf7d90
commit af850c90e7
437 changed files with 7663 additions and 9881 deletions

View File

@@ -1,11 +1,11 @@
import { headers } from "next/headers"
import { notFound, redirect } from "next/navigation"
import { serverClient } from "@/lib/trpc/server"
import { getProfile } from "@/lib/trpc/memoizedRequests"
import AccountPage from "@/components/ContentType/Webviews/AccountPage"
import LoyaltyPage from "@/components/ContentType/Webviews/LoyaltyPage"
import { getLang, setLang } from "@/i18n/serverContext"
import AccountPage from "@/components/Webviews/AccountPage"
import LoyaltyPage from "@/components/Webviews/LoyaltyPage"
import { setLang } from "@/i18n/serverContext"
import {
ContentTypeWebviewParams,
@@ -18,7 +18,7 @@ export default async function ContentTypePage({
params,
}: PageArgs<LangParams & ContentTypeWebviewParams & UIDParams, {}>) {
setLang(params.lang)
const user = await serverClient().user.get()
const user = await getProfile()
if (!user) {
console.log(`[webview:page] unable to load user`)
@@ -31,8 +31,8 @@ export default async function ContentTypePage({
case "forbidden": // fall through
case "token_expired":
const h = headers()
const returnURL = `/${getLang()}/webview${h.get("x-pathname")!}`
const redirectURL = `/${getLang()}/webview/refresh?returnUrl=${encodeURIComponent(returnURL)}`
const returnURL = `/${params.lang}/webview${h.get("x-pathname")!}`
const redirectURL = `/${params.lang}/webview/refresh?returnUrl=${encodeURIComponent(returnURL)}`
console.log(`[webview:page] user error, redirecting to: ${redirectURL}`)
redirect(redirectURL)
case "notfound":

View File

@@ -8,7 +8,7 @@ import TrpcProvider from "@/lib/trpc/Provider"
import AdobeSDKScript from "@/components/Current/AdobeSDKScript"
import { getIntl } from "@/i18n"
import ServerIntlProvider from "@/i18n/Provider"
import { getLang, setLang } from "@/i18n/serverContext"
import { setLang } from "@/i18n/serverContext"
import styles from "./layout.module.css"
@@ -28,7 +28,7 @@ export default async function RootLayout({
const { defaultLocale, locale, messages } = await getIntl()
return (
<html lang={getLang()}>
<html lang={params.lang}>
<head>
<AdobeSDKScript />
<Script id="ensure-adobeDataLayer">{`