feat: add stays to account page usage

This commit is contained in:
Arvid Norlin
2024-04-30 16:20:33 +02:00
parent a81f641ccd
commit ec37ee0f1f
4 changed files with 8 additions and 47 deletions

View File

@@ -1,6 +1,7 @@
.blocks {
display: grid;
gap: 4.2rem;
padding-top: 4rem;
padding-left: 2rem;
padding-right: 2rem;
}

View File

@@ -1,17 +0,0 @@
.container {
display: flex;
flex-direction: column;
gap: 4.2rem;
padding-left: 2rem;
padding-right: 2rem;
margin-top: 2rem;
}
@media screen and (min-width: 950px) {
.container {
gap: 6rem;
padding-left: 0;
padding-right: 0;
margin: 0;
}
}

View File

@@ -1,28 +0,0 @@
import MaxWidth from "@/components/MaxWidth"
import PreviousStays from "@/components/MyPages/Blocks/Stays/Previous"
import UpcomingStays from "@/components/MyPages/Blocks/Stays/Upcoming"
import styles from "./page.module.css"
import { LangParams, PageArgs } from "@/types/params"
export default async function MyStays({ params }: PageArgs<LangParams>) {
return (
<MaxWidth className={styles.container} tag="main">
<UpcomingStays
lang={params.lang}
title={"Upcoming stays"}
subtitle={
"Excited about your next trip? So are we. Below are your upcoming stays with us, complete with all the details you need to make each visit perfect. Can't wait to welcome you back, friend!"
}
/>
<PreviousStays
lang={params.lang}
title={"Previous stays"}
subtitle={
"Revisit your stays and rekindle those our moments together, with ease."
}
/>
</MaxWidth>
)
}

View File

@@ -3,7 +3,7 @@ import { NextResponse } from "next/server"
import { findLang } from "@/constants/languages"
import { authRequired } from "@/constants/routes/authRequired"
import { login } from "@/constants/routes/handleAuth"
import { benefits, myPages, overview } from "@/constants/routes/myPages"
import { benefits, myPages, overview, stays } from "@/constants/routes/myPages"
import { auth } from "@/auth"
@@ -45,7 +45,12 @@ export const middleware = auth(async (request) => {
if (isLoggedIn) {
const pathNameWithoutLang = nextUrl.pathname.replace(`/${lang}`, "")
// Temp fix until we have a better solution for identifying AccountPage type
const accountPagePaths = [myPages[lang], overview[lang], benefits[lang]]
const accountPagePaths = [
myPages[lang],
overview[lang],
benefits[lang],
stays[lang],
]
if (accountPagePaths.includes(nextUrl.pathname)) {
const searchParams = new URLSearchParams(request.nextUrl.searchParams)