fix: rebase issues
This commit is contained in:
@@ -1,7 +0,0 @@
|
|||||||
import { auth } from "@/auth"
|
|
||||||
|
|
||||||
export default async function ByPass() {
|
|
||||||
const session = await auth()
|
|
||||||
|
|
||||||
return <pre>{JSON.stringify(session, null, 2)}</pre>
|
|
||||||
}
|
|
||||||
@@ -41,38 +41,38 @@ export async function GET(
|
|||||||
"redirectTo=; Expires=Thu, 01 Jan 1970 00:00:00 UTC; Path=/; HttpOnly; SameSite=Lax"
|
"redirectTo=; Expires=Thu, 01 Jan 1970 00:00:00 UTC; Path=/; HttpOnly; SameSite=Lax"
|
||||||
)
|
)
|
||||||
|
|
||||||
// try {
|
try {
|
||||||
// // Initiate the seamless login flow
|
// Initiate the seamless login flow
|
||||||
// let redirectUrlValue
|
let redirectUrlValue
|
||||||
// switch (context.params.lang) {
|
switch (context.params.lang) {
|
||||||
// case Lang.da:
|
case Lang.da:
|
||||||
// redirectUrlValue = env.SEAMLESS_LOGIN_DA
|
redirectUrlValue = env.SEAMLESS_LOGIN_DA
|
||||||
// break
|
break
|
||||||
// case Lang.de:
|
case Lang.de:
|
||||||
// redirectUrlValue = env.SEAMLESS_LOGIN_DE
|
redirectUrlValue = env.SEAMLESS_LOGIN_DE
|
||||||
// break
|
break
|
||||||
// case Lang.en:
|
case Lang.en:
|
||||||
// redirectUrlValue = env.SEAMLESS_LOGIN_EN
|
redirectUrlValue = env.SEAMLESS_LOGIN_EN
|
||||||
// break
|
break
|
||||||
// case Lang.fi:
|
case Lang.fi:
|
||||||
// redirectUrlValue = env.SEAMLESS_LOGIN_FI
|
redirectUrlValue = env.SEAMLESS_LOGIN_FI
|
||||||
// break
|
break
|
||||||
// case Lang.no:
|
case Lang.no:
|
||||||
// redirectUrlValue = env.SEAMLESS_LOGIN_NO
|
redirectUrlValue = env.SEAMLESS_LOGIN_NO
|
||||||
// break
|
break
|
||||||
// case Lang.sv:
|
case Lang.sv:
|
||||||
// redirectUrlValue = env.SEAMLESS_LOGIN_SV
|
redirectUrlValue = env.SEAMLESS_LOGIN_SV
|
||||||
// break
|
break
|
||||||
// }
|
}
|
||||||
// const redirectUrl = new URL(redirectUrlValue)
|
const redirectUrl = new URL(redirectUrlValue)
|
||||||
// redirectUrl.searchParams.set("returnurl", redirectTo)
|
redirectUrl.searchParams.set("returnurl", redirectTo)
|
||||||
// redirectTo = redirectUrl.toString()
|
redirectTo = redirectUrl.toString()
|
||||||
// } catch (e) {
|
} catch (e) {
|
||||||
// console.error(
|
console.error(
|
||||||
// "Unable to create URL for seamless login, proceeding without it."
|
"Unable to create URL for seamless login, proceeding without it."
|
||||||
// )
|
)
|
||||||
// console.error(e)
|
console.error(e)
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -8,20 +8,12 @@ import MaxWidth from "@/components/MaxWidth"
|
|||||||
|
|
||||||
import styles from "./page.module.css"
|
import styles from "./page.module.css"
|
||||||
|
|
||||||
import { LangParams, PageArgs, UriParams } from "@/types/params"
|
import { LangParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
export default async function AboutScandicFriends({
|
export default async function AboutScandicFriends({
|
||||||
params,
|
params,
|
||||||
searchParams,
|
}: PageArgs<LangParams>) {
|
||||||
}: PageArgs<LangParams, UriParams>) {
|
const loyaltyPage = await serverClient().contentstack.loyaltyPage.get()
|
||||||
if (!searchParams.uri) {
|
|
||||||
return notFound()
|
|
||||||
}
|
|
||||||
|
|
||||||
const loyaltyPage = await serverClient().contentstack.loyaltyPage.get({
|
|
||||||
href: searchParams.uri,
|
|
||||||
locale: params.lang,
|
|
||||||
})
|
|
||||||
return (
|
return (
|
||||||
<section className={styles.content}>
|
<section className={styles.content}>
|
||||||
{loyaltyPage.sidebar ? <Sidebar blocks={loyaltyPage.sidebar} /> : null}
|
{loyaltyPage.sidebar ? <Sidebar blocks={loyaltyPage.sidebar} /> : null}
|
||||||
|
|||||||
@@ -11,20 +11,10 @@ import Content from "@/components/MyPages/AccountPage/Webview/Content"
|
|||||||
|
|
||||||
import styles from "./page.module.css"
|
import styles from "./page.module.css"
|
||||||
|
|
||||||
import { LangParams, PageArgs, UriParams } from "@/types/params"
|
import { LangParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
export default async function MyPages({
|
export default async function MyPages({ params }: PageArgs<LangParams>) {
|
||||||
params,
|
const accountPage = await serverClient().contentstack.accountPage.get()
|
||||||
searchParams,
|
|
||||||
}: PageArgs<LangParams, UriParams>) {
|
|
||||||
if (!searchParams.uri) {
|
|
||||||
return notFound()
|
|
||||||
}
|
|
||||||
|
|
||||||
const accountPage = await serverClient().contentstack.accountPage.get({
|
|
||||||
url: searchParams.uri,
|
|
||||||
lang: params.lang,
|
|
||||||
})
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MaxWidth className={styles.blocks} tag="main">
|
<MaxWidth className={styles.blocks} tag="main">
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { Lang } from "@/constants/languages"
|
|
||||||
import { _ } from "@/lib/translation"
|
import { _ } from "@/lib/translation"
|
||||||
import { serverClient } from "@/lib/trpc/server"
|
import { serverClient } from "@/lib/trpc/server"
|
||||||
|
|
||||||
@@ -7,17 +6,8 @@ import BreadcrumbsWithLink from "./BreadcrumbWithLink"
|
|||||||
|
|
||||||
import styles from "./breadcrumbs.module.css"
|
import styles from "./breadcrumbs.module.css"
|
||||||
|
|
||||||
export default async function Breadcrumbs({
|
export default async function Breadcrumbs() {
|
||||||
href,
|
const breadcrumbs = await serverClient().contentstack.breadcrumbs.get()
|
||||||
locale,
|
|
||||||
}: {
|
|
||||||
href: string
|
|
||||||
locale: Lang
|
|
||||||
}) {
|
|
||||||
const breadcrumbs = await serverClient().contentstack.breadcrumbs.get({
|
|
||||||
href,
|
|
||||||
locale,
|
|
||||||
})
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav className={styles.breadcrumbs}>
|
<nav className={styles.breadcrumbs}>
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
.hamburger {
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 0.5rem;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.line {
|
|
||||||
background-color: var(--some-black-color, #1c1b1f);
|
|
||||||
border-radius: 0.8rem;
|
|
||||||
height: 0.2rem;
|
|
||||||
width: 2.5rem;
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import styles from "./hamburger.module.css"
|
|
||||||
|
|
||||||
export default function Hamburger() {
|
|
||||||
return (
|
|
||||||
<button className={styles.hamburger} type="button">
|
|
||||||
<div className={styles.line} />
|
|
||||||
<div className={styles.line} />
|
|
||||||
<div className={styles.line} />
|
|
||||||
</button>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
import Image from "@/components/Image"
|
|
||||||
|
|
||||||
import styles from "./language.module.css"
|
|
||||||
|
|
||||||
export default function LanguageSwitcher() {
|
|
||||||
return (
|
|
||||||
<div className={styles.switcher}>
|
|
||||||
<Image
|
|
||||||
alt="Swedish flag"
|
|
||||||
height={21}
|
|
||||||
src="/_static/icons/sweden.svg"
|
|
||||||
width={21}
|
|
||||||
/>
|
|
||||||
<span>SV / SEK</span>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
.switcher {
|
|
||||||
align-items: center;
|
|
||||||
display: none;
|
|
||||||
font-family: var(--ff-fira-sans);
|
|
||||||
font-size: 1.4rem;
|
|
||||||
font-weight: 400;
|
|
||||||
gap: 0.6rem;
|
|
||||||
line-height: 1.6rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 950px) {
|
|
||||||
.switcher {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
import Link from "next/link"
|
|
||||||
|
|
||||||
import { GetMyPagesLogo } from "@/lib/graphql/Query/Logo.graphql"
|
|
||||||
import { request } from "@/lib/graphql/request"
|
|
||||||
|
|
||||||
import Image from "@/components/Image"
|
|
||||||
|
|
||||||
import styles from "./logo.module.css"
|
|
||||||
|
|
||||||
import type { LangParams } from "@/types/params"
|
|
||||||
import type { LogoQueryData } from "@/types/requests/myPages/logo"
|
|
||||||
|
|
||||||
export default async function Logo({ lang }: LangParams) {
|
|
||||||
const { data } = await request<LogoQueryData>(GetMyPagesLogo, {
|
|
||||||
locale: lang,
|
|
||||||
})
|
|
||||||
if (
|
|
||||||
!data.all_header.items.length ||
|
|
||||||
!data.all_header.items?.[0].logoConnection.totalCount
|
|
||||||
) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
const logo = data.all_header.items[0].logoConnection.edges[0]
|
|
||||||
return (
|
|
||||||
<Link className={styles.link} href="#">
|
|
||||||
<Image
|
|
||||||
alt={logo.node.title}
|
|
||||||
height={logo.node.dimension.height}
|
|
||||||
src={logo.node.url}
|
|
||||||
width={logo.node.dimension.width}
|
|
||||||
/>
|
|
||||||
</Link>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
.link {
|
|
||||||
cursor: pointer;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import { serverClient } from "@/lib/trpc/server"
|
|
||||||
|
|
||||||
import styles from "./user.module.css"
|
|
||||||
|
|
||||||
export default async function User() {
|
|
||||||
const user = await serverClient().user.get()
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={styles.user}>
|
|
||||||
{user.firstName[0].toUpperCase()}
|
|
||||||
{user.lastName[0].toUpperCase()}
|
|
||||||
<span className={styles.alert}>1</span>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
.user {
|
|
||||||
align-items: center;
|
|
||||||
background-color: var(--some-black-color, #000);
|
|
||||||
border-radius: 50%;
|
|
||||||
color: var(--some-white-color, #fff);
|
|
||||||
display: flex;
|
|
||||||
font-family: var(--ff-fira-sans);
|
|
||||||
font-size: 1.2rem;
|
|
||||||
font-weight: 600;
|
|
||||||
height: 3.5rem;
|
|
||||||
justify-content: center;
|
|
||||||
position: relative;
|
|
||||||
width: 3.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.alert {
|
|
||||||
align-items: center;
|
|
||||||
background-color: var(--some-red-color, #ed2027);
|
|
||||||
border-radius: 50%;
|
|
||||||
display: flex;
|
|
||||||
font-size: 1rem;
|
|
||||||
height: 2rem;
|
|
||||||
justify-content: center;
|
|
||||||
position: absolute;
|
|
||||||
right: -1rem;
|
|
||||||
top: -0.5rem;
|
|
||||||
width: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 950px) {
|
|
||||||
.user {
|
|
||||||
height: 2.8rem;
|
|
||||||
width: 2.8rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.alert {
|
|
||||||
font-size: 0.6rem;
|
|
||||||
height: 1rem;
|
|
||||||
right: -0.2rem;
|
|
||||||
top: -0.1rem;
|
|
||||||
width: 1rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
.header {
|
|
||||||
align-items: center;
|
|
||||||
background-color: var(--some-white-color, #fff);
|
|
||||||
box-shadow: 0px 1.0006656646728516px 1.0006656646728516px 0px #0000000d;
|
|
||||||
display: grid;
|
|
||||||
gap: 3rem;
|
|
||||||
grid-template-columns: 1fr auto auto;
|
|
||||||
height: var(--header-height);
|
|
||||||
|
|
||||||
padding: 0 2rem;
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 999;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (min-width: 950px) {
|
|
||||||
.header {
|
|
||||||
background-color: var(--some-grey-color, #ececec);
|
|
||||||
border-bottom: 0.1rem solid var(--some-grey-color, #ccc);
|
|
||||||
box-shadow: none;
|
|
||||||
gap: 3.2rem;
|
|
||||||
grid-template-columns: 1fr 19rem auto auto;
|
|
||||||
padding: 0 2.4rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import Hamburger from "./Hamburger"
|
|
||||||
import LanguageSwitcher from "./LanguageSwitcher"
|
|
||||||
import Logo from "./Logo"
|
|
||||||
import User from "./User"
|
|
||||||
|
|
||||||
import styles from "./header.module.css"
|
|
||||||
|
|
||||||
import type { LangParams } from "@/types/params"
|
|
||||||
|
|
||||||
export default function Header({ lang }: LangParams) {
|
|
||||||
return (
|
|
||||||
<header className={styles.header}>
|
|
||||||
<Logo lang={lang} />
|
|
||||||
<LanguageSwitcher />
|
|
||||||
<User />
|
|
||||||
<Hamburger />
|
|
||||||
</header>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#import "../Fragments/Image.graphql"
|
|
||||||
|
|
||||||
query GetMyPagesLogo($locale: String!) {
|
|
||||||
all_header(limit: 1, locale: $locale) {
|
|
||||||
items {
|
|
||||||
logoConnection {
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
...Image
|
|
||||||
}
|
|
||||||
}
|
|
||||||
totalCount
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -42,7 +42,7 @@ export const middleware: NextMiddleware = async (request) => {
|
|||||||
|
|
||||||
return NextResponse.rewrite(
|
return NextResponse.rewrite(
|
||||||
new URL(
|
new URL(
|
||||||
`/${lang}/preview/${contentType}?${searchParams.toString()}`,
|
`/${lang}/preview/${contentType}/${uid}?${searchParams.toString()}`,
|
||||||
nextUrl
|
nextUrl
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
@@ -53,7 +53,6 @@ export const middleware: NextMiddleware = async (request) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
searchParams.set("uri", pathNameWithoutLang)
|
|
||||||
if (isCurrent) {
|
if (isCurrent) {
|
||||||
searchParams.set("uri", pathNameWithoutLang)
|
searchParams.set("uri", pathNameWithoutLang)
|
||||||
return NextResponse.rewrite(
|
return NextResponse.rewrite(
|
||||||
|
|||||||
@@ -46,40 +46,6 @@ const nextConfig = {
|
|||||||
|
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
redirects() {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
source: myPages.da,
|
|
||||||
destination: overview.da,
|
|
||||||
permanent: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: myPages.de,
|
|
||||||
destination: overview.de,
|
|
||||||
permanent: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: myPages.en,
|
|
||||||
destination: overview.en,
|
|
||||||
permanent: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: myPages.fi,
|
|
||||||
destination: overview.fi,
|
|
||||||
permanent: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: myPages.no,
|
|
||||||
destination: overview.no,
|
|
||||||
permanent: false,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
source: myPages.sv,
|
|
||||||
destination: overview.sv,
|
|
||||||
permanent: false,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
rewrites() {
|
rewrites() {
|
||||||
return {
|
return {
|
||||||
beforeFiles: [
|
beforeFiles: [
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
import { z } from "zod"
|
|
||||||
|
|
||||||
import { Lang } from "@/constants/languages"
|
|
||||||
|
|
||||||
export const getBreadcrumbsInput = z.object({
|
|
||||||
href: z.string().min(1, { message: "href is required" }),
|
|
||||||
locale: z.nativeEnum(Lang),
|
|
||||||
})
|
|
||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
} from "@/lib/graphql/Query/BreadcrumbsMyPages.graphql"
|
} from "@/lib/graphql/Query/BreadcrumbsMyPages.graphql"
|
||||||
import { request } from "@/lib/graphql/request"
|
import { request } from "@/lib/graphql/request"
|
||||||
import {
|
import {
|
||||||
|
badRequestError,
|
||||||
internalServerError,
|
internalServerError,
|
||||||
notFound,
|
notFound,
|
||||||
} from "@/server/errors/trpc"
|
} from "@/server/errors/trpc"
|
||||||
@@ -16,7 +17,6 @@ import {
|
|||||||
} from "@/utils/generateTag"
|
} from "@/utils/generateTag"
|
||||||
import { removeMultipleSlashes } from "@/utils/url"
|
import { removeMultipleSlashes } from "@/utils/url"
|
||||||
|
|
||||||
import { getBreadcrumbsInput } from "./input"
|
|
||||||
import {
|
import {
|
||||||
getBreadcrumbsSchema,
|
getBreadcrumbsSchema,
|
||||||
validateBreadcrumbsConstenstackSchema,
|
validateBreadcrumbsConstenstackSchema,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export type UIDParams = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type UriParams = {
|
export type UriParams = {
|
||||||
uri: string
|
uri: string | string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PreviewParams = {
|
export type PreviewParams = {
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
import type { Image } from "../../image"
|
|
||||||
import type { EdgesWithTotalCount } from "../utils/edges"
|
|
||||||
|
|
||||||
export type LogoQueryData = {
|
|
||||||
all_header: {
|
|
||||||
items: {
|
|
||||||
logoConnection: EdgesWithTotalCount<Image>
|
|
||||||
}[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user