From 85cd81596894f8ef904d74dd70d282f233f87fc2 Mon Sep 17 00:00:00 2001 From: Christian Andolf Date: Tue, 25 Feb 2025 15:27:40 +0100 Subject: [PATCH] feat(SW-1273): find my booking page with rudimentary validation and redirect --- .../get-booking/page.module.css | 12 ++ .../hotelreservation/get-booking/page.tsx | 13 ++ .../Current/Header/MainMenu/index.tsx | 6 +- .../Header/MainMenu/MobileMenu/index.tsx | 5 +- .../components/Header/TopMenu/index.tsx | 5 +- apps/scandic-web/constants/myBooking.ts | 9 ++ apps/scandic-web/i18n/dictionaries/da.json | 5 + apps/scandic-web/i18n/dictionaries/de.json | 5 + apps/scandic-web/i18n/dictionaries/en.json | 5 + apps/scandic-web/i18n/dictionaries/fi.json | 5 + apps/scandic-web/i18n/dictionaries/no.json | 5 + apps/scandic-web/i18n/dictionaries/sv.json | 5 + apps/scandic-web/next.config.js | 27 +++- .../server/routers/booking/input.ts | 5 + .../server/routers/booking/query.ts | 17 ++- .../contentstack/languageSwitcher/query.ts | 13 ++ .../FindMyBooking/findMyBooking.module.css | 51 ++++++++ .../HotelReservation/FindMyBooking/index.tsx | 121 ++++++++++++++++++ .../HotelReservation/FindMyBooking/schema.ts | 15 +++ 19 files changed, 324 insertions(+), 5 deletions(-) create mode 100644 app/[lang]/(live)/(public)/hotelreservation/get-booking/page.module.css create mode 100644 app/[lang]/(live)/(public)/hotelreservation/get-booking/page.tsx create mode 100644 components/HotelReservation/FindMyBooking/findMyBooking.module.css create mode 100644 components/HotelReservation/FindMyBooking/index.tsx create mode 100644 components/HotelReservation/FindMyBooking/schema.ts diff --git a/app/[lang]/(live)/(public)/hotelreservation/get-booking/page.module.css b/app/[lang]/(live)/(public)/hotelreservation/get-booking/page.module.css new file mode 100644 index 000000000..509c07684 --- /dev/null +++ b/app/[lang]/(live)/(public)/hotelreservation/get-booking/page.module.css @@ -0,0 +1,12 @@ +.main { + width: var(--max-width-content); + padding: var(--Spacing-x5) var(--Spacing-x1); + margin-left: auto; + margin-right: auto; +} + +.form { + max-width: 640px; + margin-left: auto; + margin-right: auto; +} diff --git a/app/[lang]/(live)/(public)/hotelreservation/get-booking/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/get-booking/page.tsx new file mode 100644 index 000000000..66b865bbc --- /dev/null +++ b/app/[lang]/(live)/(public)/hotelreservation/get-booking/page.tsx @@ -0,0 +1,13 @@ +import FindMyBooking from "@/components/HotelReservation/FindMyBooking" + +import styles from "./page.module.css" + +export default async function GetBookingPage() { + return ( +
+
+ +
+
+ ) +} diff --git a/apps/scandic-web/components/Current/Header/MainMenu/index.tsx b/apps/scandic-web/components/Current/Header/MainMenu/index.tsx index 1c1c4aa8e..c10b76944 100644 --- a/apps/scandic-web/components/Current/Header/MainMenu/index.tsx +++ b/apps/scandic-web/components/Current/Header/MainMenu/index.tsx @@ -2,6 +2,7 @@ import { usePathname } from "next/navigation" import { useIntl } from "react-intl" +import { findMyBooking } from "@/constants/myBooking" import { logout } from "@/constants/routes/handleAuth" import { myPages } from "@/constants/routes/myPages" import useDropdownStore from "@/stores/main-menu" @@ -147,7 +148,10 @@ export function MainMenu({
  • - + {intl.formatMessage({ id: "Find booking" })}
  • diff --git a/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx b/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx index 83710974c..17872b396 100644 --- a/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx +++ b/apps/scandic-web/components/Header/MainMenu/MobileMenu/index.tsx @@ -5,10 +5,12 @@ import { Dialog, Modal } from "react-aria-components" import { useIntl } from "react-intl" import { useMediaQuery } from "usehooks-ts" +import { findMyBooking } from "@/constants/myBooking" import useDropdownStore from "@/stores/main-menu" import LanguageSwitcher from "@/components/LanguageSwitcher" import { useHandleKeyUp } from "@/hooks/useHandleKeyUp" +import useLang from "@/hooks/useLang" import HeaderLink from "../../HeaderLink" import TopLink from "../../TopLink" @@ -24,6 +26,7 @@ export default function MobileMenu({ topLink, isLoggedIn, }: React.PropsWithChildren) { + const lang = useLang() const intl = useIntl() const { toggleDropdown, @@ -83,7 +86,7 @@ export default function MobileMenu({ > {children}