From ec37ee0f1f379d4ee698c15f116f3f319fb27cf1 Mon Sep 17 00:00:00 2001 From: Arvid Norlin Date: Tue, 30 Apr 2024 16:20:33 +0200 Subject: [PATCH] feat: add stays to account page usage --- .../(protected)/my-pages/page.module.css | 1 + .../my-pages/stays/page.module.css | 17 ----------- .../(protected)/my-pages/stays/page.tsx | 28 ------------------- middlewares/authRequired.ts | 9 ++++-- 4 files changed, 8 insertions(+), 47 deletions(-) delete mode 100644 app/[lang]/(live)/(protected)/my-pages/stays/page.module.css delete mode 100644 app/[lang]/(live)/(protected)/my-pages/stays/page.tsx diff --git a/app/[lang]/(live)/(protected)/my-pages/page.module.css b/app/[lang]/(live)/(protected)/my-pages/page.module.css index 58bb298ff..f7c717942 100644 --- a/app/[lang]/(live)/(protected)/my-pages/page.module.css +++ b/app/[lang]/(live)/(protected)/my-pages/page.module.css @@ -1,6 +1,7 @@ .blocks { display: grid; gap: 4.2rem; + padding-top: 4rem; padding-left: 2rem; padding-right: 2rem; } diff --git a/app/[lang]/(live)/(protected)/my-pages/stays/page.module.css b/app/[lang]/(live)/(protected)/my-pages/stays/page.module.css deleted file mode 100644 index 85483cea5..000000000 --- a/app/[lang]/(live)/(protected)/my-pages/stays/page.module.css +++ /dev/null @@ -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; - } -} diff --git a/app/[lang]/(live)/(protected)/my-pages/stays/page.tsx b/app/[lang]/(live)/(protected)/my-pages/stays/page.tsx deleted file mode 100644 index 477630040..000000000 --- a/app/[lang]/(live)/(protected)/my-pages/stays/page.tsx +++ /dev/null @@ -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) { - return ( - - - - - ) -} diff --git a/middlewares/authRequired.ts b/middlewares/authRequired.ts index 0e7c98e3c..99debb1dc 100644 --- a/middlewares/authRequired.ts +++ b/middlewares/authRequired.ts @@ -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)