Merge branch 'develop' into feat/sw-222-staycard-link
This commit is contained in:
4
.env
4
.env
@@ -1,4 +0,0 @@
|
|||||||
# See update-dotenv.mjs
|
|
||||||
AUTH_URL="REPLACE-ON-NETLIFY-BUILD"
|
|
||||||
NEXTAUTH_URL="REPLACE-ON-NETLIFY-BUILD"
|
|
||||||
PUBLIC_URL="REPLACED-ON-NETLIFY-BUILD"
|
|
||||||
@@ -42,3 +42,4 @@ GOOGLE_STATIC_MAP_SIGNATURE_SECRET="test"
|
|||||||
GOOGLE_STATIC_MAP_ID="test"
|
GOOGLE_STATIC_MAP_ID="test"
|
||||||
GOOGLE_DYNAMIC_MAP_ID="test"
|
GOOGLE_DYNAMIC_MAP_ID="test"
|
||||||
HIDE_FOR_NEXT_RELEASE="true"
|
HIDE_FOR_NEXT_RELEASE="true"
|
||||||
|
SALESFORCE_PREFERENCE_BASE_URL="test"
|
||||||
|
|||||||
67
actions/registerUserBookingFlow.ts
Normal file
67
actions/registerUserBookingFlow.ts
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
"use server"
|
||||||
|
|
||||||
|
import { parsePhoneNumber } from "libphonenumber-js"
|
||||||
|
import { z } from "zod"
|
||||||
|
|
||||||
|
import { serviceServerActionProcedure } from "@/server/trpc"
|
||||||
|
|
||||||
|
import { phoneValidator } from "@/utils/phoneValidator"
|
||||||
|
|
||||||
|
const registerUserPayload = z.object({
|
||||||
|
firstName: z.string(),
|
||||||
|
lastName: z.string(),
|
||||||
|
dateOfBirth: z.string(),
|
||||||
|
address: z.object({
|
||||||
|
countryCode: z.string(),
|
||||||
|
zipCode: z.string(),
|
||||||
|
}),
|
||||||
|
email: z.string(),
|
||||||
|
phoneNumber: phoneValidator("Phone is required"),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const registerUserBookingFlow = serviceServerActionProcedure
|
||||||
|
.input(registerUserPayload)
|
||||||
|
.mutation(async function ({ ctx, input }) {
|
||||||
|
const payload = {
|
||||||
|
...input,
|
||||||
|
language: ctx.lang,
|
||||||
|
phoneNumber: parsePhoneNumber(input.phoneNumber)
|
||||||
|
.formatNational()
|
||||||
|
.replace(/\s+/g, ""),
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Consume the API to register the user as soon as passwordless signup is enabled.
|
||||||
|
// let apiResponse
|
||||||
|
// try {
|
||||||
|
// apiResponse = await api.post(api.endpoints.v1.profile, {
|
||||||
|
// body: payload,
|
||||||
|
// headers: {
|
||||||
|
// Authorization: `Bearer ${ctx.serviceToken}`,
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error("Unexpected error", error)
|
||||||
|
// return { success: false, error: "Unexpected error" }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (!apiResponse.ok) {
|
||||||
|
// const text = await apiResponse.text()
|
||||||
|
// console.error(text)
|
||||||
|
// console.error(
|
||||||
|
// "registerUserBookingFlow api error",
|
||||||
|
// JSON.stringify({
|
||||||
|
// query: input,
|
||||||
|
// error: {
|
||||||
|
// status: apiResponse.status,
|
||||||
|
// statusText: apiResponse.statusText,
|
||||||
|
// error: text,
|
||||||
|
// },
|
||||||
|
// })
|
||||||
|
// )
|
||||||
|
// return { success: false, error: "API error" }
|
||||||
|
// }
|
||||||
|
// const json = await apiResponse.json()
|
||||||
|
// console.log("registerUserBookingFlow: json", json)
|
||||||
|
|
||||||
|
return { success: true, data: payload }
|
||||||
|
})
|
||||||
@@ -4,6 +4,7 @@ import { AuthError } from "next-auth"
|
|||||||
import { Lang } from "@/constants/languages"
|
import { Lang } from "@/constants/languages"
|
||||||
import { env } from "@/env/server"
|
import { env } from "@/env/server"
|
||||||
import { internalServerError } from "@/server/errors/next"
|
import { internalServerError } from "@/server/errors/next"
|
||||||
|
import { getPublicURL } from "@/server/utils"
|
||||||
|
|
||||||
import { signOut } from "@/auth"
|
import { signOut } from "@/auth"
|
||||||
|
|
||||||
@@ -11,6 +12,8 @@ export async function GET(
|
|||||||
request: NextRequest,
|
request: NextRequest,
|
||||||
context: { params: { lang: Lang } }
|
context: { params: { lang: Lang } }
|
||||||
) {
|
) {
|
||||||
|
const publicURL = getPublicURL(request)
|
||||||
|
|
||||||
let redirectTo: string = ""
|
let redirectTo: string = ""
|
||||||
|
|
||||||
const returnUrl = request.headers.get("x-returnurl")
|
const returnUrl = request.headers.get("x-returnurl")
|
||||||
@@ -39,7 +42,7 @@ export async function GET(
|
|||||||
// Make relative URL to absolute URL
|
// Make relative URL to absolute URL
|
||||||
if (redirectTo.startsWith("/")) {
|
if (redirectTo.startsWith("/")) {
|
||||||
console.log(`[logout] make redirectTo absolute, from ${redirectTo}`)
|
console.log(`[logout] make redirectTo absolute, from ${redirectTo}`)
|
||||||
redirectTo = new URL(redirectTo, env.PUBLIC_URL).href
|
redirectTo = new URL(redirectTo, publicURL).href
|
||||||
console.log(`[logout] make redirectTo absolute, to ${redirectTo}`)
|
console.log(`[logout] make redirectTo absolute, to ${redirectTo}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
.layout {
|
.layout {
|
||||||
background-color: var(--Base-Background-Primary-Normal);
|
|
||||||
display: grid;
|
display: grid;
|
||||||
font-family: var(--typography-Body-Regular-fontFamily);
|
font-family: var(--typography-Body-Regular-fontFamily);
|
||||||
gap: var(--Spacing-x3);
|
gap: var(--Spacing-x3);
|
||||||
@@ -9,6 +8,10 @@
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
background-color: var(--Base-Background-Primary-Normal);
|
||||||
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
display: grid;
|
display: grid;
|
||||||
padding-bottom: var(--Spacing-x9);
|
padding-bottom: var(--Spacing-x9);
|
||||||
|
|||||||
@@ -9,12 +9,14 @@ export default async function MyPagesLayout({
|
|||||||
breadcrumbs: React.ReactNode
|
breadcrumbs: React.ReactNode
|
||||||
}>) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<section className={styles.layout}>
|
<div className={styles.container}>
|
||||||
{breadcrumbs}
|
<section className={styles.layout}>
|
||||||
<section className={styles.content}>
|
{breadcrumbs}
|
||||||
<Sidebar />
|
<section className={styles.content}>
|
||||||
{children}
|
<Sidebar />
|
||||||
|
{children}
|
||||||
|
</section>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import { ArrowRightIcon } from "@/components/Icons"
|
|
||||||
import ManagePreferencesButton from "@/components/Profile/ManagePreferencesButton"
|
import ManagePreferencesButton from "@/components/Profile/ManagePreferencesButton"
|
||||||
import Link from "@/components/TempDesignSystem/Link"
|
|
||||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||||
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { env } from "@/env/server"
|
||||||
|
|
||||||
import Divider from "@/components/TempDesignSystem/Divider"
|
import Divider from "@/components/TempDesignSystem/Divider"
|
||||||
|
|
||||||
import type { ProfileLayoutProps } from "@/types/components/myPages/myProfile/layout"
|
import type { ProfileLayoutProps } from "@/types/components/myPages/myProfile/layout"
|
||||||
@@ -15,7 +17,7 @@ export default function ProfileLayout({
|
|||||||
{profile}
|
{profile}
|
||||||
<Divider color="burgundy" opacity={8} />
|
<Divider color="burgundy" opacity={8} />
|
||||||
{creditCards}
|
{creditCards}
|
||||||
{communication}
|
{env.HIDE_FOR_NEXT_RELEASE ? null : communication}
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
.layout {
|
.layout {
|
||||||
background-color: var(--Base-Background-Primary-Normal);
|
|
||||||
display: grid;
|
display: grid;
|
||||||
font-family: var(--typography-Body-Regular-fontFamily);
|
font-family: var(--typography-Body-Regular-fontFamily);
|
||||||
gap: var(--Spacing-x3);
|
gap: var(--Spacing-x3);
|
||||||
grid-template-rows: auto 1fr;
|
grid-template-rows: auto 1fr;
|
||||||
position: relative;
|
position: relative;
|
||||||
margin: 0 auto;
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
background-color: var(--Base-Background-Primary-Normal);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,11 @@ export default function ContentTypeLayout({
|
|||||||
}
|
}
|
||||||
>) {
|
>) {
|
||||||
return (
|
return (
|
||||||
<section className={styles.layout}>
|
<div className={styles.container}>
|
||||||
{breadcrumbs}
|
<section className={styles.layout}>
|
||||||
{children}
|
{breadcrumbs}
|
||||||
</section>
|
{children}
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,19 +2,22 @@ import { redirect } from "next/navigation"
|
|||||||
|
|
||||||
import { serverClient } from "@/lib/trpc/server"
|
import { serverClient } from "@/lib/trpc/server"
|
||||||
|
|
||||||
|
import EnterDetailsProvider from "@/components/HotelReservation/EnterDetails/Provider"
|
||||||
import SelectedRoom from "@/components/HotelReservation/EnterDetails/SelectedRoom"
|
import SelectedRoom from "@/components/HotelReservation/EnterDetails/SelectedRoom"
|
||||||
|
import SidePeek from "@/components/HotelReservation/EnterDetails/SidePeek"
|
||||||
import Summary from "@/components/HotelReservation/EnterDetails/Summary"
|
import Summary from "@/components/HotelReservation/EnterDetails/Summary"
|
||||||
import HotelSelectionHeader from "@/components/HotelReservation/HotelSelectionHeader"
|
import HotelSelectionHeader from "@/components/HotelReservation/HotelSelectionHeader"
|
||||||
import { setLang } from "@/i18n/serverContext"
|
import { setLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
import styles from "./layout.module.css"
|
import styles from "./layout.module.css"
|
||||||
|
|
||||||
|
import { StepEnum } from "@/types/components/enterDetails/step"
|
||||||
import type { LangParams, LayoutArgs } from "@/types/params"
|
import type { LangParams, LayoutArgs } from "@/types/params"
|
||||||
|
|
||||||
export default async function StepLayout({
|
export default async function StepLayout({
|
||||||
children,
|
children,
|
||||||
params,
|
params,
|
||||||
}: React.PropsWithChildren<LayoutArgs<LangParams>>) {
|
}: React.PropsWithChildren<LayoutArgs<LangParams & { step: StepEnum }>>) {
|
||||||
setLang(params.lang)
|
setLang(params.lang)
|
||||||
const hotel = await serverClient().hotel.hotelData.get({
|
const hotel = await serverClient().hotel.hotelData.get({
|
||||||
hotelId: "811",
|
hotelId: "811",
|
||||||
@@ -26,15 +29,18 @@ export default async function StepLayout({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className={styles.layout}>
|
<EnterDetailsProvider step={params.step}>
|
||||||
<HotelSelectionHeader hotel={hotel.data.attributes} />
|
<main className={styles.layout}>
|
||||||
<div className={styles.content}>
|
<HotelSelectionHeader hotel={hotel.data.attributes} />
|
||||||
<SelectedRoom />
|
<div className={styles.content}>
|
||||||
{children}
|
<SelectedRoom />
|
||||||
<aside className={styles.summary}>
|
{children}
|
||||||
<Summary />
|
<aside className={styles.summary}>
|
||||||
</aside>
|
<Summary />
|
||||||
</div>
|
</aside>
|
||||||
</main>
|
</div>
|
||||||
|
<SidePeek hotel={hotel.data.attributes} />
|
||||||
|
</main>
|
||||||
|
</EnterDetailsProvider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,117 +1,69 @@
|
|||||||
"use client"
|
|
||||||
|
|
||||||
import { notFound } from "next/navigation"
|
import { notFound } from "next/navigation"
|
||||||
import { useState } from "react"
|
|
||||||
import { useIntl } from "react-intl"
|
|
||||||
|
|
||||||
import { trpc } from "@/lib/trpc/client"
|
import { getProfileSafely } from "@/lib/trpc/memoizedRequests"
|
||||||
|
import { serverClient } from "@/lib/trpc/server"
|
||||||
|
|
||||||
import BedType from "@/components/HotelReservation/EnterDetails/BedType"
|
import BedType from "@/components/HotelReservation/EnterDetails/BedType"
|
||||||
import Breakfast from "@/components/HotelReservation/EnterDetails/Breakfast"
|
import Breakfast from "@/components/HotelReservation/EnterDetails/Breakfast"
|
||||||
import Details from "@/components/HotelReservation/EnterDetails/Details"
|
import Details from "@/components/HotelReservation/EnterDetails/Details"
|
||||||
|
import HistoryStateManager from "@/components/HotelReservation/EnterDetails/HistoryStateManager"
|
||||||
|
import SectionAccordion from "@/components/HotelReservation/EnterDetails/SectionAccordion"
|
||||||
import Payment from "@/components/HotelReservation/SelectRate/Payment"
|
import Payment from "@/components/HotelReservation/SelectRate/Payment"
|
||||||
import SectionAccordion from "@/components/HotelReservation/SelectRate/SectionAccordion"
|
import { getIntl } from "@/i18n"
|
||||||
import LoadingSpinner from "@/components/LoadingSpinner"
|
|
||||||
|
|
||||||
|
import { StepEnum } from "@/types/components/enterDetails/step"
|
||||||
import type { LangParams, PageArgs } from "@/types/params"
|
import type { LangParams, PageArgs } from "@/types/params"
|
||||||
|
|
||||||
enum StepEnum {
|
|
||||||
selectBed = "select-bed",
|
|
||||||
breakfast = "breakfast",
|
|
||||||
details = "details",
|
|
||||||
payment = "payment",
|
|
||||||
}
|
|
||||||
|
|
||||||
function isValidStep(step: string): step is StepEnum {
|
function isValidStep(step: string): step is StepEnum {
|
||||||
return Object.values(StepEnum).includes(step as StepEnum)
|
return Object.values(StepEnum).includes(step as StepEnum)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function StepPage({
|
export default async function StepPage({
|
||||||
params,
|
params,
|
||||||
}: PageArgs<LangParams & { step: StepEnum }>) {
|
}: PageArgs<LangParams & { step: StepEnum }>) {
|
||||||
const { step } = params
|
const { step, lang } = params
|
||||||
const [activeStep, setActiveStep] = useState<StepEnum>(step)
|
|
||||||
const intl = useIntl()
|
|
||||||
|
|
||||||
if (!isValidStep(activeStep)) {
|
const intl = await getIntl()
|
||||||
|
|
||||||
|
const hotel = await serverClient().hotel.hotelData.get({
|
||||||
|
hotelId: "811",
|
||||||
|
language: lang,
|
||||||
|
})
|
||||||
|
|
||||||
|
const user = await getProfileSafely()
|
||||||
|
|
||||||
|
if (!isValidStep(step) || !hotel) {
|
||||||
return notFound()
|
return notFound()
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data: hotel, isLoading: loadingHotel } =
|
|
||||||
trpc.hotel.hotelData.get.useQuery({
|
|
||||||
hotelId: "811",
|
|
||||||
language: params.lang,
|
|
||||||
})
|
|
||||||
|
|
||||||
const { data: userData } = trpc.user.getSafely.useQuery()
|
|
||||||
|
|
||||||
if (loadingHotel) {
|
|
||||||
return <LoadingSpinner />
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hotel) {
|
|
||||||
// TODO: handle case with hotel missing
|
|
||||||
return notFound()
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (activeStep) {
|
|
||||||
case StepEnum.breakfast:
|
|
||||||
//return <div>Select BREAKFAST</div>
|
|
||||||
case StepEnum.details:
|
|
||||||
//return <div>Select DETAILS</div>
|
|
||||||
case StepEnum.payment:
|
|
||||||
//return <div>Select PAYMENT</div>
|
|
||||||
case StepEnum.selectBed:
|
|
||||||
// return <div>Select BED</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
function onNav(step: StepEnum) {
|
|
||||||
setActiveStep(step)
|
|
||||||
if (typeof window !== "undefined") {
|
|
||||||
window.history.pushState({}, "", step)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let user = null
|
|
||||||
if (userData && !("error" in userData)) {
|
|
||||||
user = userData
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section>
|
<section>
|
||||||
|
<HistoryStateManager />
|
||||||
<SectionAccordion
|
<SectionAccordion
|
||||||
header="Select bed"
|
header="Select bed"
|
||||||
isCompleted={true}
|
step={StepEnum.selectBed}
|
||||||
isOpen={activeStep === StepEnum.selectBed}
|
|
||||||
label={intl.formatMessage({ id: "Request bedtype" })}
|
label={intl.formatMessage({ id: "Request bedtype" })}
|
||||||
path="/select-bed"
|
|
||||||
>
|
>
|
||||||
<BedType />
|
<BedType />
|
||||||
</SectionAccordion>
|
</SectionAccordion>
|
||||||
<SectionAccordion
|
<SectionAccordion
|
||||||
header="Food options"
|
header="Food options"
|
||||||
isCompleted={true}
|
step={StepEnum.breakfast}
|
||||||
isOpen={activeStep === StepEnum.breakfast}
|
|
||||||
label={intl.formatMessage({ id: "Select breakfast options" })}
|
label={intl.formatMessage({ id: "Select breakfast options" })}
|
||||||
path="/breakfast"
|
|
||||||
>
|
>
|
||||||
<Breakfast />
|
<Breakfast />
|
||||||
</SectionAccordion>
|
</SectionAccordion>
|
||||||
<SectionAccordion
|
<SectionAccordion
|
||||||
header="Details"
|
header="Details"
|
||||||
isCompleted={false}
|
step={StepEnum.details}
|
||||||
isOpen={activeStep === StepEnum.details}
|
|
||||||
label={intl.formatMessage({ id: "Enter your details" })}
|
label={intl.formatMessage({ id: "Enter your details" })}
|
||||||
path="/details"
|
|
||||||
>
|
>
|
||||||
<Details user={user} />
|
<Details user={user} />
|
||||||
</SectionAccordion>
|
</SectionAccordion>
|
||||||
<SectionAccordion
|
<SectionAccordion
|
||||||
header="Payment"
|
header="Payment"
|
||||||
isCompleted={false}
|
step={StepEnum.payment}
|
||||||
isOpen={activeStep === StepEnum.payment}
|
|
||||||
label={intl.formatMessage({ id: "Select payment method" })}
|
label={intl.formatMessage({ id: "Select payment method" })}
|
||||||
path="/hotelreservation/select-bed"
|
|
||||||
>
|
>
|
||||||
<Payment hotel={hotel.data.attributes} />
|
<Payment hotel={hotel.data.attributes} />
|
||||||
</SectionAccordion>
|
</SectionAccordion>
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
padding: var(--Spacing-x4);
|
padding: var(--Spacing-x4);
|
||||||
background-color: var(--Scandic-Brand-Warm-White);
|
background-color: var(--Scandic-Brand-Warm-White);
|
||||||
min-height: 100dvh;
|
min-height: 100dvh;
|
||||||
|
max-width: var(--max-width);
|
||||||
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section {
|
.section {
|
||||||
@@ -11,10 +13,4 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: var(--Spacing-x4);
|
gap: var(--Spacing-x4);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 365px;
|
|
||||||
}
|
|
||||||
@media screen and (min-width: 1367px) {
|
|
||||||
.section {
|
|
||||||
max-width: 525px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
.layout {
|
.layout {
|
||||||
min-height: 100dvh;
|
min-height: 100dvh;
|
||||||
max-width: var(--max-width);
|
|
||||||
margin: 0 auto;
|
|
||||||
background-color: var(--Base-Background-Primary-Normal);
|
background-color: var(--Base-Background-Primary-Normal);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
padding: var(--Spacing-x4) var(--Spacing-x4) 0 var(--Spacing-x4);
|
padding: var(--Spacing-x4) var(--Spacing-x4) 0 var(--Spacing-x4);
|
||||||
background-color: var(--Scandic-Brand-Warm-White);
|
background-color: var(--Scandic-Brand-Warm-White);
|
||||||
min-height: 100dvh;
|
min-height: 100dvh;
|
||||||
|
flex-direction: column;
|
||||||
|
max-width: var(--max-width);
|
||||||
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section {
|
.section {
|
||||||
@@ -15,3 +18,9 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
padding: var(--Spacing-x2) var(--Spacing-x0);
|
padding: var(--Spacing-x2) var(--Spacing-x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.main {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,13 +7,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
max-width: 1134px;
|
max-width: var(--max-width);
|
||||||
margin-top: var(--Spacing-x5);
|
margin: 0 auto;
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
flex-direction: column;
|
||||||
gap: var(--Spacing-x7);
|
gap: var(--Spacing-x7);
|
||||||
|
padding: var(--Spacing-x2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.main {
|
.main {
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
|
import { getProfileSafely } from "@/lib/trpc/memoizedRequests"
|
||||||
import { serverClient } from "@/lib/trpc/server"
|
import { serverClient } from "@/lib/trpc/server"
|
||||||
import tempHotelData from "@/server/routers/hotels/tempHotelData.json"
|
|
||||||
|
|
||||||
import RoomSelection from "@/components/HotelReservation/SelectRate/RoomSelection"
|
import RoomSelection from "@/components/HotelReservation/SelectRate/RoomSelection"
|
||||||
|
import getHotelReservationQueryParams from "@/components/HotelReservation/SelectRate/RoomSelection/utils"
|
||||||
import { setLang } from "@/i18n/serverContext"
|
import { setLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
import styles from "./page.module.css"
|
import styles from "./page.module.css"
|
||||||
@@ -15,27 +16,49 @@ export default async function SelectRatePage({
|
|||||||
}: PageArgs<LangParams & { section: string }, SelectRateSearchParams>) {
|
}: PageArgs<LangParams & { section: string }, SelectRateSearchParams>) {
|
||||||
setLang(params.lang)
|
setLang(params.lang)
|
||||||
|
|
||||||
// TODO: Use real endpoint.
|
const selecetRoomParams = new URLSearchParams(searchParams)
|
||||||
const hotel = tempHotelData.data.attributes
|
const selecetRoomParamsObject =
|
||||||
|
getHotelReservationQueryParams(selecetRoomParams)
|
||||||
|
const adults = selecetRoomParamsObject.room[0].adults // TODO: Handle multiple rooms
|
||||||
|
const children = selecetRoomParamsObject.room[0].child.length // TODO: Handle multiple rooms
|
||||||
|
|
||||||
|
const [hotelData, roomConfigurations, user] = await Promise.all([
|
||||||
|
serverClient().hotel.hotelData.get({
|
||||||
|
hotelId: searchParams.hotel,
|
||||||
|
language: params.lang,
|
||||||
|
include: ["RoomCategories"],
|
||||||
|
}),
|
||||||
|
serverClient().hotel.availability.rooms({
|
||||||
|
hotelId: parseInt(searchParams.hotel, 10),
|
||||||
|
roomStayStartDate: searchParams.fromDate,
|
||||||
|
roomStayEndDate: searchParams.toDate,
|
||||||
|
adults: adults,
|
||||||
|
children: children,
|
||||||
|
}),
|
||||||
|
getProfileSafely(),
|
||||||
|
])
|
||||||
|
|
||||||
const roomConfigurations = await serverClient().hotel.availability.rooms({
|
|
||||||
hotelId: parseInt(searchParams.hotel, 10),
|
|
||||||
roomStayStartDate: "2024-11-02",
|
|
||||||
roomStayEndDate: "2024-11-03",
|
|
||||||
adults: 1,
|
|
||||||
})
|
|
||||||
if (!roomConfigurations) {
|
if (!roomConfigurations) {
|
||||||
return "No rooms found"
|
return "No rooms found" // TODO: Add a proper error message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hotelData) {
|
||||||
|
return "No hotel data found" // TODO: Add a proper error message
|
||||||
|
}
|
||||||
|
|
||||||
|
const roomCategories = hotelData?.included
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{/* TODO: Add Hotel Listing Card */}
|
|
||||||
<div>Hotel Listing Card TBI</div>
|
|
||||||
|
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
|
{/* TODO: Add Hotel Listing Card */}
|
||||||
|
<div>Hotel Listing Card TBI</div>
|
||||||
<div className={styles.main}>
|
<div className={styles.main}>
|
||||||
<RoomSelection roomConfigurations={roomConfigurations} />
|
<RoomSelection
|
||||||
|
roomConfigurations={roomConfigurations}
|
||||||
|
roomCategories={roomCategories ?? []}
|
||||||
|
user={user}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { AuthError } from "next-auth"
|
|||||||
import { Lang } from "@/constants/languages"
|
import { Lang } from "@/constants/languages"
|
||||||
import { env } from "@/env/server"
|
import { env } from "@/env/server"
|
||||||
import { internalServerError } from "@/server/errors/next"
|
import { internalServerError } from "@/server/errors/next"
|
||||||
|
import { getPublicURL } from "@/server/utils"
|
||||||
|
|
||||||
import { signIn } from "@/auth"
|
import { signIn } from "@/auth"
|
||||||
|
|
||||||
@@ -11,9 +12,7 @@ export async function GET(
|
|||||||
request: NextRequest,
|
request: NextRequest,
|
||||||
context: { params: { lang: Lang } }
|
context: { params: { lang: Lang } }
|
||||||
) {
|
) {
|
||||||
if (!env.PUBLIC_URL) {
|
const publicURL = getPublicURL(request)
|
||||||
throw internalServerError("No value for env.PUBLIC_URL")
|
|
||||||
}
|
|
||||||
|
|
||||||
let redirectHeaders: Headers | undefined = undefined
|
let redirectHeaders: Headers | undefined = undefined
|
||||||
let redirectTo: string
|
let redirectTo: string
|
||||||
@@ -54,7 +53,7 @@ export async function GET(
|
|||||||
// Make relative URL to absolute URL
|
// Make relative URL to absolute URL
|
||||||
if (redirectTo.startsWith("/")) {
|
if (redirectTo.startsWith("/")) {
|
||||||
console.log(`[login] make redirectTo absolute, from ${redirectTo}`)
|
console.log(`[login] make redirectTo absolute, from ${redirectTo}`)
|
||||||
redirectTo = new URL(redirectTo, env.PUBLIC_URL).href
|
redirectTo = new URL(redirectTo, publicURL).href
|
||||||
console.log(`[login] make redirectTo absolute, to ${redirectTo}`)
|
console.log(`[login] make redirectTo absolute, to ${redirectTo}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,7 +130,7 @@ export async function GET(
|
|||||||
* because user might choose to do Email link login.
|
* because user might choose to do Email link login.
|
||||||
* */
|
* */
|
||||||
// The `for_origin` param is used to make Curity email login functionality working.
|
// The `for_origin` param is used to make Curity email login functionality working.
|
||||||
for_origin: env.PUBLIC_URL,
|
for_origin: publicURL,
|
||||||
// This is new param set for differentiate between the Magic link login of New web and current web
|
// This is new param set for differentiate between the Magic link login of New web and current web
|
||||||
version: "2",
|
version: "2",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { Lang } from "@/constants/languages"
|
|||||||
import { login } from "@/constants/routes/handleAuth"
|
import { login } from "@/constants/routes/handleAuth"
|
||||||
import { env } from "@/env/server"
|
import { env } from "@/env/server"
|
||||||
import { badRequest, internalServerError } from "@/server/errors/next"
|
import { badRequest, internalServerError } from "@/server/errors/next"
|
||||||
|
import { getPublicURL } from "@/server/utils"
|
||||||
|
|
||||||
import { signIn } from "@/auth"
|
import { signIn } from "@/auth"
|
||||||
|
|
||||||
@@ -12,9 +13,7 @@ export async function GET(
|
|||||||
request: NextRequest,
|
request: NextRequest,
|
||||||
context: { params: { lang: Lang } }
|
context: { params: { lang: Lang } }
|
||||||
) {
|
) {
|
||||||
if (!env.PUBLIC_URL) {
|
const publicURL = getPublicURL(request)
|
||||||
throw internalServerError("No value for env.PUBLIC_URL")
|
|
||||||
}
|
|
||||||
|
|
||||||
const loginKey = request.nextUrl.searchParams.get("loginKey")
|
const loginKey = request.nextUrl.searchParams.get("loginKey")
|
||||||
if (!loginKey) {
|
if (!loginKey) {
|
||||||
@@ -44,7 +43,7 @@ export async function GET(
|
|||||||
console.log(
|
console.log(
|
||||||
`[verifymagiclink] make redirectTo absolute, from ${redirectTo}`
|
`[verifymagiclink] make redirectTo absolute, from ${redirectTo}`
|
||||||
)
|
)
|
||||||
redirectTo = new URL(redirectTo, env.PUBLIC_URL).href
|
redirectTo = new URL(redirectTo, publicURL).href
|
||||||
console.log(`[verifymagiclink] make redirectTo absolute, to ${redirectTo}`)
|
console.log(`[verifymagiclink] make redirectTo absolute, to ${redirectTo}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +68,7 @@ export async function GET(
|
|||||||
ui_locales: context.params.lang,
|
ui_locales: context.params.lang,
|
||||||
scope: ["openid", "profile"].join(" "),
|
scope: ["openid", "profile"].join(" "),
|
||||||
loginKey: loginKey,
|
loginKey: loginKey,
|
||||||
for_origin: env.PUBLIC_URL,
|
for_origin: publicURL,
|
||||||
acr_values: "abc",
|
acr_values: "abc",
|
||||||
version: "2",
|
version: "2",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,14 +4,17 @@ import { env } from "process"
|
|||||||
import { Lang } from "@/constants/languages"
|
import { Lang } from "@/constants/languages"
|
||||||
import { profile } from "@/constants/routes/myPages"
|
import { profile } from "@/constants/routes/myPages"
|
||||||
import { serverClient } from "@/lib/trpc/server"
|
import { serverClient } from "@/lib/trpc/server"
|
||||||
|
import { getPublicURL } from "@/server/utils"
|
||||||
|
|
||||||
export async function GET(
|
export async function GET(
|
||||||
request: NextRequest,
|
request: NextRequest,
|
||||||
{ params }: { params: { lang: string } }
|
{ params }: { params: { lang: string } }
|
||||||
) {
|
) {
|
||||||
|
const publicURL = getPublicURL(request)
|
||||||
|
|
||||||
console.log(`[add-card] callback started`)
|
console.log(`[add-card] callback started`)
|
||||||
const lang = params.lang as Lang
|
const lang = params.lang as Lang
|
||||||
const returnUrl = new URL(`${env.PUBLIC_URL}/${profile[lang ?? Lang.en]}`)
|
const returnUrl = new URL(`${publicURL}/${profile[lang ?? Lang.en]}`)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const searchParams = request.nextUrl.searchParams
|
const searchParams = request.nextUrl.searchParams
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
import { NextResponse } from "next/server"
|
|
||||||
|
|
||||||
import { env } from "@/env/server"
|
|
||||||
|
|
||||||
import type { NextRequest } from "next/server"
|
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
const e = process.env
|
|
||||||
console.log({ process_env: process.env })
|
|
||||||
|
|
||||||
const urlVar = "PUBLIC_URL"
|
|
||||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
|
||||||
const nextAuthUrlVar2 = "AUTH_URL"
|
|
||||||
const envTestVar = "ENVTEST"
|
|
||||||
|
|
||||||
const values = {
|
|
||||||
env_url: env.PUBLIC_URL,
|
|
||||||
static_url: process.env.PUBLIC_URL,
|
|
||||||
dynamic_url: e[urlVar],
|
|
||||||
env_envtest: env.ENVTEST,
|
|
||||||
static_envtest: process.env.ENVTEST,
|
|
||||||
dynamic_envtest: e[envTestVar],
|
|
||||||
env_nextauth: env.NEXTAUTH_URL,
|
|
||||||
static_nextauth: process.env.NEXTAUTH_URL,
|
|
||||||
dynamic_nextauth: e[nextAuthUrlVar],
|
|
||||||
env_nextauth2: env.AUTH_URL,
|
|
||||||
static_nextauth2: process.env.AUTH_URL,
|
|
||||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(values)
|
|
||||||
|
|
||||||
return NextResponse.json(values)
|
|
||||||
}
|
|
||||||
|
|
||||||
export const dynamic = "force-dynamic"
|
|
||||||
|
|
||||||
export const runtime = "edge"
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
import { config } from "dotenv"
|
|
||||||
import { NextResponse } from "next/server"
|
|
||||||
|
|
||||||
import { env } from "@/env/server"
|
|
||||||
|
|
||||||
import type { NextRequest } from "next/server"
|
|
||||||
|
|
||||||
config({ path: "./.env" })
|
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
const e = process.env
|
|
||||||
console.log({ process_env: process.env })
|
|
||||||
|
|
||||||
const urlVar = "PUBLIC_URL"
|
|
||||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
|
||||||
const nextAuthUrlVar2 = "AUTH_URL"
|
|
||||||
const envTestVar = "ENVTEST"
|
|
||||||
|
|
||||||
const values = {
|
|
||||||
env_url: env.PUBLIC_URL,
|
|
||||||
static_url: process.env.PUBLIC_URL,
|
|
||||||
dynamic_url: e[urlVar],
|
|
||||||
env_envtest: env.ENVTEST,
|
|
||||||
static_envtest: process.env.ENVTEST,
|
|
||||||
dynamic_envtest: e[envTestVar],
|
|
||||||
env_nextauth: env.NEXTAUTH_URL,
|
|
||||||
static_nextauth: process.env.NEXTAUTH_URL,
|
|
||||||
dynamic_nextauth: e[nextAuthUrlVar],
|
|
||||||
env_nextauth2: env.AUTH_URL,
|
|
||||||
static_nextauth2: process.env.AUTH_URL,
|
|
||||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(values)
|
|
||||||
|
|
||||||
return NextResponse.json(values)
|
|
||||||
}
|
|
||||||
|
|
||||||
export const dynamic = "force-dynamic"
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
import "dotenv/config"
|
|
||||||
|
|
||||||
import { NextResponse } from "next/server"
|
|
||||||
|
|
||||||
import { env } from "@/env/server"
|
|
||||||
|
|
||||||
import type { NextRequest } from "next/server"
|
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
const e = process.env
|
|
||||||
console.log({ process_env: process.env })
|
|
||||||
|
|
||||||
const urlVar = "PUBLC_URL"
|
|
||||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
|
||||||
const nextAuthUrlVar2 = "AUTH_URL"
|
|
||||||
const envTestVar = "ENVTEST"
|
|
||||||
|
|
||||||
const values = {
|
|
||||||
env_url: env.PUBLIC_URL,
|
|
||||||
static_url: process.env.PUBLIC_URL,
|
|
||||||
dynamic_url: e[urlVar],
|
|
||||||
env_envtest: env.ENVTEST,
|
|
||||||
static_envtest: process.env.ENVTEST,
|
|
||||||
dynamic_envtest: e[envTestVar],
|
|
||||||
env_nextauth: env.NEXTAUTH_URL,
|
|
||||||
static_nextauth: process.env.NEXTAUTH_URL,
|
|
||||||
dynamic_nextauth: e[nextAuthUrlVar],
|
|
||||||
env_nextauth2: env.AUTH_URL,
|
|
||||||
static_nextauth2: process.env.AUTH_URL,
|
|
||||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(values)
|
|
||||||
|
|
||||||
return NextResponse.json(values)
|
|
||||||
}
|
|
||||||
|
|
||||||
export const dynamic = "force-dynamic"
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
import { config } from "dotenv"
|
|
||||||
import { NextResponse } from "next/server"
|
|
||||||
|
|
||||||
import { env } from "@/env/server"
|
|
||||||
|
|
||||||
import type { NextRequest } from "next/server"
|
|
||||||
|
|
||||||
config({ debug: true, override: true })
|
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
const e = process.env
|
|
||||||
console.log({ process_env: process.env })
|
|
||||||
|
|
||||||
const urlVar = "PUBLC_URL"
|
|
||||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
|
||||||
const nextAuthUrlVar2 = "AUTH_URL"
|
|
||||||
const envTestVar = "ENVTEST"
|
|
||||||
|
|
||||||
const values = {
|
|
||||||
env_url: env.PUBLIC_URL,
|
|
||||||
static_url: process.env.PUBLIC_URL,
|
|
||||||
dynamic_url: e[urlVar],
|
|
||||||
env_envtest: env.ENVTEST,
|
|
||||||
static_envtest: process.env.ENVTEST,
|
|
||||||
dynamic_envtest: e[envTestVar],
|
|
||||||
env_nextauth: env.NEXTAUTH_URL,
|
|
||||||
static_nextauth: process.env.NEXTAUTH_URL,
|
|
||||||
dynamic_nextauth: e[nextAuthUrlVar],
|
|
||||||
env_nextauth2: env.AUTH_URL,
|
|
||||||
static_nextauth2: process.env.AUTH_URL,
|
|
||||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(values)
|
|
||||||
|
|
||||||
return NextResponse.json(values)
|
|
||||||
}
|
|
||||||
|
|
||||||
export const dynamic = "force-dynamic"
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
import { NextResponse } from "next/server"
|
|
||||||
|
|
||||||
import { env } from "@/env/server"
|
|
||||||
|
|
||||||
import type { NextRequest } from "next/server"
|
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
const e = process.env
|
|
||||||
console.log({ process_env: process.env })
|
|
||||||
|
|
||||||
const urlVar = "PUBLIC_URL"
|
|
||||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
|
||||||
const nextAuthUrlVar2 = "AUTH_URL"
|
|
||||||
const envTestVar = "ENVTEST"
|
|
||||||
|
|
||||||
const values = {
|
|
||||||
env_url: env.PUBLIC_URL,
|
|
||||||
static_url: process.env.PUBLIC_URL,
|
|
||||||
dynamic_url: e[urlVar],
|
|
||||||
env_envtest: env.ENVTEST,
|
|
||||||
static_envtest: process.env.ENVTEST,
|
|
||||||
dynamic_envtest: e[envTestVar],
|
|
||||||
env_nextauth: env.NEXTAUTH_URL,
|
|
||||||
static_nextauth: process.env.NEXTAUTH_URL,
|
|
||||||
dynamic_nextauth: e[nextAuthUrlVar],
|
|
||||||
env_nextauth2: env.AUTH_URL,
|
|
||||||
static_nextauth2: process.env.AUTH_URL,
|
|
||||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(values)
|
|
||||||
|
|
||||||
return NextResponse.json(values)
|
|
||||||
}
|
|
||||||
|
|
||||||
export const dynamic = "force-dynamic"
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
import { config } from "dotenv"
|
|
||||||
import { NextResponse } from "next/server"
|
|
||||||
|
|
||||||
import { env } from "@/env/server"
|
|
||||||
|
|
||||||
import type { NextRequest } from "next/server"
|
|
||||||
|
|
||||||
config({ path: "./.env" })
|
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
const e = process.env
|
|
||||||
console.log({ process_env: process.env })
|
|
||||||
|
|
||||||
const urlVar = "PUBLIC_URL"
|
|
||||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
|
||||||
const nextAuthUrlVar2 = "AUTH_URL"
|
|
||||||
const envTestVar = "ENVTEST"
|
|
||||||
|
|
||||||
const values = {
|
|
||||||
env_url: env.PUBLIC_URL,
|
|
||||||
static_url: process.env.PUBLIC_URL,
|
|
||||||
dynamic_url: e[urlVar],
|
|
||||||
env_envtest: env.ENVTEST,
|
|
||||||
static_envtest: process.env.ENVTEST,
|
|
||||||
dynamic_envtest: e[envTestVar],
|
|
||||||
env_nextauth: env.NEXTAUTH_URL,
|
|
||||||
static_nextauth: process.env.NEXTAUTH_URL,
|
|
||||||
dynamic_nextauth: e[nextAuthUrlVar],
|
|
||||||
env_nextauth2: env.AUTH_URL,
|
|
||||||
static_nextauth2: process.env.AUTH_URL,
|
|
||||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(values)
|
|
||||||
|
|
||||||
return NextResponse.json(values)
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
import "dotenv/config"
|
|
||||||
|
|
||||||
import { NextResponse } from "next/server"
|
|
||||||
|
|
||||||
import { env } from "@/env/server"
|
|
||||||
|
|
||||||
import type { NextRequest } from "next/server"
|
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
const e = process.env
|
|
||||||
console.log({ process_env: process.env })
|
|
||||||
|
|
||||||
const urlVar = "PUBLIC_URL"
|
|
||||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
|
||||||
const nextAuthUrlVar2 = "AUTH_URL"
|
|
||||||
const envTestVar = "ENVTEST"
|
|
||||||
|
|
||||||
const values = {
|
|
||||||
env_url: env.PUBLIC_URL,
|
|
||||||
static_url: process.env.PUBLIC_URL,
|
|
||||||
dynamic_url: e[urlVar],
|
|
||||||
env_envtest: env.ENVTEST,
|
|
||||||
static_envtest: process.env.ENVTEST,
|
|
||||||
dynamic_envtest: e[envTestVar],
|
|
||||||
env_nextauth: env.NEXTAUTH_URL,
|
|
||||||
static_nextauth: process.env.NEXTAUTH_URL,
|
|
||||||
dynamic_nextauth: e[nextAuthUrlVar],
|
|
||||||
env_nextauth2: env.AUTH_URL,
|
|
||||||
static_nextauth2: process.env.AUTH_URL,
|
|
||||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(values)
|
|
||||||
|
|
||||||
return NextResponse.json(values)
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
import { config } from "dotenv"
|
|
||||||
import { NextResponse } from "next/server"
|
|
||||||
|
|
||||||
import { env } from "@/env/server"
|
|
||||||
|
|
||||||
import type { NextRequest } from "next/server"
|
|
||||||
|
|
||||||
config({ debug: true, override: true })
|
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
const e = process.env
|
|
||||||
console.log({ process_env: process.env })
|
|
||||||
|
|
||||||
const urlVar = "PUBLIC_URL"
|
|
||||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
|
||||||
const nextAuthUrlVar2 = "AUTH_URL"
|
|
||||||
const envTestVar = "ENVTEST"
|
|
||||||
|
|
||||||
const values = {
|
|
||||||
env_url: env.PUBLIC_URL,
|
|
||||||
static_url: process.env.PUBLIC_URL,
|
|
||||||
dynamic_url: e[urlVar],
|
|
||||||
env_envtest: env.ENVTEST,
|
|
||||||
static_envtest: process.env.ENVTEST,
|
|
||||||
dynamic_envtest: e[envTestVar],
|
|
||||||
env_nextauth: env.NEXTAUTH_URL,
|
|
||||||
static_nextauth: process.env.NEXTAUTH_URL,
|
|
||||||
dynamic_nextauth: e[nextAuthUrlVar],
|
|
||||||
env_nextauth2: env.AUTH_URL,
|
|
||||||
static_nextauth2: process.env.AUTH_URL,
|
|
||||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(values)
|
|
||||||
|
|
||||||
return NextResponse.json(values)
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
import { NextResponse } from "next/server"
|
|
||||||
|
|
||||||
import { env } from "@/env/server"
|
|
||||||
|
|
||||||
import type { NextRequest } from "next/server"
|
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
const e = process.env
|
|
||||||
console.log({ process_env: process.env })
|
|
||||||
|
|
||||||
const urlVar = "PUBLIC_URL"
|
|
||||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
|
||||||
const nextAuthUrlVar2 = "AUTH_URL"
|
|
||||||
const envTestVar = "ENVTEST"
|
|
||||||
|
|
||||||
const values = {
|
|
||||||
env_url: env.PUBLIC_URL,
|
|
||||||
static_url: process.env.PUBLIC_URL,
|
|
||||||
dynamic_url: e[urlVar],
|
|
||||||
env_envtest: env.ENVTEST,
|
|
||||||
static_envtest: process.env.ENVTEST,
|
|
||||||
dynamic_envtest: e[envTestVar],
|
|
||||||
env_nextauth: env.NEXTAUTH_URL,
|
|
||||||
static_nextauth: process.env.NEXTAUTH_URL,
|
|
||||||
dynamic_nextauth: e[nextAuthUrlVar],
|
|
||||||
env_nextauth2: env.AUTH_URL,
|
|
||||||
static_nextauth2: process.env.AUTH_URL,
|
|
||||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(values)
|
|
||||||
|
|
||||||
return NextResponse.json(values)
|
|
||||||
}
|
|
||||||
@@ -6,20 +6,21 @@ import {
|
|||||||
bookingConfirmation,
|
bookingConfirmation,
|
||||||
payment,
|
payment,
|
||||||
} from "@/constants/routes/hotelReservation"
|
} from "@/constants/routes/hotelReservation"
|
||||||
|
import { getPublicURL } from "@/server/utils"
|
||||||
|
|
||||||
export async function GET(
|
export async function GET(
|
||||||
request: NextRequest,
|
request: NextRequest,
|
||||||
{ params }: { params: { lang: string; status: string } }
|
{ params }: { params: { lang: string; status: string } }
|
||||||
): Promise<NextResponse> {
|
): Promise<NextResponse> {
|
||||||
|
const publicURL = getPublicURL(request)
|
||||||
|
|
||||||
console.log(`[payment-callback] callback started`)
|
console.log(`[payment-callback] callback started`)
|
||||||
const lang = params.lang as Lang
|
const lang = params.lang as Lang
|
||||||
const status = params.status
|
const status = params.status
|
||||||
const returnUrl = new URL(`${env.PUBLIC_URL}/${payment[lang]}`)
|
const returnUrl = new URL(`${publicURL}/${payment[lang]}`)
|
||||||
|
|
||||||
if (status === "success") {
|
if (status === "success") {
|
||||||
const confirmationUrl = new URL(
|
const confirmationUrl = new URL(`${publicURL}/${bookingConfirmation[lang]}`)
|
||||||
`${env.PUBLIC_URL}/${bookingConfirmation[lang]}`
|
|
||||||
)
|
|
||||||
console.log(`[payment-callback] redirecting to: ${confirmationUrl}`)
|
console.log(`[payment-callback] redirecting to: ${confirmationUrl}`)
|
||||||
return NextResponse.redirect(confirmationUrl)
|
return NextResponse.redirect(confirmationUrl)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,13 +107,15 @@
|
|||||||
|
|
||||||
--main-menu-mobile-height: 75px;
|
--main-menu-mobile-height: 75px;
|
||||||
--main-menu-desktop-height: 118px;
|
--main-menu-desktop-height: 118px;
|
||||||
--booking-widget-desktop-height: 95px;
|
--booking-widget-mobile-height: 75px;
|
||||||
|
--booking-widget-desktop-height: 77px;
|
||||||
--hotel-page-map-desktop-width: 23.75rem;
|
--hotel-page-map-desktop-width: 23.75rem;
|
||||||
|
|
||||||
/* Z-INDEX */
|
/* Z-INDEX */
|
||||||
--header-z-index: 10;
|
--header-z-index: 10;
|
||||||
--menu-overlay-z-index: 10;
|
--menu-overlay-z-index: 10;
|
||||||
--dialog-z-index: 9;
|
--dialog-z-index: 9;
|
||||||
|
--sidepeek-z-index: 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
|
|||||||
3
auth.ts
3
auth.ts
@@ -109,6 +109,7 @@ const curityProvider = {
|
|||||||
} satisfies OIDCConfig<User>
|
} satisfies OIDCConfig<User>
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
|
basePath: "/api/web/auth",
|
||||||
debug: env.NEXTAUTH_DEBUG,
|
debug: env.NEXTAUTH_DEBUG,
|
||||||
providers: [curityProvider],
|
providers: [curityProvider],
|
||||||
redirectProxyUrl: env.NEXTAUTH_REDIRECT_PROXY_URL,
|
redirectProxyUrl: env.NEXTAUTH_REDIRECT_PROXY_URL,
|
||||||
@@ -233,4 +234,4 @@ export const {
|
|||||||
auth,
|
auth,
|
||||||
signIn,
|
signIn,
|
||||||
signOut,
|
signOut,
|
||||||
} = NextAuth(config)
|
} = NextAuth(config)
|
||||||
|
|||||||
7
components/Blocks/Accordion/accordion.module.css
Normal file
7
components/Blocks/Accordion/accordion.module.css
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
.accordion:not(.allVisible) :nth-child(n + 6) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion:not(.allVisible) :nth-child(5) {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
53
components/Blocks/Accordion/index.tsx
Normal file
53
components/Blocks/Accordion/index.tsx
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
"use client"
|
||||||
|
import { useState } from "react"
|
||||||
|
|
||||||
|
import JsonToHtml from "@/components/JsonToHtml"
|
||||||
|
import SectionContainer from "@/components/Section/Container"
|
||||||
|
import SectionHeader from "@/components/Section/Header"
|
||||||
|
import Accordion from "@/components/TempDesignSystem/Accordion"
|
||||||
|
import AccordionItem from "@/components/TempDesignSystem/Accordion/AccordionItem"
|
||||||
|
import ShowMoreButton from "@/components/TempDesignSystem/ShowMoreButton"
|
||||||
|
|
||||||
|
import styles from "./accordion.module.css"
|
||||||
|
|
||||||
|
import type { AccordionProps } from "@/types/components/blocks/Accordion"
|
||||||
|
import { HotelHashValues } from "@/types/components/hotelPage/tabNavigation"
|
||||||
|
|
||||||
|
export default function AccordionSection({ accordion, title }: AccordionProps) {
|
||||||
|
const showToggleButton = accordion.length > 5
|
||||||
|
const [allAccordionsVisible, setAllAccordionsVisible] =
|
||||||
|
useState(!showToggleButton)
|
||||||
|
|
||||||
|
function toggleAccordions() {
|
||||||
|
setAllAccordionsVisible((state) => !state)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SectionContainer id={HotelHashValues.faq}>
|
||||||
|
{title && <SectionHeader textTransform="uppercase" title={title} />}
|
||||||
|
<Accordion
|
||||||
|
className={`${styles.accordion} ${allAccordionsVisible ? styles.allVisible : ""}`}
|
||||||
|
theme="light"
|
||||||
|
variant="card"
|
||||||
|
>
|
||||||
|
{accordion.map((acc) => (
|
||||||
|
<AccordionItem key={acc.question} title={acc.question}>
|
||||||
|
<JsonToHtml
|
||||||
|
embeds={acc.answer.embedded_itemsConnection.edges}
|
||||||
|
nodes={acc.answer.json?.children[0].children}
|
||||||
|
/>
|
||||||
|
</AccordionItem>
|
||||||
|
))}
|
||||||
|
</Accordion>
|
||||||
|
|
||||||
|
{showToggleButton ? (
|
||||||
|
<ShowMoreButton
|
||||||
|
loadMoreData={toggleAccordions}
|
||||||
|
showLess={allAccordionsVisible}
|
||||||
|
textShowMore="See all FAQ"
|
||||||
|
textShowLess="See less FAQ"
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</SectionContainer>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -6,12 +6,29 @@ import LoyaltyCard from "@/components/TempDesignSystem/LoyaltyCard"
|
|||||||
import TeaserCard from "@/components/TempDesignSystem/TeaserCard"
|
import TeaserCard from "@/components/TempDesignSystem/TeaserCard"
|
||||||
|
|
||||||
import type { CardsGridProps } from "@/types/components/blocks/cardsGrid"
|
import type { CardsGridProps } from "@/types/components/blocks/cardsGrid"
|
||||||
import { CardsGridEnum } from "@/types/enums/cardsGrid"
|
import { CardsGridEnum, CardsGridLayoutEnum } from "@/types/enums/cardsGrid"
|
||||||
|
import type { StackableGridProps } from "../TempDesignSystem/Grids/Stackable/stackable"
|
||||||
|
|
||||||
export default function CardsGrid({
|
export default function CardsGrid({
|
||||||
cards_grid,
|
cards_grid,
|
||||||
firstItem = false,
|
firstItem = false,
|
||||||
}: CardsGridProps) {
|
}: CardsGridProps) {
|
||||||
|
let columns: StackableGridProps["columns"]
|
||||||
|
|
||||||
|
switch (cards_grid.layout) {
|
||||||
|
case CardsGridLayoutEnum.ONE_COLUMN:
|
||||||
|
columns = 1
|
||||||
|
break
|
||||||
|
case CardsGridLayoutEnum.TWO_COLUMNS:
|
||||||
|
columns = 2
|
||||||
|
break
|
||||||
|
case CardsGridLayoutEnum.THREE_COLUMNS:
|
||||||
|
columns = 3
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
columns = 3
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SectionContainer>
|
<SectionContainer>
|
||||||
<SectionHeader
|
<SectionHeader
|
||||||
@@ -19,7 +36,7 @@ export default function CardsGrid({
|
|||||||
preamble={cards_grid.preamble}
|
preamble={cards_grid.preamble}
|
||||||
topTitle={firstItem}
|
topTitle={firstItem}
|
||||||
/>
|
/>
|
||||||
<Grids.Stackable>
|
<Grids.Stackable columns={columns}>
|
||||||
{cards_grid.cards.map((card) => {
|
{cards_grid.cards.map((card) => {
|
||||||
switch (card.__typename) {
|
switch (card.__typename) {
|
||||||
case CardsGridEnum.cards.Card:
|
case CardsGridEnum.cards.Card:
|
||||||
@@ -43,6 +60,7 @@ export default function CardsGrid({
|
|||||||
primaryButton={card.primaryButton}
|
primaryButton={card.primaryButton}
|
||||||
secondaryButton={card.secondaryButton}
|
secondaryButton={card.secondaryButton}
|
||||||
sidePeekButton={card.sidePeekButton}
|
sidePeekButton={card.sidePeekButton}
|
||||||
|
sidePeekContent={card.sidePeekContent}
|
||||||
image={card.image}
|
image={card.image}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { env } from "@/env/server"
|
||||||
|
|
||||||
import HowItWorks from "@/components/Blocks/DynamicContent/HowItWorks"
|
import HowItWorks from "@/components/Blocks/DynamicContent/HowItWorks"
|
||||||
import LoyaltyLevels from "@/components/Blocks/DynamicContent/LoyaltyLevels"
|
import LoyaltyLevels from "@/components/Blocks/DynamicContent/LoyaltyLevels"
|
||||||
import Overview from "@/components/Blocks/DynamicContent/Overview"
|
import Overview from "@/components/Blocks/DynamicContent/Overview"
|
||||||
@@ -26,7 +28,9 @@ export default async function DynamicContent({
|
|||||||
case DynamicContentEnum.Blocks.components.earn_and_burn:
|
case DynamicContentEnum.Blocks.components.earn_and_burn:
|
||||||
return <EarnAndBurn {...dynamic_content} />
|
return <EarnAndBurn {...dynamic_content} />
|
||||||
case DynamicContentEnum.Blocks.components.expiring_points:
|
case DynamicContentEnum.Blocks.components.expiring_points:
|
||||||
return <ExpiringPoints {...dynamic_content} />
|
return env.HIDE_FOR_NEXT_RELEASE ? null : (
|
||||||
|
<ExpiringPoints {...dynamic_content} />
|
||||||
|
)
|
||||||
case DynamicContentEnum.Blocks.components.how_it_works:
|
case DynamicContentEnum.Blocks.components.how_it_works:
|
||||||
return (
|
return (
|
||||||
<HowItWorks dynamic_content={dynamic_content} firstItem={firstItem} />
|
<HowItWorks dynamic_content={dynamic_content} firstItem={firstItem} />
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
import { ArrowRightIcon } from "@/components/Icons"
|
|
||||||
import SectionContainer from "@/components/Section/Container"
|
|
||||||
import SectionHeader from "@/components/Section/Header"
|
|
||||||
import Link from "@/components/TempDesignSystem/Link"
|
|
||||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
|
||||||
|
|
||||||
import styles from "./shortcuts.module.css"
|
|
||||||
|
|
||||||
import type { ShortcutsProps } from "@/types/components/myPages/myPage/shortcuts"
|
|
||||||
|
|
||||||
export default function Shortcuts({
|
|
||||||
firstItem = false,
|
|
||||||
shortcuts,
|
|
||||||
subtitle,
|
|
||||||
title,
|
|
||||||
}: ShortcutsProps) {
|
|
||||||
return (
|
|
||||||
<SectionContainer>
|
|
||||||
<SectionHeader preamble={subtitle} title={title} topTitle={firstItem} />
|
|
||||||
<section className={styles.links}>
|
|
||||||
{shortcuts.map((shortcut) => (
|
|
||||||
<Link
|
|
||||||
href={shortcut.url}
|
|
||||||
key={shortcut.title}
|
|
||||||
target={shortcut.openInNewTab ? "_blank" : undefined}
|
|
||||||
variant="shortcut"
|
|
||||||
>
|
|
||||||
<Body textTransform="bold" color="burgundy">
|
|
||||||
<span>{shortcut.text ? shortcut.text : shortcut.title}</span>
|
|
||||||
</Body>
|
|
||||||
<ArrowRightIcon color="burgundy" className={styles.arrowRight} />
|
|
||||||
</Link>
|
|
||||||
))}
|
|
||||||
</section>
|
|
||||||
</SectionContainer>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
.links {
|
|
||||||
display: grid;
|
|
||||||
background-color: var(--Scandic-Brand-Pale-Peach);
|
|
||||||
border-radius: var(--Corner-radius-Medium);
|
|
||||||
border: 1px solid var(--Base-Border-Subtle);
|
|
||||||
}
|
|
||||||
|
|
||||||
.arrowRight {
|
|
||||||
height: 24px;
|
|
||||||
width: 24px;
|
|
||||||
}
|
|
||||||
32
components/Blocks/ShortcutsList/ShortcutsListItems/index.tsx
Normal file
32
components/Blocks/ShortcutsList/ShortcutsListItems/index.tsx
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import { ArrowRightIcon } from "@/components/Icons"
|
||||||
|
import Link from "@/components/TempDesignSystem/Link"
|
||||||
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||||
|
|
||||||
|
import styles from "./shortcutsListItems.module.css"
|
||||||
|
|
||||||
|
import type { ShortcutsListItemsProps } from "@/types/components/blocks/shortcuts"
|
||||||
|
|
||||||
|
export default function ShortcutsListItems({
|
||||||
|
shortcutsListItems,
|
||||||
|
className,
|
||||||
|
}: ShortcutsListItemsProps) {
|
||||||
|
return (
|
||||||
|
<ul className={className}>
|
||||||
|
{shortcutsListItems.map((shortcut) => (
|
||||||
|
<li key={shortcut.title} className={styles.listItem}>
|
||||||
|
<Link
|
||||||
|
href={shortcut.url}
|
||||||
|
target={shortcut.openInNewTab ? "_blank" : undefined}
|
||||||
|
variant="shortcut"
|
||||||
|
className={styles.link}
|
||||||
|
>
|
||||||
|
<Body textTransform="bold" color="burgundy">
|
||||||
|
<span>{shortcut.text || shortcut.title}</span>
|
||||||
|
</Body>
|
||||||
|
<ArrowRightIcon color="burgundy" width={24} height={24} />
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
.link {
|
||||||
|
background-color: var(--Base-Surface-Primary-light-Normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
.listItem {
|
||||||
|
border-bottom: 1px solid var(--Base-Border-Subtle);
|
||||||
|
}
|
||||||
|
|
||||||
|
.listItem:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
51
components/Blocks/ShortcutsList/index.tsx
Normal file
51
components/Blocks/ShortcutsList/index.tsx
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import SectionContainer from "@/components/Section/Container"
|
||||||
|
import SectionHeader from "@/components/Section/Header"
|
||||||
|
|
||||||
|
import ShortcutsListItems from "./ShortcutsListItems"
|
||||||
|
|
||||||
|
import styles from "./shortcutsList.module.css"
|
||||||
|
|
||||||
|
import type { ShortcutsListProps } from "@/types/components/blocks/shortcuts"
|
||||||
|
|
||||||
|
export default function ShortcutsList({
|
||||||
|
firstItem = false,
|
||||||
|
shortcuts,
|
||||||
|
subtitle,
|
||||||
|
title,
|
||||||
|
hasTwoColumns,
|
||||||
|
}: ShortcutsListProps) {
|
||||||
|
const middleIndex = Math.ceil(shortcuts.length / 2)
|
||||||
|
const leftColumn = shortcuts.slice(0, middleIndex)
|
||||||
|
const rightColumn = shortcuts.slice(middleIndex)
|
||||||
|
|
||||||
|
const classNames =
|
||||||
|
hasTwoColumns && shortcuts.length > 1
|
||||||
|
? {
|
||||||
|
section: styles.twoColumnSection,
|
||||||
|
leftColumn: styles.leftColumn,
|
||||||
|
rightColumn: styles.rightColumn,
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
section: styles.oneColumnSection,
|
||||||
|
leftColumn:
|
||||||
|
shortcuts.length === 1
|
||||||
|
? styles.leftColumnBorderBottomNone
|
||||||
|
: styles.leftColumnBorderBottom,
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SectionContainer>
|
||||||
|
<SectionHeader preamble={subtitle} title={title} topTitle={firstItem} />
|
||||||
|
<section className={classNames.section}>
|
||||||
|
<ShortcutsListItems
|
||||||
|
shortcutsListItems={leftColumn}
|
||||||
|
className={classNames.leftColumn}
|
||||||
|
/>
|
||||||
|
<ShortcutsListItems
|
||||||
|
shortcutsListItems={rightColumn}
|
||||||
|
className={classNames.rightColumn}
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
</SectionContainer>
|
||||||
|
)
|
||||||
|
}
|
||||||
33
components/Blocks/ShortcutsList/shortcutsList.module.css
Normal file
33
components/Blocks/ShortcutsList/shortcutsList.module.css
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
.oneColumnSection,
|
||||||
|
.twoColumnSection {
|
||||||
|
display: grid;
|
||||||
|
border-radius: var(--Corner-radius-Medium);
|
||||||
|
border: 1px solid var(--Base-Border-Subtle);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leftColumn,
|
||||||
|
.leftColumnBorderBottom {
|
||||||
|
border-bottom: 1px solid var(--Base-Border-Subtle);
|
||||||
|
}
|
||||||
|
|
||||||
|
.leftColumnBorderBottomNone {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 1367px) {
|
||||||
|
.twoColumnSection {
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
column-gap: var(--Spacing-x2);
|
||||||
|
border-radius: 0;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leftColumn,
|
||||||
|
.rightColumn {
|
||||||
|
height: fit-content;
|
||||||
|
border: 1px solid var(--Base-Border-Subtle);
|
||||||
|
border-radius: var(--Corner-radius-Medium);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
import Link from "@/components/TempDesignSystem/Link"
|
import Link from "@/components/TempDesignSystem/Link"
|
||||||
import { removeMultipleSlashes } from "@/utils/url"
|
|
||||||
|
|
||||||
import styles from "./uspgrid.module.css"
|
import styles from "./uspgrid.module.css"
|
||||||
|
|
||||||
import { EmbedEnum } from "@/types/requests/utils/embeds"
|
|
||||||
import type { EmbedByUid } from "@/types/transitionTypes/jsontohtml"
|
import type { EmbedByUid } from "@/types/transitionTypes/jsontohtml"
|
||||||
import { RTEItemTypeEnum, RTETypeEnum } from "@/types/transitionTypes/rte/enums"
|
import { RTEItemTypeEnum, RTETypeEnum } from "@/types/transitionTypes/rte/enums"
|
||||||
import type {
|
import type {
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import CardsGrid from "@/components/Blocks/CardsGrid"
|
import CardsGrid from "@/components/Blocks/CardsGrid"
|
||||||
import DynamicContent from "@/components/Blocks/DynamicContent"
|
import DynamicContent from "@/components/Blocks/DynamicContent"
|
||||||
import Shortcuts from "@/components/Blocks/Shortcuts"
|
import ShortcutsList from "@/components/Blocks/ShortcutsList"
|
||||||
import TextCols from "@/components/Blocks/TextCols"
|
import TextCols from "@/components/Blocks/TextCols"
|
||||||
import UspGrid from "@/components/Blocks/UspGrid"
|
import UspGrid from "@/components/Blocks/UspGrid"
|
||||||
import JsonToHtml from "@/components/JsonToHtml"
|
import JsonToHtml from "@/components/JsonToHtml"
|
||||||
|
|
||||||
|
import AccordionSection from "./Accordion"
|
||||||
import Table from "./Table"
|
import Table from "./Table"
|
||||||
|
|
||||||
import type { BlocksProps } from "@/types/components/blocks"
|
import type { BlocksProps } from "@/types/components/blocks"
|
||||||
@@ -14,6 +15,14 @@ export default function Blocks({ blocks }: BlocksProps) {
|
|||||||
return blocks.map((block, idx) => {
|
return blocks.map((block, idx) => {
|
||||||
const firstItem = idx === 0
|
const firstItem = idx === 0
|
||||||
switch (block.typename) {
|
switch (block.typename) {
|
||||||
|
case BlocksEnums.block.Accordion:
|
||||||
|
return (
|
||||||
|
<AccordionSection
|
||||||
|
accordion={block.accordion.accordions}
|
||||||
|
title={block.accordion.title}
|
||||||
|
key={`${block.typename}-${idx}`}
|
||||||
|
/>
|
||||||
|
)
|
||||||
case BlocksEnums.block.CardsGrid:
|
case BlocksEnums.block.CardsGrid:
|
||||||
return (
|
return (
|
||||||
<CardsGrid
|
<CardsGrid
|
||||||
@@ -41,12 +50,13 @@ export default function Blocks({ blocks }: BlocksProps) {
|
|||||||
)
|
)
|
||||||
case BlocksEnums.block.Shortcuts:
|
case BlocksEnums.block.Shortcuts:
|
||||||
return (
|
return (
|
||||||
<Shortcuts
|
<ShortcutsList
|
||||||
firstItem={firstItem}
|
firstItem={firstItem}
|
||||||
key={`${block.shortcuts.title}-${idx}`}
|
key={`${block.shortcuts.title}-${idx}`}
|
||||||
shortcuts={block.shortcuts.shortcuts}
|
shortcuts={block.shortcuts.shortcuts}
|
||||||
subtitle={block.shortcuts.subtitle}
|
subtitle={block.shortcuts.subtitle}
|
||||||
title={block.shortcuts.title}
|
title={block.shortcuts.title}
|
||||||
|
hasTwoColumns={block.shortcuts.hasTwoColumns}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
case BlocksEnums.block.Table:
|
case BlocksEnums.block.Table:
|
||||||
@@ -64,6 +74,7 @@ export default function Blocks({ blocks }: BlocksProps) {
|
|||||||
)
|
)
|
||||||
case BlocksEnums.block.UspGrid:
|
case BlocksEnums.block.UspGrid:
|
||||||
return <UspGrid usp_grid={block.usp_grid} />
|
return <UspGrid usp_grid={block.usp_grid} />
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { dt } from "@/lib/dt"
|
|||||||
|
|
||||||
import Form from "@/components/Forms/BookingWidget"
|
import Form from "@/components/Forms/BookingWidget"
|
||||||
import { bookingWidgetSchema } from "@/components/Forms/BookingWidget/schema"
|
import { bookingWidgetSchema } from "@/components/Forms/BookingWidget/schema"
|
||||||
import { CloseLarge } from "@/components/Icons"
|
import { CloseLargeIcon } from "@/components/Icons"
|
||||||
import { debounce } from "@/utils/debounce"
|
import { debounce } from "@/utils/debounce"
|
||||||
|
|
||||||
import MobileToggleButton from "./MobileToggleButton"
|
import MobileToggleButton from "./MobileToggleButton"
|
||||||
@@ -98,7 +98,7 @@ export default function BookingWidgetClient({
|
|||||||
onClick={closeMobileSearch}
|
onClick={closeMobileSearch}
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
<CloseLarge />
|
<CloseLargeIcon />
|
||||||
</button>
|
</button>
|
||||||
<Form locations={locations} type={type} />
|
<Form locations={locations} type={type} />
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
box-shadow: 0px 4px 24px 0px rgba(0, 0, 0, 0.05);
|
box-shadow: 0px 4px 24px 0px rgba(0, 0, 0, 0.05);
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 9;
|
z-index: 10;
|
||||||
background-color: var(--Base-Surface-Primary-light-Normal);
|
background-color: var(--Base-Surface-Primary-light-Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
padding-left: var(--Spacing-x2);
|
padding-left: var(--Spacing-x2);
|
||||||
padding-right: var(--Spacing-x2);
|
padding-right: var(--Spacing-x2);
|
||||||
padding-top: var(--Spacing-x2);
|
padding-top: var(--Spacing-x2);
|
||||||
|
max-width: var(--max-width);
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list {
|
.list {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export default async function Breadcrumbs() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<li key={breadcrumb.uid} className={styles.listItem}>
|
<li key={breadcrumb.uid} className={styles.listItem}>
|
||||||
<Footnote color="burgundy" textTransform="bold">
|
<Footnote color="burgundy" type="bold">
|
||||||
{breadcrumb.title}
|
{breadcrumb.title}
|
||||||
</Footnote>
|
</Footnote>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--Spacing-x-one-and-half);
|
gap: var(--Spacing-x-one-and-half);
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
width: 100%;
|
width: min(100%, 300px);
|
||||||
max-width: 300px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.amenityItemList {
|
.amenityItemList {
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
.cardContainer {
|
||||||
|
scroll-margin-top: var(--hotel-page-scroll-margin-top);
|
||||||
|
}
|
||||||
|
|
||||||
.spanOne {
|
.spanOne {
|
||||||
grid-column: span 1;
|
grid-column: span 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export default function FacilitiesCardGrid({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id={imageCard.card.id}>
|
<section id={imageCard.card.id} className={styles.cardContainer}>
|
||||||
<Grids.Stackable className={styles.desktopGrid}>
|
<Grids.Stackable className={styles.desktopGrid}>
|
||||||
{facilitiesCardGrid.map((card: FacilityCardType) => (
|
{facilitiesCardGrid.map((card: FacilityCardType) => (
|
||||||
<Card {...card} key={card.id} className={getCardClassName(card)} />
|
<Card {...card} key={card.id} className={getCardClassName(card)} />
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import Title from "@/components/TempDesignSystem/Text/Title"
|
|||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
import { getLang } from "@/i18n/serverContext"
|
import { getLang } from "@/i18n/serverContext"
|
||||||
|
|
||||||
import { IntroSectionProps } from "./types"
|
|
||||||
|
|
||||||
import styles from "./introSection.module.css"
|
import styles from "./introSection.module.css"
|
||||||
|
|
||||||
|
import type { IntroSectionProps } from "./types"
|
||||||
|
|
||||||
export default async function IntroSection({
|
export default async function IntroSection({
|
||||||
hotelName,
|
hotelName,
|
||||||
hotelDescription,
|
hotelDescription,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--Spacing-x2);
|
gap: var(--Spacing-x2);
|
||||||
position: relative;
|
position: relative;
|
||||||
max-width: var(--max-width-text-block);
|
max-width: 607px; /* Max width according to Figma */
|
||||||
}
|
}
|
||||||
|
|
||||||
.mainContent {
|
.mainContent {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import useHotelPageStore from "@/stores/hotel-page"
|
import useHotelPageStore from "@/stores/hotel-page"
|
||||||
@@ -21,7 +20,6 @@ export default function MobileMapToggle() {
|
|||||||
onClick={closeDynamicMap}
|
onClick={closeDynamicMap}
|
||||||
>
|
>
|
||||||
<HouseIcon
|
<HouseIcon
|
||||||
className={styles.icon}
|
|
||||||
color={!isDynamicMapOpen ? "white" : "red"}
|
color={!isDynamicMapOpen ? "white" : "red"}
|
||||||
height={24}
|
height={24}
|
||||||
width={24}
|
width={24}
|
||||||
@@ -34,7 +32,6 @@ export default function MobileMapToggle() {
|
|||||||
onClick={openDynamicMap}
|
onClick={openDynamicMap}
|
||||||
>
|
>
|
||||||
<MapIcon
|
<MapIcon
|
||||||
className={styles.icon}
|
|
||||||
color={isDynamicMapOpen ? "white" : "red"}
|
color={isDynamicMapOpen ? "white" : "red"}
|
||||||
height={24}
|
height={24}
|
||||||
width={24}
|
width={24}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
.mobileToggle {
|
.mobileToggle {
|
||||||
position: fixed;
|
position: sticky;
|
||||||
bottom: var(--Spacing-x5);
|
bottom: var(--Spacing-x5);
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
margin: 0 auto;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
gap: var(--Spacing-x-half);
|
gap: var(--Spacing-x-half);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
|||||||
|
|
||||||
import styles from "./roomCard.module.css"
|
import styles from "./roomCard.module.css"
|
||||||
|
|
||||||
import type { RoomCardProps } from "@/types/components/hotelPage/roomCard"
|
import type { RoomCardProps } from "@/types/components/hotelPage/room"
|
||||||
|
|
||||||
export function RoomCard({
|
export function RoomCard({
|
||||||
badgeTextTransKey,
|
badgeTextTransKey,
|
||||||
|
|||||||
@@ -3,95 +3,88 @@
|
|||||||
import { useRef, useState } from "react"
|
import { useRef, useState } from "react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import { ChevronDownIcon } from "@/components/Icons"
|
|
||||||
import SectionContainer from "@/components/Section/Container"
|
import SectionContainer from "@/components/Section/Container"
|
||||||
import SectionHeader from "@/components/Section/Header"
|
import SectionHeader from "@/components/Section/Header"
|
||||||
import Button from "@/components/TempDesignSystem/Button"
|
|
||||||
import Grids from "@/components/TempDesignSystem/Grids"
|
import Grids from "@/components/TempDesignSystem/Grids"
|
||||||
|
import ShowMoreButton from "@/components/TempDesignSystem/ShowMoreButton"
|
||||||
|
|
||||||
import { RoomCard } from "./RoomCard"
|
import { RoomCard } from "./RoomCard"
|
||||||
|
|
||||||
import styles from "./rooms.module.css"
|
import styles from "./rooms.module.css"
|
||||||
|
|
||||||
import type { RoomsProps } from "./types"
|
import type { RoomsProps } from "@/types/components/hotelPage/room"
|
||||||
|
import { HotelHashValues } from "@/types/components/hotelPage/tabNavigation"
|
||||||
|
|
||||||
export function Rooms({ rooms }: RoomsProps) {
|
export function Rooms({ rooms }: RoomsProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const [allRoomsVisible, setAllRoomsVisible] = useState(false)
|
const showToggleButton = rooms.length > 3
|
||||||
|
const [allRoomsVisible, setAllRoomsVisible] = useState(!showToggleButton)
|
||||||
|
|
||||||
const scrollRef = useRef<HTMLDivElement>(null)
|
const scrollRef = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
const mappedRooms = rooms
|
const mappedRooms = rooms
|
||||||
.map((room) => {
|
.map((room) => {
|
||||||
const size = `${room.attributes.roomSize.min} - ${room.attributes.roomSize.max} m²`
|
const size = `${room.roomSize.min} - ${room.roomSize.max} m²`
|
||||||
const personLabel =
|
const personLabel =
|
||||||
room.attributes.occupancy.total === 1
|
room.occupancy.total === 1
|
||||||
? intl.formatMessage({ id: "hotelPages.rooms.roomCard.person" })
|
? intl.formatMessage({ id: "hotelPages.rooms.roomCard.person" })
|
||||||
: intl.formatMessage({ id: "hotelPages.rooms.roomCard.persons" })
|
: intl.formatMessage({ id: "hotelPages.rooms.roomCard.persons" })
|
||||||
|
|
||||||
const subtitle = `${size} (${room.attributes.occupancy.total} ${personLabel})`
|
const subtitle = `${size} (${room.occupancy.total} ${personLabel})`
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: room.id,
|
id: room.id,
|
||||||
images: room.attributes.content.images,
|
images: room.images,
|
||||||
title: room.attributes.name,
|
title: room.name,
|
||||||
subtitle: subtitle,
|
subtitle: subtitle,
|
||||||
sortOrder: room.attributes.sortOrder,
|
sortOrder: room.sortOrder,
|
||||||
popularChoice: null,
|
popularChoice: null,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.sort((a, b) => a.sortOrder - b.sortOrder)
|
.sort((a, b) => a.sortOrder - b.sortOrder)
|
||||||
|
|
||||||
function handleToggleShowMore() {
|
function handleShowMore() {
|
||||||
if (scrollRef.current && allRoomsVisible) {
|
if (scrollRef.current && allRoomsVisible) {
|
||||||
scrollRef.current.scrollIntoView({ behavior: "smooth" })
|
scrollRef.current.scrollIntoView({ behavior: "smooth" })
|
||||||
}
|
}
|
||||||
|
setAllRoomsVisible((state) => !state)
|
||||||
setAllRoomsVisible((previousState) => !previousState)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SectionContainer id="rooms-section">
|
<SectionContainer
|
||||||
<div ref={scrollRef}></div>
|
id={HotelHashValues.rooms}
|
||||||
|
className={styles.roomsContainer}
|
||||||
|
>
|
||||||
|
<div ref={scrollRef} className={styles.scrollRef}></div>
|
||||||
<SectionHeader
|
<SectionHeader
|
||||||
textTransform="capitalize"
|
textTransform="capitalize"
|
||||||
title={intl.formatMessage({ id: "Rooms" })}
|
title={intl.formatMessage({ id: "Rooms" })}
|
||||||
preamble={null}
|
preamble={null}
|
||||||
/>
|
/>
|
||||||
<Grids.Stackable>
|
<Grids.Stackable
|
||||||
{mappedRooms.map(
|
className={`${styles.grid} ${allRoomsVisible ? styles.allVisible : ""}`}
|
||||||
({ id, images, title, subtitle, popularChoice }, index) => (
|
>
|
||||||
<div
|
{mappedRooms.map(({ id, images, title, subtitle, popularChoice }) => (
|
||||||
key={id}
|
<div key={id}>
|
||||||
className={
|
<RoomCard
|
||||||
!allRoomsVisible && index > 2 ? styles.hiddenRoomCard : ""
|
id={id}
|
||||||
}
|
images={images}
|
||||||
>
|
title={title}
|
||||||
<RoomCard
|
subtitle={subtitle}
|
||||||
id={id}
|
badgeTextTransKey={popularChoice ? "Popular choice" : null}
|
||||||
images={images}
|
/>
|
||||||
title={title}
|
</div>
|
||||||
subtitle={subtitle}
|
))}
|
||||||
badgeTextTransKey={popularChoice ? "Popular choice" : null}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
)}
|
|
||||||
</Grids.Stackable>
|
</Grids.Stackable>
|
||||||
|
|
||||||
<div className={styles.ctaContainer}>
|
{showToggleButton ? (
|
||||||
<Button
|
<ShowMoreButton
|
||||||
onClick={handleToggleShowMore}
|
loadMoreData={handleShowMore}
|
||||||
theme="base"
|
showLess={allRoomsVisible}
|
||||||
intent="text"
|
textShowMore="Show more rooms"
|
||||||
variant="icon"
|
textShowLess="Show less rooms"
|
||||||
className={`${styles.showMoreButton} ${allRoomsVisible ? styles.showLess : ""}`}
|
/>
|
||||||
>
|
) : null}
|
||||||
<ChevronDownIcon className={styles.chevron} />
|
|
||||||
{intl.formatMessage({
|
|
||||||
id: allRoomsVisible ? "Show less" : "Show more",
|
|
||||||
})}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</SectionContainer>
|
</SectionContainer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,22 @@
|
|||||||
|
.roomsContainer {
|
||||||
|
position: relative;
|
||||||
|
scroll-margin-top: var(--hotel-page-scroll-margin-top);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollRef {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(-1 * var(--hotel-page-scroll-margin-top));
|
||||||
|
}
|
||||||
|
|
||||||
.ctaContainer {
|
.ctaContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hiddenRoomCard {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.showMoreButton.showLess .chevron {
|
.showMoreButton.showLess .chevron {
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.grid:not(.allVisible) :nth-child(n + 4) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
import { RoomData } from "@/types/hotel"
|
|
||||||
|
|
||||||
export type RoomsProps = {
|
|
||||||
rooms: RoomData[]
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
|
import { useRouter } from "next/navigation"
|
||||||
|
import { useEffect } from "react"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import Link from "@/components/TempDesignSystem/Link"
|
import Link from "@/components/TempDesignSystem/Link"
|
||||||
import useHash from "@/hooks/useHash"
|
import useHash from "@/hooks/useHash"
|
||||||
|
import useScrollSpy from "@/hooks/useScrollSpy"
|
||||||
|
|
||||||
import styles from "./tabNavigation.module.css"
|
import styles from "./tabNavigation.module.css"
|
||||||
|
|
||||||
@@ -11,50 +15,78 @@ import {
|
|||||||
type TabNavigationProps,
|
type TabNavigationProps,
|
||||||
} from "@/types/components/hotelPage/tabNavigation"
|
} from "@/types/components/hotelPage/tabNavigation"
|
||||||
|
|
||||||
export default function TabNavigation({ restaurantTitle }: TabNavigationProps) {
|
export default function TabNavigation({
|
||||||
|
restaurantTitle,
|
||||||
|
hasActivities,
|
||||||
|
hasFAQ,
|
||||||
|
}: TabNavigationProps) {
|
||||||
const hash = useHash()
|
const hash = useHash()
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
const hotelTabLinks: { href: HotelHashValues | string; text: string }[] = [
|
const tabLinks: { hash: HotelHashValues; text: string }[] = [
|
||||||
{
|
{
|
||||||
href: HotelHashValues.overview,
|
hash: HotelHashValues.overview,
|
||||||
text: intl.formatMessage({ id: "Overview" }),
|
text: intl.formatMessage({ id: "Overview" }),
|
||||||
},
|
},
|
||||||
{ href: HotelHashValues.rooms, text: intl.formatMessage({ id: "Rooms" }) },
|
{ hash: HotelHashValues.rooms, text: intl.formatMessage({ id: "Rooms" }) },
|
||||||
{
|
{
|
||||||
href: HotelHashValues.restaurant,
|
hash: HotelHashValues.restaurant,
|
||||||
text: intl.formatMessage({ id: restaurantTitle }, { count: 1 }),
|
text: intl.formatMessage({ id: restaurantTitle }, { count: 1 }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: HotelHashValues.meetings,
|
hash: HotelHashValues.meetings,
|
||||||
text: intl.formatMessage({ id: "Meetings & Conferences" }),
|
text: intl.formatMessage({ id: "Meetings & Conferences" }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: HotelHashValues.wellness,
|
hash: HotelHashValues.wellness,
|
||||||
text: intl.formatMessage({ id: "Wellness & Exercise" }),
|
text: intl.formatMessage({ id: "Wellness & Exercise" }),
|
||||||
},
|
},
|
||||||
{
|
...(hasActivities
|
||||||
href: HotelHashValues.activities,
|
? [
|
||||||
text: intl.formatMessage({ id: "Activities" }),
|
{
|
||||||
},
|
hash: HotelHashValues.activities,
|
||||||
{ href: HotelHashValues.faq, text: intl.formatMessage({ id: "FAQ" }) },
|
text: intl.formatMessage({ id: "Activities" }),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
|
...(hasFAQ
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
hash: HotelHashValues.faq,
|
||||||
|
text: intl.formatMessage({ id: "FAQ" }),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const { activeSectionId, pauseScrollSpy } = useScrollSpy(
|
||||||
|
tabLinks.map(({ hash }) => hash)
|
||||||
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (activeSectionId) {
|
||||||
|
router.replace(`#${activeSectionId}`, { scroll: false })
|
||||||
|
}
|
||||||
|
}, [activeSectionId, router])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.stickyWrapper}>
|
<div className={styles.stickyWrapper}>
|
||||||
<nav className={styles.tabsContainer}>
|
<nav className={styles.tabsContainer}>
|
||||||
{hotelTabLinks.map((link) => {
|
{tabLinks.map((link) => {
|
||||||
const isActive =
|
const isActive =
|
||||||
hash === link.href ||
|
hash === link.hash ||
|
||||||
(hash === "" && link.href === HotelHashValues.overview)
|
(!hash && link.hash === HotelHashValues.overview)
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
key={link.href}
|
key={link.hash}
|
||||||
href={link.href}
|
href={`#${link.hash}`}
|
||||||
active={isActive}
|
active={isActive}
|
||||||
variant="tab"
|
variant="tab"
|
||||||
color="burgundy"
|
color="burgundy"
|
||||||
textDecoration="none"
|
textDecoration="none"
|
||||||
|
scroll={true}
|
||||||
|
onClick={pauseScrollSpy}
|
||||||
>
|
>
|
||||||
{intl.formatMessage({ id: link.text })}
|
{intl.formatMessage({ id: link.text })}
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
.stickyWrapper {
|
.stickyWrapper {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: var(--booking-widget-mobile-height);
|
||||||
z-index: 1;
|
z-index: 2;
|
||||||
background-color: var(--Base-Surface-Subtle-Normal);
|
background-color: var(--Base-Surface-Subtle-Normal);
|
||||||
border-bottom: 1px solid var(--Base-Border-Subtle);
|
border-bottom: 1px solid var(--Base-Border-Subtle);
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
@@ -16,6 +16,12 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 768px) {
|
||||||
|
.stickyWrapper {
|
||||||
|
top: var(--booking-widget-desktop-height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 1367px) {
|
@media screen and (min-width: 1367px) {
|
||||||
.tabsContainer {
|
.tabsContainer {
|
||||||
padding: 0 var(--Spacing-x5);
|
padding: 0 var(--Spacing-x5);
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
.pageContainer {
|
.pageContainer {
|
||||||
|
--hotel-page-navigation-height: 59px;
|
||||||
|
--hotel-page-scroll-margin-top: calc(
|
||||||
|
var(--hotel-page-navigation-height) + var(--Spacing-x2)
|
||||||
|
);
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
"hotelImages"
|
"hotelImages"
|
||||||
"tabNavigation"
|
"tabNavigation"
|
||||||
"mainSection"
|
"mainSection"
|
||||||
"mapContainer";
|
"mapContainer";
|
||||||
|
margin: 0 auto;
|
||||||
|
max-width: var(--max-width);
|
||||||
|
z-index: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hotelImages {
|
.hotelImages {
|
||||||
@@ -24,8 +31,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.introContainer {
|
.introContainer {
|
||||||
display: grid;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
gap: var(--Spacing-x4);
|
gap: var(--Spacing-x4);
|
||||||
|
scroll-margin-top: var(--hotel-page-scroll-margin-top);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 1367px) {
|
@media screen and (min-width: 1367px) {
|
||||||
@@ -52,7 +62,7 @@
|
|||||||
|
|
||||||
.mapWithCard {
|
.mapWithCard {
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 0;
|
top: var(--booking-widget-desktop-height);
|
||||||
min-height: 500px; /* Fixed min to not cover the marker with the card */
|
min-height: 500px; /* Fixed min to not cover the marker with the card */
|
||||||
height: calc(
|
height: calc(
|
||||||
100vh - var(--main-menu-desktop-height) -
|
100vh - var(--main-menu-desktop-height) -
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import hotelPageParams from "@/constants/routes/hotelPageParams"
|
|||||||
import { env } from "@/env/server"
|
import { env } from "@/env/server"
|
||||||
import { serverClient } from "@/lib/trpc/server"
|
import { serverClient } from "@/lib/trpc/server"
|
||||||
|
|
||||||
|
import AccordionSection from "@/components/Blocks/Accordion"
|
||||||
import SidePeekProvider from "@/components/SidePeekProvider"
|
import SidePeekProvider from "@/components/SidePeekProvider"
|
||||||
import SidePeek from "@/components/TempDesignSystem/SidePeek"
|
import SidePeek from "@/components/TempDesignSystem/SidePeek"
|
||||||
import { getIntl } from "@/i18n"
|
import { getIntl } from "@/i18n"
|
||||||
@@ -21,6 +22,8 @@ import TabNavigation from "./TabNavigation"
|
|||||||
|
|
||||||
import styles from "./hotelPage.module.css"
|
import styles from "./hotelPage.module.css"
|
||||||
|
|
||||||
|
import { HotelHashValues } from "@/types/components/hotelPage/tabNavigation"
|
||||||
|
|
||||||
export default async function HotelPage() {
|
export default async function HotelPage() {
|
||||||
const intl = await getIntl()
|
const intl = await getIntl()
|
||||||
const lang = getLang()
|
const lang = getLang()
|
||||||
@@ -45,6 +48,7 @@ export default async function HotelPage() {
|
|||||||
activitiesCard,
|
activitiesCard,
|
||||||
pointsOfInterest,
|
pointsOfInterest,
|
||||||
facilities,
|
facilities,
|
||||||
|
faq,
|
||||||
} = hotelData
|
} = hotelData
|
||||||
|
|
||||||
const topThreePois = pointsOfInterest.slice(0, 3)
|
const topThreePois = pointsOfInterest.slice(0, 3)
|
||||||
@@ -61,9 +65,11 @@ export default async function HotelPage() {
|
|||||||
</div>
|
</div>
|
||||||
<TabNavigation
|
<TabNavigation
|
||||||
restaurantTitle={getRestaurantHeading(hotelDetailedFacilities)}
|
restaurantTitle={getRestaurantHeading(hotelDetailedFacilities)}
|
||||||
|
hasActivities={!!activitiesCard}
|
||||||
|
hasFAQ={!!faq}
|
||||||
/>
|
/>
|
||||||
<main className={styles.mainSection}>
|
<main className={styles.mainSection}>
|
||||||
<div className={styles.introContainer}>
|
<div id={HotelHashValues.overview} className={styles.introContainer}>
|
||||||
<IntroSection
|
<IntroSection
|
||||||
hotelName={hotelName}
|
hotelName={hotelName}
|
||||||
hotelDescription={hotelDescription}
|
hotelDescription={hotelDescription}
|
||||||
@@ -71,55 +77,14 @@ export default async function HotelPage() {
|
|||||||
address={hotelAddress}
|
address={hotelAddress}
|
||||||
tripAdvisor={hotelRatings?.tripAdvisor}
|
tripAdvisor={hotelRatings?.tripAdvisor}
|
||||||
/>
|
/>
|
||||||
<SidePeekProvider>
|
|
||||||
{/* eslint-disable import/no-named-as-default-member */}
|
|
||||||
<SidePeek
|
|
||||||
contentKey={hotelPageParams.amenities[lang]}
|
|
||||||
title={intl.formatMessage({ id: "Amenities" })}
|
|
||||||
>
|
|
||||||
{/* TODO: Render amenities as per the design. */}
|
|
||||||
Read more about the amenities here
|
|
||||||
</SidePeek>
|
|
||||||
<SidePeek
|
|
||||||
contentKey={hotelPageParams.about[lang]}
|
|
||||||
title={intl.formatMessage({ id: "Read more about the hotel" })}
|
|
||||||
>
|
|
||||||
Some additional information about the hotel
|
|
||||||
</SidePeek>
|
|
||||||
<SidePeek
|
|
||||||
contentKey={hotelPageParams.restaurantAndBar[lang]}
|
|
||||||
title={intl.formatMessage({ id: "Restaurant & Bar" })}
|
|
||||||
>
|
|
||||||
{/* TODO */}
|
|
||||||
Restaurant & Bar
|
|
||||||
</SidePeek>
|
|
||||||
<SidePeek
|
|
||||||
contentKey={hotelPageParams.wellnessAndExercise[lang]}
|
|
||||||
title={intl.formatMessage({ id: "Wellness & Exercise" })}
|
|
||||||
>
|
|
||||||
{/* TODO */}
|
|
||||||
Wellness & Exercise
|
|
||||||
</SidePeek>
|
|
||||||
<SidePeek
|
|
||||||
contentKey={hotelPageParams.activities[lang]}
|
|
||||||
title={intl.formatMessage({ id: "Activities" })}
|
|
||||||
>
|
|
||||||
{/* TODO */}
|
|
||||||
Activities
|
|
||||||
</SidePeek>
|
|
||||||
<SidePeek
|
|
||||||
contentKey={hotelPageParams.meetingsAndConferences[lang]}
|
|
||||||
title={intl.formatMessage({ id: "Meetings & Conferences" })}
|
|
||||||
>
|
|
||||||
{/* TODO */}
|
|
||||||
Meetings & Conferences
|
|
||||||
</SidePeek>
|
|
||||||
{/* eslint-enable import/no-named-as-default-member */}
|
|
||||||
</SidePeekProvider>
|
|
||||||
<AmenitiesList detailedFacilities={hotelDetailedFacilities} />
|
<AmenitiesList detailedFacilities={hotelDetailedFacilities} />
|
||||||
</div>
|
</div>
|
||||||
<Rooms rooms={roomCategories} />
|
<Rooms rooms={roomCategories} />
|
||||||
<Facilities facilities={facilities} activitiesCard={activitiesCard} />
|
<Facilities facilities={facilities} activitiesCard={activitiesCard} />
|
||||||
|
{faq && (
|
||||||
|
<AccordionSection accordion={faq.accordions} title={faq.title} />
|
||||||
|
)}
|
||||||
</main>
|
</main>
|
||||||
{googleMapsApiKey ? (
|
{googleMapsApiKey ? (
|
||||||
<>
|
<>
|
||||||
@@ -139,6 +104,51 @@ export default async function HotelPage() {
|
|||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
) : null}
|
) : null}
|
||||||
|
<SidePeekProvider>
|
||||||
|
{/* eslint-disable import/no-named-as-default-member */}
|
||||||
|
<SidePeek
|
||||||
|
contentKey={hotelPageParams.amenities[lang]}
|
||||||
|
title={intl.formatMessage({ id: "Amenities" })}
|
||||||
|
>
|
||||||
|
{/* TODO: Render amenities as per the design. */}
|
||||||
|
Read more about the amenities here
|
||||||
|
</SidePeek>
|
||||||
|
<SidePeek
|
||||||
|
contentKey={hotelPageParams.about[lang]}
|
||||||
|
title={intl.formatMessage({ id: "Read more about the hotel" })}
|
||||||
|
>
|
||||||
|
Some additional information about the hotel
|
||||||
|
</SidePeek>
|
||||||
|
<SidePeek
|
||||||
|
contentKey={hotelPageParams.restaurantAndBar[lang]}
|
||||||
|
title={intl.formatMessage({ id: "Restaurant & Bar" })}
|
||||||
|
>
|
||||||
|
{/* TODO */}
|
||||||
|
Restaurant & Bar
|
||||||
|
</SidePeek>
|
||||||
|
<SidePeek
|
||||||
|
contentKey={hotelPageParams.wellnessAndExercise[lang]}
|
||||||
|
title={intl.formatMessage({ id: "Wellness & Exercise" })}
|
||||||
|
>
|
||||||
|
{/* TODO */}
|
||||||
|
Wellness & Exercise
|
||||||
|
</SidePeek>
|
||||||
|
<SidePeek
|
||||||
|
contentKey={hotelPageParams.activities[lang]}
|
||||||
|
title={intl.formatMessage({ id: "Activities" })}
|
||||||
|
>
|
||||||
|
{/* TODO */}
|
||||||
|
Activities
|
||||||
|
</SidePeek>
|
||||||
|
<SidePeek
|
||||||
|
contentKey={hotelPageParams.meetingsAndConferences[lang]}
|
||||||
|
title={intl.formatMessage({ id: "Meetings & Conferences" })}
|
||||||
|
>
|
||||||
|
{/* TODO */}
|
||||||
|
Meetings & Conferences
|
||||||
|
</SidePeek>
|
||||||
|
{/* eslint-enable import/no-named-as-default-member */}
|
||||||
|
</SidePeekProvider>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,12 @@
|
|||||||
padding-bottom: var(--Spacing-x9);
|
padding-bottom: var(--Spacing-x9);
|
||||||
padding-left: var(--Spacing-x0);
|
padding-left: var(--Spacing-x0);
|
||||||
padding-right: var(--Spacing-x0);
|
padding-right: var(--Spacing-x0);
|
||||||
position: relative;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: flex-start;
|
|
||||||
container-name: loyalty-page;
|
container-name: loyalty-page;
|
||||||
container-type: inline-size;
|
container-type: inline-size;
|
||||||
|
max-width: var(--max-width);
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.blocks {
|
.blocks {
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ export default function DatePickerDesktop({
|
|||||||
locale={locale}
|
locale={locale}
|
||||||
mode="range"
|
mode="range"
|
||||||
numberOfMonths={2}
|
numberOfMonths={2}
|
||||||
onSelect={handleOnSelect}
|
onDayClick={handleOnSelect}
|
||||||
pagedNavigation
|
pagedNavigation
|
||||||
required
|
required={false}
|
||||||
selected={selectedDate}
|
selected={selectedDate}
|
||||||
startMonth={currentDate}
|
startMonth={currentDate}
|
||||||
weekStartsOn={1}
|
weekStartsOn={1}
|
||||||
@@ -82,7 +82,7 @@ export default function DatePickerDesktop({
|
|||||||
size="small"
|
size="small"
|
||||||
theme="base"
|
theme="base"
|
||||||
>
|
>
|
||||||
<Caption color="white" textTransform="bold">
|
<Caption color="white" type="bold">
|
||||||
{intl.formatMessage({ id: "Select dates" })}
|
{intl.formatMessage({ id: "Select dates" })}
|
||||||
</Caption>
|
</Caption>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useIntl } from "react-intl"
|
|||||||
import { Lang } from "@/constants/languages"
|
import { Lang } from "@/constants/languages"
|
||||||
import { dt } from "@/lib/dt"
|
import { dt } from "@/lib/dt"
|
||||||
|
|
||||||
import { CloseLarge } from "@/components/Icons"
|
import { CloseLargeIcon } from "@/components/Icons"
|
||||||
import Button from "@/components/TempDesignSystem/Button"
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||||
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||||
@@ -78,7 +78,7 @@ export default function DatePickerMobile({
|
|||||||
mode="range"
|
mode="range"
|
||||||
/** Showing full year or what's left of it */
|
/** Showing full year or what's left of it */
|
||||||
numberOfMonths={12}
|
numberOfMonths={12}
|
||||||
onSelect={handleOnSelect}
|
onDayClick={handleOnSelect}
|
||||||
required
|
required
|
||||||
selected={selectedDate}
|
selected={selectedDate}
|
||||||
startMonth={startMonth}
|
startMonth={startMonth}
|
||||||
@@ -127,7 +127,7 @@ export default function DatePickerMobile({
|
|||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
<button className={styles.close} onClick={close} type="button">
|
<button className={styles.close} onClick={close} type="button">
|
||||||
<CloseLarge />
|
<CloseLargeIcon />
|
||||||
</button>
|
</button>
|
||||||
</header>
|
</header>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ td.rangeStart[aria-selected="true"] button.dayButton:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
td.rangeEnd[aria-selected="true"]:not([data-outside="true"]) button.dayButton,
|
td.rangeEnd[aria-selected="true"]:not([data-outside="true"]) button.dayButton,
|
||||||
td.rangeStart[aria-selected="true"]:not([data-outside="true"])
|
td.rangeStart[aria-selected="true"]:not([data-outside="true"]) button.dayButton,
|
||||||
button.dayButton {
|
td.day[aria-selected="true"] button.dayButton {
|
||||||
background: var(--Primary-Light-On-Surface-Accent);
|
background: var(--Primary-Light-On-Surface-Accent);
|
||||||
border: none;
|
border: none;
|
||||||
color: var(--Base-Button-Inverted-Fill-Normal);
|
color: var(--Base-Button-Inverted-Fill-Normal);
|
||||||
@@ -75,6 +75,7 @@ td.rangeMiddle[aria-selected="true"] button.dayButton {
|
|||||||
background: var(--Base-Background-Primary-Normal);
|
background: var(--Base-Background-Primary-Normal);
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
color: var(--UI-Text-High-contrast);
|
||||||
}
|
}
|
||||||
|
|
||||||
td.day[data-disabled="true"],
|
td.day[data-disabled="true"],
|
||||||
|
|||||||
@@ -113,8 +113,8 @@ td.rangeStart[aria-selected="true"] button.dayButton:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
td.rangeEnd[aria-selected="true"]:not([data-outside="true"]) button.dayButton,
|
td.rangeEnd[aria-selected="true"]:not([data-outside="true"]) button.dayButton,
|
||||||
td.rangeStart[aria-selected="true"]:not([data-outside="true"])
|
td.rangeStart[aria-selected="true"]:not([data-outside="true"]) button.dayButton,
|
||||||
button.dayButton {
|
td.day[aria-selected="true"] button.dayButton {
|
||||||
background: var(--Primary-Light-On-Surface-Accent);
|
background: var(--Primary-Light-On-Surface-Accent);
|
||||||
border: none;
|
border: none;
|
||||||
color: var(--Base-Button-Inverted-Fill-Normal);
|
color: var(--Base-Button-Inverted-Fill-Normal);
|
||||||
@@ -141,6 +141,7 @@ td.rangeMiddle[aria-selected="true"] button.dayButton {
|
|||||||
background: var(--Base-Background-Primary-Normal);
|
background: var(--Base-Background-Primary-Normal);
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
color: var(--UI-Text-High-contrast);
|
||||||
}
|
}
|
||||||
|
|
||||||
td.day[data-disabled="true"],
|
td.day[data-disabled="true"],
|
||||||
|
|||||||
@@ -22,6 +22,11 @@
|
|||||||
|
|
||||||
.hideWrapper {
|
.hideWrapper {
|
||||||
background-color: var(--Main-Grey-White);
|
background-color: var(--Main-Grey-White);
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container[data-isopen="true"] .hideWrapper {
|
||||||
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 1366px) {
|
@media screen and (max-width: 1366px) {
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ import DatePickerMobile from "./Screen/Mobile"
|
|||||||
|
|
||||||
import styles from "./date-picker.module.css"
|
import styles from "./date-picker.module.css"
|
||||||
|
|
||||||
import type { DateRange } from "react-day-picker"
|
|
||||||
|
|
||||||
import type { DatePickerFormProps } from "@/types/components/datepicker"
|
import type { DatePickerFormProps } from "@/types/components/datepicker"
|
||||||
|
|
||||||
const locales = {
|
const locales = {
|
||||||
@@ -33,6 +31,8 @@ export default function DatePickerForm({ name = "date" }: DatePickerFormProps) {
|
|||||||
const { register, setValue } = useFormContext()
|
const { register, setValue } = useFormContext()
|
||||||
const ref = useRef<HTMLDivElement | null>(null)
|
const ref = useRef<HTMLDivElement | null>(null)
|
||||||
|
|
||||||
|
const [isSelectingFrom, setIsSelectingFrom] = useState(true)
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
setIsOpen(false)
|
setIsOpen(false)
|
||||||
}
|
}
|
||||||
@@ -41,11 +41,29 @@ export default function DatePickerForm({ name = "date" }: DatePickerFormProps) {
|
|||||||
setIsOpen((prevIsOpen) => !prevIsOpen)
|
setIsOpen((prevIsOpen) => !prevIsOpen)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSelectDate(selected: DateRange) {
|
function handleSelectDate(selected: Date) {
|
||||||
setValue(name, {
|
if (isSelectingFrom) {
|
||||||
from: dt(selected.from).format("YYYY-MM-DD"),
|
setValue(name, {
|
||||||
to: dt(selected.to).format("YYYY-MM-DD"),
|
from: dt(selected).format("YYYY-MM-DD"),
|
||||||
})
|
to: undefined,
|
||||||
|
})
|
||||||
|
setIsSelectingFrom(false)
|
||||||
|
} else {
|
||||||
|
const fromDate = dt(selectedDate.from)
|
||||||
|
const toDate = dt(selected)
|
||||||
|
if (toDate.isAfter(fromDate)) {
|
||||||
|
setValue(name, {
|
||||||
|
from: selectedDate.from,
|
||||||
|
to: toDate.format("YYYY-MM-DD"),
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
setValue(name, {
|
||||||
|
from: toDate.format("YYYY-MM-DD"),
|
||||||
|
to: selectedDate.from,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
setIsSelectingFrom(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -64,7 +82,9 @@ export default function DatePickerForm({ name = "date" }: DatePickerFormProps) {
|
|||||||
const selectedFromDate = dt(selectedDate.from)
|
const selectedFromDate = dt(selectedDate.from)
|
||||||
.locale(lang)
|
.locale(lang)
|
||||||
.format("ddd D MMM")
|
.format("ddd D MMM")
|
||||||
const selectedToDate = dt(selectedDate.to).locale(lang).format("ddd D MMM")
|
const selectedToDate = !!selectedDate.to
|
||||||
|
? dt(selectedDate.to).locale(lang).format("ddd D MMM")
|
||||||
|
: ""
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container} data-isopen={isOpen} ref={ref}>
|
<div className={styles.container} data-isopen={isOpen} ref={ref}>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export default function FooterMainNav({ mainLinks }: FooterMainNavProps) {
|
|||||||
color="burgundy"
|
color="burgundy"
|
||||||
href={link.url}
|
href={link.url}
|
||||||
className={styles.mainNavigationLink}
|
className={styles.mainNavigationLink}
|
||||||
|
target={link.openInNewTab ? "_blank" : undefined}
|
||||||
>
|
>
|
||||||
{link.title}
|
{link.title}
|
||||||
|
|
||||||
|
|||||||
@@ -56,26 +56,13 @@ export default function FooterSecondaryNav({
|
|||||||
<ul className={styles.secondaryNavigationList}>
|
<ul className={styles.secondaryNavigationList}>
|
||||||
{link?.links?.map((link) => (
|
{link?.links?.map((link) => (
|
||||||
<li key={link.title} className={styles.secondaryNavigationItem}>
|
<li key={link.title} className={styles.secondaryNavigationItem}>
|
||||||
{link.isExternal ? (
|
<Link
|
||||||
<a
|
href={link.url}
|
||||||
href={link.url}
|
target={link.openInNewTab ? "_blank" : undefined}
|
||||||
key={link.title}
|
color="burgundy"
|
||||||
target={link.openInNewTab ? "_blank" : "_self"}
|
>
|
||||||
aria-label={link.title}
|
{link.title}
|
||||||
className={styles.secondaryNavigationLink}
|
</Link>
|
||||||
>
|
|
||||||
{link.title}
|
|
||||||
</a>
|
|
||||||
) : (
|
|
||||||
<Link
|
|
||||||
href={link.url}
|
|
||||||
key={link.title}
|
|
||||||
target={link.openInNewTab ? "_blank" : "_self"}
|
|
||||||
color="burgundy"
|
|
||||||
>
|
|
||||||
{link.title}
|
|
||||||
</Link>
|
|
||||||
)}
|
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default function ClearSearchButton({
|
|||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
<DeleteIcon color="burgundy" height={20} width={20} />
|
<DeleteIcon color="burgundy" height={20} width={20} />
|
||||||
<Caption color="burgundy" textTransform="bold">
|
<Caption color="burgundy" type="bold">
|
||||||
{intl.formatMessage({ id: "Clear searches" })}
|
{intl.formatMessage({ id: "Clear searches" })}
|
||||||
</Caption>
|
</Caption>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,23 +1,18 @@
|
|||||||
.dialog {
|
.dialog {
|
||||||
background-color: var(--Base-Surface-Primary-light-Normal);
|
background-color: var(--Base-Surface-Primary-light-Normal);
|
||||||
border-radius: var(--Corner-radius-Large);
|
border-radius: var(--Corner-radius-Large);
|
||||||
box-shadow: 0 0 14px 6px rgba(0, 0, 0, 0.1);
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
left: 0;
|
left: 0;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
max-height: 380px;
|
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: var(--Spacing-x2) var(--Spacing-x3);
|
padding: var(--Spacing-x2) var(--Spacing-x3);
|
||||||
position: absolute;
|
position: fixed;
|
||||||
/**
|
top: 170px;
|
||||||
* var(--Spacing-x4) to account for padding inside
|
width: 100%;
|
||||||
* the bookingwidget and to add the padding for the
|
height: calc(100% - 200px);
|
||||||
* box itself
|
z-index: 10010;
|
||||||
*/
|
|
||||||
top: calc(100% + var(--Spacing-x4));
|
|
||||||
width: 360px;
|
|
||||||
z-index: 99;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.default {
|
.default {
|
||||||
@@ -31,3 +26,20 @@
|
|||||||
.search {
|
.search {
|
||||||
gap: var(--Spacing-x3);
|
gap: var(--Spacing-x3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.dialog {
|
||||||
|
position: absolute;
|
||||||
|
width: 360px;
|
||||||
|
/**
|
||||||
|
* var(--Spacing-x4) to account for padding inside
|
||||||
|
* the bookingwidget and to add the padding for the
|
||||||
|
* box itself
|
||||||
|
*/
|
||||||
|
top: calc(100% + var(--Spacing-x4));
|
||||||
|
z-index: 99;
|
||||||
|
box-shadow: 0 0 14px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
max-height: 380px;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import {
|
|||||||
import { useFormContext, useWatch } from "react-hook-form"
|
import { useFormContext, useWatch } from "react-hook-form"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
|
||||||
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||||
|
|
||||||
import Input from "../Input"
|
import Input from "../Input"
|
||||||
@@ -49,15 +48,6 @@ export default function Search({ locations }: SearchProps) {
|
|||||||
dispatch({ type: ActionType.CLEAR_HISTORY_LOCATIONS })
|
dispatch({ type: ActionType.CLEAR_HISTORY_LOCATIONS })
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleOnBlur() {
|
|
||||||
if (!value && state.searchData?.name) {
|
|
||||||
setValue(name, state.searchData.name)
|
|
||||||
// Always need to manually trigger
|
|
||||||
// revalidation when setting value r-h-f
|
|
||||||
trigger()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleOnChange(
|
function handleOnChange(
|
||||||
evt: FormEvent<HTMLInputElement> | ChangeEvent<HTMLInputElement>
|
evt: FormEvent<HTMLInputElement> | ChangeEvent<HTMLInputElement>
|
||||||
) {
|
) {
|
||||||
@@ -139,7 +129,9 @@ export default function Search({ locations }: SearchProps) {
|
|||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<label {...getLabelProps({ htmlFor: name })} className={styles.label}>
|
<label {...getLabelProps({ htmlFor: name })} className={styles.label}>
|
||||||
<Caption color={isOpen ? "uiTextActive" : "red"}>
|
<Caption color={isOpen ? "uiTextActive" : "red"}>
|
||||||
{intl.formatMessage({ id: "Where to" })}
|
{state.searchData?.type === "hotels"
|
||||||
|
? state.searchData?.relationships?.city?.name
|
||||||
|
: intl.formatMessage({ id: "Where to" })}
|
||||||
</Caption>
|
</Caption>
|
||||||
</label>
|
</label>
|
||||||
<div {...getRootProps({}, { suppressRefError: true })}>
|
<div {...getRootProps({}, { suppressRefError: true })}>
|
||||||
@@ -155,7 +147,6 @@ export default function Search({ locations }: SearchProps) {
|
|||||||
}),
|
}),
|
||||||
...register(name, {
|
...register(name, {
|
||||||
onBlur: function () {
|
onBlur: function () {
|
||||||
handleOnBlur()
|
|
||||||
closeMenu()
|
closeMenu()
|
||||||
},
|
},
|
||||||
onChange: handleOnChange,
|
onChange: handleOnChange,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-radius: var(--Corner-radius-Small);
|
border-radius: var(--Corner-radius-Small);
|
||||||
padding: var(--Spacing-x1) var(--Spacing-x-one-and-half);
|
padding: var(--Spacing-x1) var(--Spacing-x-one-and-half);
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container:hover,
|
.container:hover,
|
||||||
@@ -23,8 +24,3 @@
|
|||||||
p {
|
p {
|
||||||
color: var(--UI-Text-Active);
|
color: var(--UI-Text-Active);
|
||||||
}
|
}
|
||||||
|
|
||||||
.container:hover:has(input:not(:active, :focus, :focus-within))
|
|
||||||
input::-webkit-search-cancel-button {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import Body from "@/components/TempDesignSystem/Text/Body"
|
import Checkbox from "@/components/TempDesignSystem/Form/Checkbox"
|
||||||
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||||
import { Tooltip } from "@/components/TempDesignSystem/Tooltip"
|
import { Tooltip } from "@/components/TempDesignSystem/Tooltip"
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ export default function Voucher() {
|
|||||||
>
|
>
|
||||||
<div className={styles.vouchers}>
|
<div className={styles.vouchers}>
|
||||||
<label>
|
<label>
|
||||||
<Caption color="disabled" textTransform="bold">
|
<Caption color="disabled" type="bold">
|
||||||
{vouchers}
|
{vouchers}
|
||||||
</Caption>
|
</Caption>
|
||||||
{/* <InfoCircleIcon color="white" className={styles.infoIcon} /> Out of scope for this release */}
|
{/* <InfoCircleIcon color="white" className={styles.infoIcon} /> Out of scope for this release */}
|
||||||
@@ -50,17 +50,17 @@ export default function Voucher() {
|
|||||||
>
|
>
|
||||||
<div className={styles.options}>
|
<div className={styles.options}>
|
||||||
<label className={`${styles.option} ${styles.checkboxVoucher}`}>
|
<label className={`${styles.option} ${styles.checkboxVoucher}`}>
|
||||||
<input type="checkbox" disabled className={styles.checkbox} />
|
<Checkbox name="useVouchers" registerOptions={{ disabled: true }} />
|
||||||
<Caption color="disabled">{useVouchers}</Caption>
|
<Caption color="disabled">{useVouchers}</Caption>
|
||||||
{/* <InfoCircleIcon color="white" className={styles.infoIcon} /> Out of scope for this release */}
|
{/* <InfoCircleIcon color="white" className={styles.infoIcon} /> Out of scope for this release */}
|
||||||
</label>
|
</label>
|
||||||
<label className={styles.option}>
|
<label className={styles.option}>
|
||||||
<input type="checkbox" disabled className={styles.checkbox} />
|
<Checkbox name="useBonus" registerOptions={{ disabled: true }} />
|
||||||
<Caption color="disabled">{bonus}</Caption>
|
<Caption color="disabled">{bonus}</Caption>
|
||||||
{/* <InfoCircleIcon color="white" className={styles.infoIcon} /> Out of scope for this release */}
|
{/* <InfoCircleIcon color="white" className={styles.infoIcon} /> Out of scope for this release */}
|
||||||
</label>
|
</label>
|
||||||
<label className={styles.option}>
|
<label className={styles.option}>
|
||||||
<input type="checkbox" disabled className={styles.checkbox} />
|
<Checkbox name="useReward" registerOptions={{ disabled: true }} />
|
||||||
<Caption color="disabled">{reward}</Caption>
|
<Caption color="disabled">{reward}</Caption>
|
||||||
{/* <InfoCircleIcon color="white" className={styles.infoIcon} /> Out of scope for this release */}
|
{/* <InfoCircleIcon color="white" className={styles.infoIcon} /> Out of scope for this release */}
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
@@ -32,6 +32,10 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.infoIcon {
|
||||||
|
stroke: var(--Base-Text-Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 768px) {
|
@media screen and (min-width: 768px) {
|
||||||
.vouchers {
|
.vouchers {
|
||||||
display: none;
|
display: none;
|
||||||
@@ -64,7 +68,7 @@
|
|||||||
.options {
|
.options {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
max-width: 190px;
|
max-width: 190px;
|
||||||
gap: 0;
|
gap: var(--Spacing-x-half);
|
||||||
}
|
}
|
||||||
.vouchers:hover,
|
.vouchers:hover,
|
||||||
.option:hover {
|
.option:hover {
|
||||||
@@ -72,6 +76,7 @@
|
|||||||
}
|
}
|
||||||
.optionsContainer {
|
.optionsContainer {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
.checkboxVoucher {
|
.checkboxVoucher {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
@@ -1,7 +1,3 @@
|
|||||||
.infoIcon {
|
|
||||||
stroke: var(--Base-Text-Disabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
.vouchersHeader {
|
.vouchersHeader {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: var(--Spacing-x-one-and-half);
|
gap: var(--Spacing-x-one-and-half);
|
||||||
@@ -79,8 +75,10 @@
|
|||||||
padding: var(--Spacing-x1) var(--Spacing-x-one-and-half);
|
padding: var(--Spacing-x1) var(--Spacing-x-one-and-half);
|
||||||
border-radius: var(--Corner-radius-Small);
|
border-radius: var(--Corner-radius-Small);
|
||||||
}
|
}
|
||||||
|
|
||||||
.when:hover,
|
.when:hover,
|
||||||
.rooms:hover,
|
.rooms:hover,
|
||||||
|
.when:has([data-isopen="true"]),
|
||||||
.rooms:has(.input:active, .input:focus, .input:focus-within) {
|
.rooms:has(.input:active, .input:focus, .input:focus-within) {
|
||||||
background-color: var(--Base-Surface-Primary-light-Hover-alt);
|
background-color: var(--Base-Surface-Primary-light-Hover-alt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
import { useState } from "react"
|
||||||
import { useWatch } from "react-hook-form"
|
import { useWatch } from "react-hook-form"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import { dt } from "@/lib/dt"
|
import { dt } from "@/lib/dt"
|
||||||
|
|
||||||
import DatePicker from "@/components/DatePicker"
|
import DatePicker from "@/components/DatePicker"
|
||||||
|
import GuestsRoomsPickerForm from "@/components/GuestsRoomsPicker"
|
||||||
import { SearchIcon } from "@/components/Icons"
|
import { SearchIcon } from "@/components/Icons"
|
||||||
import Button from "@/components/TempDesignSystem/Button"
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||||
|
|
||||||
import Input from "./Input"
|
|
||||||
import Search from "./Search"
|
import Search from "./Search"
|
||||||
import Voucher from "./Voucher"
|
import Voucher from "./Voucher"
|
||||||
|
|
||||||
@@ -20,7 +21,6 @@ import type { BookingWidgetFormContentProps } from "@/types/components/form/book
|
|||||||
export default function FormContent({
|
export default function FormContent({
|
||||||
locations,
|
locations,
|
||||||
formId,
|
formId,
|
||||||
formState,
|
|
||||||
}: BookingWidgetFormContentProps) {
|
}: BookingWidgetFormContentProps) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const selectedDate = useWatch({ name: "date" })
|
const selectedDate = useWatch({ name: "date" })
|
||||||
@@ -37,21 +37,21 @@ export default function FormContent({
|
|||||||
<Search locations={locations} />
|
<Search locations={locations} />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.when}>
|
<div className={styles.when}>
|
||||||
<Caption color="red" textTransform="bold">
|
<Caption color="red" type="bold">
|
||||||
{intl.formatMessage(
|
{intl.formatMessage(
|
||||||
{ id: "booking.nights" },
|
{ id: "booking.nights" },
|
||||||
{ totalNights: nights }
|
{ totalNights: nights > 0 ? nights : 0 }
|
||||||
)}
|
)}
|
||||||
</Caption>
|
</Caption>
|
||||||
<DatePicker />
|
<DatePicker />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.rooms}>
|
<div className={styles.rooms}>
|
||||||
<label>
|
<label>
|
||||||
<Caption color="red" textTransform="bold">
|
<Caption color="red" type="bold">
|
||||||
{rooms}
|
{rooms}
|
||||||
</Caption>
|
</Caption>
|
||||||
</label>
|
</label>
|
||||||
<Input type="text" placeholder={rooms} />
|
<GuestsRoomsPickerForm />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.voucherContainer}>
|
<div className={styles.voucherContainer}>
|
||||||
@@ -60,17 +60,12 @@ export default function FormContent({
|
|||||||
<div className={styles.buttonContainer}>
|
<div className={styles.buttonContainer}>
|
||||||
<Button
|
<Button
|
||||||
className={styles.button}
|
className={styles.button}
|
||||||
disabled={!formState.isValid}
|
|
||||||
form={formId}
|
form={formId}
|
||||||
intent="primary"
|
intent="primary"
|
||||||
theme="base"
|
theme="base"
|
||||||
type="submit"
|
type="submit"
|
||||||
>
|
>
|
||||||
<Caption
|
<Caption color="white" type="bold" className={styles.buttonText}>
|
||||||
color="white"
|
|
||||||
textTransform="bold"
|
|
||||||
className={styles.buttonText}
|
|
||||||
>
|
|
||||||
{intl.formatMessage({ id: "Search" })}
|
{intl.formatMessage({ id: "Search" })}
|
||||||
</Caption>
|
</Caption>
|
||||||
<div className={styles.icon}>
|
<div className={styles.icon}>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
@media screen and (min-width: 768px) {
|
@media screen and (min-width: 768px) {
|
||||||
.section {
|
.section {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.default {
|
.default {
|
||||||
@@ -35,6 +36,13 @@
|
|||||||
var(--Spacing-x-one-and-half) var(--Spacing-x1);
|
var(--Spacing-x-one-and-half) var(--Spacing-x1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
width: min(
|
||||||
|
calc(100dvw - (var(--Spacing-x2) * 2)),
|
||||||
|
var(--max-width-navigation)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
.full {
|
.full {
|
||||||
padding: var(--Spacing-x1) 0;
|
padding: var(--Spacing-x1) 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
import { useRouter } from "next/navigation"
|
import { useRouter } from "next/navigation"
|
||||||
import { useFormContext } from "react-hook-form"
|
import { useFormContext } from "react-hook-form"
|
||||||
|
|
||||||
|
import { selectHotel, selectRate } from "@/constants/routes/hotelReservation"
|
||||||
|
|
||||||
|
import useLang from "@/hooks/useLang"
|
||||||
|
|
||||||
import FormContent from "./FormContent"
|
import FormContent from "./FormContent"
|
||||||
import { bookingWidgetVariants } from "./variants"
|
import { bookingWidgetVariants } from "./variants"
|
||||||
|
|
||||||
@@ -9,11 +13,13 @@ import styles from "./form.module.css"
|
|||||||
|
|
||||||
import type { BookingWidgetSchema } from "@/types/components/bookingWidget"
|
import type { BookingWidgetSchema } from "@/types/components/bookingWidget"
|
||||||
import type { BookingWidgetFormProps } from "@/types/components/form/bookingwidget"
|
import type { BookingWidgetFormProps } from "@/types/components/form/bookingwidget"
|
||||||
|
import { Location } from "@/types/trpc/routers/hotel/locations"
|
||||||
|
|
||||||
const formId = "booking-widget"
|
const formId = "booking-widget"
|
||||||
|
|
||||||
export default function Form({ locations, type }: BookingWidgetFormProps) {
|
export default function Form({ locations, type }: BookingWidgetFormProps) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const lang = useLang()
|
||||||
|
|
||||||
const classNames = bookingWidgetVariants({
|
const classNames = bookingWidgetVariants({
|
||||||
type,
|
type,
|
||||||
@@ -23,11 +29,32 @@ export default function Form({ locations, type }: BookingWidgetFormProps) {
|
|||||||
useFormContext<BookingWidgetSchema>()
|
useFormContext<BookingWidgetSchema>()
|
||||||
|
|
||||||
function onSubmit(data: BookingWidgetSchema) {
|
function onSubmit(data: BookingWidgetSchema) {
|
||||||
data.location = JSON.parse(decodeURIComponent(data.location))
|
const locationData: Location = JSON.parse(decodeURIComponent(data.location))
|
||||||
console.log(data)
|
|
||||||
// TODO: Parse data and route accordignly to Select hotel or select room-rate page
|
const bookingFlowPage =
|
||||||
console.log("to be routing")
|
locationData.type == "cities" ? selectHotel[lang] : selectRate[lang]
|
||||||
router.push("/en/hotelreservation/select-hotel")
|
const bookingWidgetParams = new URLSearchParams(data.date)
|
||||||
|
|
||||||
|
if (locationData.type == "cities")
|
||||||
|
bookingWidgetParams.set("city", locationData.name)
|
||||||
|
else bookingWidgetParams.set("hotel", locationData.operaId || "")
|
||||||
|
|
||||||
|
data.rooms.forEach((room, index) => {
|
||||||
|
bookingWidgetParams.set(`room[${index}].adults`, room.adults.toString())
|
||||||
|
|
||||||
|
room.children.forEach((child, childIndex) => {
|
||||||
|
bookingWidgetParams.set(
|
||||||
|
`room[${index}].child[${childIndex}].age`,
|
||||||
|
child.age.toString()
|
||||||
|
)
|
||||||
|
bookingWidgetParams.set(
|
||||||
|
`room[${index}].child[${childIndex}].bed`,
|
||||||
|
child.bed.toString()
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
router.push(`${bookingFlowPage}?${bookingWidgetParams.toString()}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -2,6 +2,18 @@ import { z } from "zod"
|
|||||||
|
|
||||||
import type { Location } from "@/types/trpc/routers/hotel/locations"
|
import type { Location } from "@/types/trpc/routers/hotel/locations"
|
||||||
|
|
||||||
|
export const guestRoomSchema = z.object({
|
||||||
|
adults: z.number().default(1),
|
||||||
|
children: z.array(
|
||||||
|
z.object({
|
||||||
|
age: z.number().nonnegative(),
|
||||||
|
bed: z.number(),
|
||||||
|
})
|
||||||
|
),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const guestRoomsSchema = z.array(guestRoomSchema)
|
||||||
|
|
||||||
export const bookingWidgetSchema = z.object({
|
export const bookingWidgetSchema = z.object({
|
||||||
bookingCode: z.string(), // Update this as required when working with booking codes component
|
bookingCode: z.string(), // Update this as required when working with booking codes component
|
||||||
date: z.object({
|
date: z.object({
|
||||||
@@ -25,18 +37,7 @@ export const bookingWidgetSchema = z.object({
|
|||||||
{ message: "Required" }
|
{ message: "Required" }
|
||||||
),
|
),
|
||||||
redemption: z.boolean().default(false),
|
redemption: z.boolean().default(false),
|
||||||
rooms: z.array(
|
rooms: guestRoomsSchema,
|
||||||
// This will be updated when working in guests component
|
|
||||||
z.object({
|
|
||||||
adults: z.number().default(1),
|
|
||||||
children: z.array(
|
|
||||||
z.object({
|
|
||||||
age: z.number(),
|
|
||||||
bed: z.number(),
|
|
||||||
})
|
|
||||||
),
|
|
||||||
})
|
|
||||||
),
|
|
||||||
search: z.string({ coerce: true }).min(1, "Required"),
|
search: z.string({ coerce: true }).min(1, "Required"),
|
||||||
voucher: z.boolean().default(false),
|
voucher: z.boolean().default(false),
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export default function FormContent() {
|
|||||||
const email = `${intl.formatMessage({ id: "Email" })} ${intl.formatMessage({ id: "Address" }).toLowerCase()}`
|
const email = `${intl.formatMessage({ id: "Email" })} ${intl.formatMessage({ id: "Address" }).toLowerCase()}`
|
||||||
const street = intl.formatMessage({ id: "Address" })
|
const street = intl.formatMessage({ id: "Address" })
|
||||||
const phoneNumber = intl.formatMessage({ id: "Phone number" })
|
const phoneNumber = intl.formatMessage({ id: "Phone number" })
|
||||||
const password = intl.formatMessage({ id: "Current password" })
|
const currentPassword = intl.formatMessage({ id: "Current password" })
|
||||||
const retypeNewPassword = intl.formatMessage({ id: "Retype new password" })
|
const retypeNewPassword = intl.formatMessage({ id: "Retype new password" })
|
||||||
const zipCode = intl.formatMessage({ id: "Zip code" })
|
const zipCode = intl.formatMessage({ id: "Zip code" })
|
||||||
|
|
||||||
@@ -72,8 +72,10 @@ export default function FormContent() {
|
|||||||
{intl.formatMessage({ id: "Password" })}
|
{intl.formatMessage({ id: "Password" })}
|
||||||
</Body>
|
</Body>
|
||||||
</header>
|
</header>
|
||||||
<Input label={password} name="password" type="password" />
|
<Input label={currentPassword} name="password" type="password" />
|
||||||
<NewPassword />
|
{/* visibilityToggleable set to false as feature is done for signup first */}
|
||||||
|
{/* likely we can remove the prop altogether once signup launches */}
|
||||||
|
<NewPassword visibilityToggleable={false} />
|
||||||
<Input
|
<Input
|
||||||
label={retypeNewPassword}
|
label={retypeNewPassword}
|
||||||
name="retypeNewPassword"
|
name="retypeNewPassword"
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export const editProfileSchema = z
|
|||||||
),
|
),
|
||||||
|
|
||||||
password: z.string().optional(),
|
password: z.string().optional(),
|
||||||
newPassword: passwordValidator(),
|
newPassword: z.literal("").optional().or(passwordValidator()),
|
||||||
retypeNewPassword: z.string().optional(),
|
retypeNewPassword: z.string().optional(),
|
||||||
})
|
})
|
||||||
.superRefine((data, ctx) => {
|
.superRefine((data, ctx) => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod"
|
|||||||
import { FormProvider, useForm } from "react-hook-form"
|
import { FormProvider, useForm } from "react-hook-form"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
import { signupTerms } from "@/constants/routes/signup"
|
import { privacyPolicy } from "@/constants/currentWebHrefs"
|
||||||
|
|
||||||
import { registerUser } from "@/actions/registerUser"
|
import { registerUser } from "@/actions/registerUser"
|
||||||
import Button from "@/components/TempDesignSystem/Button"
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
@@ -107,7 +107,7 @@ export default function Form({ link, subtitle, title }: RegisterFormProps) {
|
|||||||
</div>
|
</div>
|
||||||
<div className={styles.dateField}>
|
<div className={styles.dateField}>
|
||||||
<header>
|
<header>
|
||||||
<Caption textTransform="bold">
|
<Caption type="bold">
|
||||||
{intl.formatMessage({ id: "Birth date" })}
|
{intl.formatMessage({ id: "Birth date" })}
|
||||||
</Caption>
|
</Caption>
|
||||||
</header>
|
</header>
|
||||||
@@ -163,7 +163,7 @@ export default function Form({ link, subtitle, title }: RegisterFormProps) {
|
|||||||
variant="underscored"
|
variant="underscored"
|
||||||
color="peach80"
|
color="peach80"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href={signupTerms[lang]}
|
href={privacyPolicy[lang]}
|
||||||
>
|
>
|
||||||
{intl.formatMessage({ id: "Scandic's Privacy Policy." })}
|
{intl.formatMessage({ id: "Scandic's Privacy Policy." })}
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
75
components/GuestsRoomsPicker/AdultSelector/index.tsx
Normal file
75
components/GuestsRoomsPicker/AdultSelector/index.tsx
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import { useFormContext } from "react-hook-form"
|
||||||
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useGuestsRoomsStore } from "@/stores/guests-rooms"
|
||||||
|
|
||||||
|
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||||
|
|
||||||
|
import Counter from "../Counter"
|
||||||
|
|
||||||
|
import styles from "./adult-selector.module.css"
|
||||||
|
|
||||||
|
import { BedTypeEnum } from "@/types/components/bookingWidget/enums"
|
||||||
|
import {
|
||||||
|
AdultSelectorProps,
|
||||||
|
Child,
|
||||||
|
} from "@/types/components/bookingWidget/guestsRoomsPicker"
|
||||||
|
|
||||||
|
export default function AdultSelector({ roomIndex = 0 }: AdultSelectorProps) {
|
||||||
|
const intl = useIntl()
|
||||||
|
const adultsLabel = intl.formatMessage({ id: "Adults" })
|
||||||
|
const { setValue } = useFormContext()
|
||||||
|
const { adults, children, childrenInAdultsBed } = useGuestsRoomsStore(
|
||||||
|
(state) => state.rooms[roomIndex]
|
||||||
|
)
|
||||||
|
const increaseAdults = useGuestsRoomsStore((state) => state.increaseAdults)
|
||||||
|
const decreaseAdults = useGuestsRoomsStore((state) => state.decreaseAdults)
|
||||||
|
|
||||||
|
function increaseAdultsCount(roomIndex: number) {
|
||||||
|
if (adults < 6) {
|
||||||
|
increaseAdults(roomIndex)
|
||||||
|
setValue(`rooms.${roomIndex}.adults`, adults + 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function decreaseAdultsCount(roomIndex: number) {
|
||||||
|
if (adults > 1) {
|
||||||
|
decreaseAdults(roomIndex)
|
||||||
|
setValue(`rooms.${roomIndex}.adults`, adults - 1)
|
||||||
|
if (childrenInAdultsBed > adults) {
|
||||||
|
const toUpdateIndex = children.findIndex(
|
||||||
|
(child: Child) => child.bed == BedTypeEnum.IN_ADULTS_BED
|
||||||
|
)
|
||||||
|
if (toUpdateIndex != -1) {
|
||||||
|
setValue(
|
||||||
|
`rooms.${roomIndex}.children.${toUpdateIndex}.bed`,
|
||||||
|
children[toUpdateIndex].age < 3
|
||||||
|
? BedTypeEnum.IN_CRIB
|
||||||
|
: BedTypeEnum.IN_EXTRA_BED
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section className={styles.container}>
|
||||||
|
<Caption color="uiTextHighContrast" type="bold">
|
||||||
|
{adultsLabel}
|
||||||
|
</Caption>
|
||||||
|
<Counter
|
||||||
|
count={adults}
|
||||||
|
handleOnDecrease={() => {
|
||||||
|
decreaseAdultsCount(roomIndex)
|
||||||
|
}}
|
||||||
|
handleOnIncrease={() => {
|
||||||
|
increaseAdultsCount(roomIndex)
|
||||||
|
}}
|
||||||
|
disableDecrease={adults == 1}
|
||||||
|
disableIncrease={adults == 6}
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
140
components/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx
Normal file
140
components/GuestsRoomsPicker/ChildSelector/ChildInfoSelector.tsx
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import { useFormContext } from "react-hook-form"
|
||||||
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useGuestsRoomsStore } from "@/stores/guests-rooms"
|
||||||
|
|
||||||
|
import { ErrorCircleIcon } from "@/components/Icons"
|
||||||
|
import Select from "@/components/TempDesignSystem/Select"
|
||||||
|
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||||
|
|
||||||
|
import styles from "./child-selector.module.css"
|
||||||
|
|
||||||
|
import { BedTypeEnum } from "@/types/components/bookingWidget/enums"
|
||||||
|
import {
|
||||||
|
ChildBed,
|
||||||
|
ChildInfoSelectorProps,
|
||||||
|
} from "@/types/components/bookingWidget/guestsRoomsPicker"
|
||||||
|
|
||||||
|
export default function ChildInfoSelector({
|
||||||
|
child = { age: -1, bed: -1 },
|
||||||
|
index = 0,
|
||||||
|
roomIndex = 0,
|
||||||
|
}: ChildInfoSelectorProps) {
|
||||||
|
const intl = useIntl()
|
||||||
|
const ageLabel = intl.formatMessage({ id: "Age" })
|
||||||
|
const ageReqdErrMsg = intl.formatMessage({ id: "Child age is required" })
|
||||||
|
const bedLabel = intl.formatMessage({ id: "Bed" })
|
||||||
|
const { setValue, trigger } = useFormContext()
|
||||||
|
const { adults, childrenInAdultsBed } = useGuestsRoomsStore(
|
||||||
|
(state) => state.rooms[roomIndex]
|
||||||
|
)
|
||||||
|
const {
|
||||||
|
isValidated,
|
||||||
|
updateChildAge,
|
||||||
|
updateChildBed,
|
||||||
|
increaseChildInAdultsBed,
|
||||||
|
decreaseChildInAdultsBed,
|
||||||
|
} = useGuestsRoomsStore((state) => ({
|
||||||
|
isValidated: state.isValidated,
|
||||||
|
updateChildAge: state.updateChildAge,
|
||||||
|
updateChildBed: state.updateChildBed,
|
||||||
|
increaseChildInAdultsBed: state.increaseChildInAdultsBed,
|
||||||
|
decreaseChildInAdultsBed: state.decreaseChildInAdultsBed,
|
||||||
|
}))
|
||||||
|
|
||||||
|
const ageList = Array.from(Array(13).keys()).map((age) => ({
|
||||||
|
label: `${age}`,
|
||||||
|
value: age,
|
||||||
|
}))
|
||||||
|
|
||||||
|
function updateSelectedAge(age: number) {
|
||||||
|
updateChildAge(age, roomIndex, index)
|
||||||
|
setValue(`rooms.${roomIndex}.children.${index}.age`, age)
|
||||||
|
const availableBedTypes = getAvailableBeds(age)
|
||||||
|
updateSelectedBed(availableBedTypes[0].value)
|
||||||
|
trigger("rooms")
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSelectedBed(bed: number) {
|
||||||
|
if (bed == BedTypeEnum.IN_ADULTS_BED) {
|
||||||
|
increaseChildInAdultsBed(roomIndex)
|
||||||
|
} else if (child.bed == BedTypeEnum.IN_ADULTS_BED) {
|
||||||
|
decreaseChildInAdultsBed(roomIndex)
|
||||||
|
}
|
||||||
|
updateChildBed(bed, roomIndex, index)
|
||||||
|
setValue(`rooms.${roomIndex}.children.${index}.bed`, bed)
|
||||||
|
}
|
||||||
|
|
||||||
|
const allBedTypes: ChildBed[] = [
|
||||||
|
{
|
||||||
|
label: intl.formatMessage({ id: "In adults bed" }),
|
||||||
|
value: BedTypeEnum.IN_ADULTS_BED,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: intl.formatMessage({ id: "In crib" }),
|
||||||
|
value: BedTypeEnum.IN_CRIB,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: intl.formatMessage({ id: "In extra bed" }),
|
||||||
|
value: BedTypeEnum.IN_EXTRA_BED,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
function getAvailableBeds(age: number) {
|
||||||
|
let availableBedTypes: ChildBed[] = []
|
||||||
|
if (age <= 5 && (adults > childrenInAdultsBed || child.bed === 0)) {
|
||||||
|
availableBedTypes.push(allBedTypes[0])
|
||||||
|
}
|
||||||
|
if (age < 3) {
|
||||||
|
availableBedTypes.push(allBedTypes[1])
|
||||||
|
}
|
||||||
|
if (age > 2) {
|
||||||
|
availableBedTypes.push(allBedTypes[2])
|
||||||
|
}
|
||||||
|
return availableBedTypes
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div key={index} className={styles.childInfoContainer}>
|
||||||
|
<div>
|
||||||
|
<Select
|
||||||
|
required={true}
|
||||||
|
items={ageList}
|
||||||
|
label={ageLabel}
|
||||||
|
aria-label={ageLabel}
|
||||||
|
value={child.age}
|
||||||
|
onSelect={(key) => {
|
||||||
|
updateSelectedAge(key as number)
|
||||||
|
}}
|
||||||
|
name={`rooms.${roomIndex}.children.${index}.age`}
|
||||||
|
placeholder={ageLabel}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{child.age !== -1 ? (
|
||||||
|
<Select
|
||||||
|
items={getAvailableBeds(child.age)}
|
||||||
|
label={bedLabel}
|
||||||
|
aria-label={bedLabel}
|
||||||
|
value={child.bed}
|
||||||
|
onSelect={(key) => {
|
||||||
|
updateSelectedBed(key as number)
|
||||||
|
}}
|
||||||
|
name={`rooms.${roomIndex}.children.${index}.age`}
|
||||||
|
placeholder={bedLabel}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{isValidated && child.age < 0 ? (
|
||||||
|
<Caption color="red" className={styles.error}>
|
||||||
|
<ErrorCircleIcon color="red" />
|
||||||
|
{ageReqdErrMsg}
|
||||||
|
</Caption>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.captionBold {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.childInfoContainer {
|
||||||
|
display: grid;
|
||||||
|
gap: var(--Spacing-x2);
|
||||||
|
grid-template-columns: 1fr 2fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--Spacing-x1);
|
||||||
|
}
|
||||||
78
components/GuestsRoomsPicker/ChildSelector/index.tsx
Normal file
78
components/GuestsRoomsPicker/ChildSelector/index.tsx
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import { useFormContext } from "react-hook-form"
|
||||||
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useGuestsRoomsStore } from "@/stores/guests-rooms"
|
||||||
|
|
||||||
|
import Caption from "@/components/TempDesignSystem/Text/Caption"
|
||||||
|
|
||||||
|
import Counter from "../Counter"
|
||||||
|
import ChildInfoSelector from "./ChildInfoSelector"
|
||||||
|
|
||||||
|
import styles from "./child-selector.module.css"
|
||||||
|
|
||||||
|
import { BookingWidgetSchema } from "@/types/components/bookingWidget"
|
||||||
|
import { ChildSelectorProps } from "@/types/components/bookingWidget/guestsRoomsPicker"
|
||||||
|
|
||||||
|
export default function ChildSelector({ roomIndex = 0 }: ChildSelectorProps) {
|
||||||
|
const intl = useIntl()
|
||||||
|
const childrenLabel = intl.formatMessage({ id: "Children" })
|
||||||
|
const { setValue, trigger } = useFormContext<BookingWidgetSchema>()
|
||||||
|
const children = useGuestsRoomsStore(
|
||||||
|
(state) => state.rooms[roomIndex].children
|
||||||
|
)
|
||||||
|
const increaseChildren = useGuestsRoomsStore(
|
||||||
|
(state) => state.increaseChildren
|
||||||
|
)
|
||||||
|
const decreaseChildren = useGuestsRoomsStore(
|
||||||
|
(state) => state.decreaseChildren
|
||||||
|
)
|
||||||
|
|
||||||
|
function increaseChildrenCount(roomIndex: number) {
|
||||||
|
if (children.length < 5) {
|
||||||
|
increaseChildren(roomIndex)
|
||||||
|
setValue(`rooms.${roomIndex}.children.${children.length}`, {
|
||||||
|
age: -1,
|
||||||
|
bed: -1,
|
||||||
|
})
|
||||||
|
trigger("rooms")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function decreaseChildrenCount(roomIndex: number) {
|
||||||
|
if (children.length > 0) {
|
||||||
|
const newChildrenList = decreaseChildren(roomIndex)
|
||||||
|
setValue(`rooms.${roomIndex}.children`, newChildrenList)
|
||||||
|
trigger("rooms")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<section className={styles.container}>
|
||||||
|
<Caption color="uiTextHighContrast" type="bold">
|
||||||
|
{childrenLabel}
|
||||||
|
</Caption>
|
||||||
|
<Counter
|
||||||
|
count={children.length}
|
||||||
|
handleOnDecrease={() => {
|
||||||
|
decreaseChildrenCount(roomIndex)
|
||||||
|
}}
|
||||||
|
handleOnIncrease={() => {
|
||||||
|
increaseChildrenCount(roomIndex)
|
||||||
|
}}
|
||||||
|
disableDecrease={children.length == 0}
|
||||||
|
disableIncrease={children.length == 5}
|
||||||
|
/>
|
||||||
|
</section>
|
||||||
|
{children.map((child, index) => (
|
||||||
|
<ChildInfoSelector
|
||||||
|
roomIndex={roomIndex}
|
||||||
|
index={index}
|
||||||
|
child={child}
|
||||||
|
key={"child_" + index}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
13
components/GuestsRoomsPicker/Counter/counter.module.css
Normal file
13
components/GuestsRoomsPicker/Counter/counter.module.css
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
.counterContainer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
align-items: center;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
.counterBtn {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
.counterBtn:not([disabled]) {
|
||||||
|
box-shadow: 0px 0px 8px 1px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
49
components/GuestsRoomsPicker/Counter/index.tsx
Normal file
49
components/GuestsRoomsPicker/Counter/index.tsx
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import { MinusIcon, PlusIcon } from "@/components/Icons"
|
||||||
|
import Button from "@/components/TempDesignSystem/Button"
|
||||||
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||||
|
|
||||||
|
import styles from "./counter.module.css"
|
||||||
|
|
||||||
|
import { CounterProps } from "@/types/components/bookingWidget/guestsRoomsPicker"
|
||||||
|
|
||||||
|
export default function Counter({
|
||||||
|
count,
|
||||||
|
handleOnIncrease,
|
||||||
|
handleOnDecrease,
|
||||||
|
disableIncrease,
|
||||||
|
disableDecrease,
|
||||||
|
}: CounterProps) {
|
||||||
|
return (
|
||||||
|
<div className={styles.counterContainer}>
|
||||||
|
<Button
|
||||||
|
className={styles.counterBtn}
|
||||||
|
intent="inverted"
|
||||||
|
onClick={handleOnDecrease}
|
||||||
|
size="small"
|
||||||
|
theme="base"
|
||||||
|
variant="icon"
|
||||||
|
wrapping={true}
|
||||||
|
disabled={disableDecrease}
|
||||||
|
>
|
||||||
|
<MinusIcon color="burgundy" />
|
||||||
|
</Button>
|
||||||
|
<Body color="textHighContrast" textAlign="center">
|
||||||
|
{count}
|
||||||
|
</Body>
|
||||||
|
<Button
|
||||||
|
className={styles.counterBtn}
|
||||||
|
onClick={handleOnIncrease}
|
||||||
|
intent="inverted"
|
||||||
|
variant="icon"
|
||||||
|
theme="base"
|
||||||
|
wrapping={true}
|
||||||
|
size="small"
|
||||||
|
disabled={disableIncrease}
|
||||||
|
>
|
||||||
|
<PlusIcon color="burgundy" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
136
components/GuestsRoomsPicker/GuestsRoomsPicker.tsx
Normal file
136
components/GuestsRoomsPicker/GuestsRoomsPicker.tsx
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
"use client"
|
||||||
|
import { useFormContext } from "react-hook-form"
|
||||||
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useGuestsRoomsStore } from "@/stores/guests-rooms"
|
||||||
|
|
||||||
|
import { CloseLargeIcon, PlusCircleIcon, PlusIcon } from "../Icons"
|
||||||
|
import Button from "../TempDesignSystem/Button"
|
||||||
|
import Divider from "../TempDesignSystem/Divider"
|
||||||
|
import Subtitle from "../TempDesignSystem/Text/Subtitle"
|
||||||
|
import { Tooltip } from "../TempDesignSystem/Tooltip"
|
||||||
|
import AdultSelector from "./AdultSelector"
|
||||||
|
import ChildSelector from "./ChildSelector"
|
||||||
|
|
||||||
|
import styles from "./guests-rooms-picker.module.css"
|
||||||
|
|
||||||
|
import { BookingWidgetSchema } from "@/types/components/bookingWidget"
|
||||||
|
import { GuestsRoomsPickerProps } from "@/types/components/bookingWidget/guestsRoomsPicker"
|
||||||
|
|
||||||
|
export default function GuestsRoomsPicker({
|
||||||
|
closePicker,
|
||||||
|
}: GuestsRoomsPickerProps) {
|
||||||
|
const intl = useIntl()
|
||||||
|
const doneLabel = intl.formatMessage({ id: "Done" })
|
||||||
|
const roomLabel = intl.formatMessage({ id: "Room" })
|
||||||
|
const disabledBookingOptionsHeader = intl.formatMessage({
|
||||||
|
id: "Disabled booking options header",
|
||||||
|
})
|
||||||
|
const disabledBookingOptionsText = intl.formatMessage({
|
||||||
|
id: "Disabled booking options text",
|
||||||
|
})
|
||||||
|
const addRoomLabel = intl.formatMessage({ id: "Add Room" })
|
||||||
|
|
||||||
|
const { getFieldState } = useFormContext<BookingWidgetSchema>()
|
||||||
|
|
||||||
|
const rooms = useGuestsRoomsStore((state) => state.rooms)
|
||||||
|
|
||||||
|
// Not in MVP
|
||||||
|
// const increaseRoom = useGuestsRoomsStore.use.increaseRoom()
|
||||||
|
// const decreaseRoom = useGuestsRoomsStore.use.decreaseRoom()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.pickerContainer}>
|
||||||
|
<header className={styles.header}>
|
||||||
|
<button type="button" className={styles.close} onClick={closePicker}>
|
||||||
|
<CloseLargeIcon />
|
||||||
|
</button>
|
||||||
|
</header>
|
||||||
|
<div className={styles.contentContainer}>
|
||||||
|
{rooms.map((room, index) => (
|
||||||
|
<div className={styles.roomContainer} key={index}>
|
||||||
|
<section className={styles.roomDetailsContainer}>
|
||||||
|
<Subtitle type="two" className={styles.roomHeading}>
|
||||||
|
{roomLabel} {index + 1}
|
||||||
|
</Subtitle>
|
||||||
|
<AdultSelector roomIndex={index} />
|
||||||
|
<ChildSelector roomIndex={index} />
|
||||||
|
</section>
|
||||||
|
{/* Not in MVP
|
||||||
|
{index > 0 ? (
|
||||||
|
<Button intent="text" onClick={() => decreaseRoom(index)}>
|
||||||
|
Remove Room
|
||||||
|
</Button>
|
||||||
|
) : null} */}
|
||||||
|
<Divider color="primaryLightSubtle" />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
<div className={styles.addRoomMobileContainer}>
|
||||||
|
<Tooltip
|
||||||
|
heading={disabledBookingOptionsHeader}
|
||||||
|
text={disabledBookingOptionsText}
|
||||||
|
position="top"
|
||||||
|
arrow="left"
|
||||||
|
>
|
||||||
|
{rooms.length < 4 ? (
|
||||||
|
<Button
|
||||||
|
intent="text"
|
||||||
|
variant="icon"
|
||||||
|
wrapping
|
||||||
|
disabled
|
||||||
|
theme="base"
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
<PlusIcon />
|
||||||
|
{addRoomLabel}
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<footer className={styles.footer}>
|
||||||
|
<div className={styles.hideOnMobile}>
|
||||||
|
<Tooltip
|
||||||
|
heading={disabledBookingOptionsHeader}
|
||||||
|
text={disabledBookingOptionsText}
|
||||||
|
position="top"
|
||||||
|
arrow="left"
|
||||||
|
>
|
||||||
|
{rooms.length < 4 ? (
|
||||||
|
<Button
|
||||||
|
intent="text"
|
||||||
|
variant="icon"
|
||||||
|
wrapping
|
||||||
|
disabled
|
||||||
|
theme="base"
|
||||||
|
>
|
||||||
|
<PlusCircleIcon />
|
||||||
|
{addRoomLabel}
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
<Button
|
||||||
|
onClick={closePicker}
|
||||||
|
disabled={getFieldState("rooms").invalid}
|
||||||
|
className={styles.hideOnMobile}
|
||||||
|
intent="tertiary"
|
||||||
|
theme="base"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
{doneLabel}
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={closePicker}
|
||||||
|
disabled={getFieldState("rooms").invalid}
|
||||||
|
className={styles.hideOnDesktop}
|
||||||
|
intent="tertiary"
|
||||||
|
theme="base"
|
||||||
|
size="large"
|
||||||
|
>
|
||||||
|
{doneLabel}
|
||||||
|
</Button>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
148
components/GuestsRoomsPicker/guests-rooms-picker.module.css
Normal file
148
components/GuestsRoomsPicker/guests-rooms-picker.module.css
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
.container {
|
||||||
|
overflow: hidden;
|
||||||
|
position: relative;
|
||||||
|
&[data-isopen="true"] {
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.roomContainer {
|
||||||
|
display: grid;
|
||||||
|
gap: var(--Spacing-x2);
|
||||||
|
}
|
||||||
|
.roomDetailsContainer {
|
||||||
|
display: grid;
|
||||||
|
gap: var(--Spacing-x2);
|
||||||
|
padding-bottom: var(--Spacing-x1);
|
||||||
|
}
|
||||||
|
.hideWrapper {
|
||||||
|
background-color: var(--Main-Grey-White);
|
||||||
|
}
|
||||||
|
.roomHeading {
|
||||||
|
margin-bottom: var(--Spacing-x1);
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
outline: none;
|
||||||
|
padding: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.body {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
.footer {
|
||||||
|
display: grid;
|
||||||
|
gap: var(--Spacing-x1);
|
||||||
|
grid-template-columns: auto;
|
||||||
|
margin-top: var(--Spacing-x2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 1366px) {
|
||||||
|
.hideWrapper {
|
||||||
|
border-radius: var(--Corner-radius-Large) var(--Corner-radius-Large) 0 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
position: fixed;
|
||||||
|
right: 0;
|
||||||
|
top: 100%;
|
||||||
|
transition: top 300ms ease;
|
||||||
|
z-index: 10002;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container[data-isopen="true"] .hideWrapper {
|
||||||
|
top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pickerContainer {
|
||||||
|
--header-height: 72px;
|
||||||
|
--sticky-button-height: 140px;
|
||||||
|
display: grid;
|
||||||
|
grid-template-areas:
|
||||||
|
"header"
|
||||||
|
"content";
|
||||||
|
grid-template-rows: var(--header-height) calc(100dvh - var(--header-height));
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.contentContainer {
|
||||||
|
grid-area: content;
|
||||||
|
overflow-y: scroll;
|
||||||
|
scroll-snap-type: y mandatory;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
background-color: var(--Main-Grey-White);
|
||||||
|
display: grid;
|
||||||
|
grid-area: header;
|
||||||
|
padding: var(--Spacing-x3) var(--Spacing-x2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.close {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
justify-self: flex-end;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.roomContainer {
|
||||||
|
padding: 0 var(--Spacing-x2);
|
||||||
|
}
|
||||||
|
.roomContainer:last-of-type {
|
||||||
|
padding-bottom: calc(var(--sticky-button-height) + 20px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
background: linear-gradient(
|
||||||
|
180deg,
|
||||||
|
rgba(255, 255, 255, 0) 7.5%,
|
||||||
|
#ffffff 82.5%
|
||||||
|
);
|
||||||
|
padding: var(--Spacing-x1) var(--Spacing-x2) var(--Spacing-x7);
|
||||||
|
position: sticky;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer .hideOnMobile {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.addRoomMobileContainer {
|
||||||
|
display: grid;
|
||||||
|
width: 150px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding-bottom: calc(var(--sticky-button-height) + 20px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 1367px) {
|
||||||
|
.hideWrapper {
|
||||||
|
border-radius: var(--Corner-radius-Large);
|
||||||
|
box-shadow: 0px 0px 14px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
left: calc((var(--Spacing-x1) + var(--Spacing-x2)) * -1);
|
||||||
|
max-width: calc(100vw - 20px);
|
||||||
|
padding: var(--Spacing-x2) var(--Spacing-x3);
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + var(--Spacing-x2) + 1px + var(--Spacing-x4));
|
||||||
|
width: 360px;
|
||||||
|
max-height: calc(100dvh - 77px - var(--Spacing-x6));
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
grid-template-columns: auto auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer .hideOnDesktop,
|
||||||
|
.addRoomMobileContainer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
80
components/GuestsRoomsPicker/index.tsx
Normal file
80
components/GuestsRoomsPicker/index.tsx
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
"use client"
|
||||||
|
|
||||||
|
import { useCallback, useEffect, useRef, useState } from "react"
|
||||||
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useGuestsRoomsStore } from "@/stores/guests-rooms"
|
||||||
|
|
||||||
|
import { guestRoomsSchema } from "@/components/Forms/BookingWidget/schema"
|
||||||
|
import Body from "@/components/TempDesignSystem/Text/Body"
|
||||||
|
|
||||||
|
import GuestsRoomsPicker from "./GuestsRoomsPicker"
|
||||||
|
|
||||||
|
import styles from "./guests-rooms-picker.module.css"
|
||||||
|
|
||||||
|
export default function GuestsRoomsPickerForm() {
|
||||||
|
const intl = useIntl()
|
||||||
|
const [isOpen, setIsOpen] = useState(false)
|
||||||
|
const { rooms, adultCount, childCount, setIsValidated } = useGuestsRoomsStore(
|
||||||
|
(state) => ({
|
||||||
|
rooms: state.rooms,
|
||||||
|
adultCount: state.adultCount,
|
||||||
|
childCount: state.childCount,
|
||||||
|
setIsValidated: state.setIsValidated,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
const ref = useRef<HTMLDivElement | null>(null)
|
||||||
|
function handleOnClick() {
|
||||||
|
setIsOpen((prevIsOpen) => !prevIsOpen)
|
||||||
|
}
|
||||||
|
const closePicker = useCallback(() => {
|
||||||
|
const guestRoomsValidData = guestRoomsSchema.safeParse(rooms)
|
||||||
|
if (guestRoomsValidData.success) {
|
||||||
|
setIsOpen(false)
|
||||||
|
setIsValidated(false)
|
||||||
|
} else {
|
||||||
|
setIsValidated(true)
|
||||||
|
}
|
||||||
|
}, [rooms, setIsValidated, setIsOpen])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
function handleClickOutside(evt: Event) {
|
||||||
|
const target = evt.target as HTMLElement
|
||||||
|
if (ref.current && target && !ref.current.contains(target)) {
|
||||||
|
closePicker()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.addEventListener("click", handleClickOutside)
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener("click", handleClickOutside)
|
||||||
|
}
|
||||||
|
}, [closePicker])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.container} data-isopen={isOpen} ref={ref}>
|
||||||
|
<button className={styles.btn} onClick={handleOnClick} type="button">
|
||||||
|
<Body className={styles.body}>
|
||||||
|
{intl.formatMessage(
|
||||||
|
{ id: "booking.rooms" },
|
||||||
|
{ totalRooms: rooms.length }
|
||||||
|
)}
|
||||||
|
{", "}
|
||||||
|
{intl.formatMessage(
|
||||||
|
{ id: "booking.adults" },
|
||||||
|
{ totalAdults: adultCount }
|
||||||
|
)}
|
||||||
|
{childCount > 0
|
||||||
|
? ", " +
|
||||||
|
intl.formatMessage(
|
||||||
|
{ id: "booking.children" },
|
||||||
|
{ totalChildren: childCount }
|
||||||
|
)
|
||||||
|
: null}
|
||||||
|
</Body>
|
||||||
|
</button>
|
||||||
|
<div aria-modal className={styles.hideWrapper} role="dialog">
|
||||||
|
<GuestsRoomsPicker closePicker={closePicker} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -32,8 +32,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ecoLabel {
|
.ecoLabel {
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: auto 1fr;
|
align-items: center;
|
||||||
column-gap: var(--Spacing-x-one-and-half);
|
column-gap: var(--Spacing-x-one-and-half);
|
||||||
grid-column: 2 / 3;
|
grid-column: 2 / 3;
|
||||||
grid-row: 3 / 4;
|
grid-row: 3 / 4;
|
||||||
@@ -24,20 +24,26 @@ export default function Contact({ hotel }: ContactProps) {
|
|||||||
<span className={styles.heading}>
|
<span className={styles.heading}>
|
||||||
{intl.formatMessage({ id: "Address" })}
|
{intl.formatMessage({ id: "Address" })}
|
||||||
</span>
|
</span>
|
||||||
<span>{hotel.address.streetAddress}</span>
|
<span>
|
||||||
<span>{hotel.address.city}</span>
|
{`${hotel.address.streetAddress}, ${hotel.address.city}`}
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span className={styles.heading}>
|
<span className={styles.heading}>
|
||||||
{intl.formatMessage({ id: "Driving directions" })}
|
{intl.formatMessage({ id: "Driving directions" })}
|
||||||
</span>
|
</span>
|
||||||
<Link href="#">{intl.formatMessage({ id: "Google Maps" })}</Link>
|
<Link href="#" color="peach80">
|
||||||
|
Google Maps
|
||||||
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span className={styles.heading}>
|
<span className={styles.heading}>
|
||||||
{intl.formatMessage({ id: "Email" })}
|
{intl.formatMessage({ id: "Email" })}
|
||||||
</span>
|
</span>
|
||||||
<Link href={`mailto:${hotel.contactInformation.email}`}>
|
<Link
|
||||||
|
href={`mailto:${hotel.contactInformation.email}`}
|
||||||
|
color="peach80"
|
||||||
|
>
|
||||||
{hotel.contactInformation.email}
|
{hotel.contactInformation.email}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
@@ -45,7 +51,10 @@ export default function Contact({ hotel }: ContactProps) {
|
|||||||
<span className={styles.heading}>
|
<span className={styles.heading}>
|
||||||
{intl.formatMessage({ id: "Contact us" })}
|
{intl.formatMessage({ id: "Contact us" })}
|
||||||
</span>
|
</span>
|
||||||
<Link href={`tel:${hotel.contactInformation.phoneNumber}`}>
|
<Link
|
||||||
|
href={`tel:${hotel.contactInformation.phoneNumber}`}
|
||||||
|
color="peach80"
|
||||||
|
>
|
||||||
{hotel.contactInformation.phoneNumber}
|
{hotel.contactInformation.phoneNumber}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
import { zodResolver } from "@hookform/resolvers/zod"
|
import { zodResolver } from "@hookform/resolvers/zod"
|
||||||
|
import { useCallback, useEffect } from "react"
|
||||||
import { FormProvider, useForm } from "react-hook-form"
|
import { FormProvider, useForm } from "react-hook-form"
|
||||||
import { useIntl } from "react-intl"
|
import { useIntl } from "react-intl"
|
||||||
|
|
||||||
|
import { useEnterDetailsStore } from "@/stores/enter-details"
|
||||||
|
|
||||||
import { KingBedIcon } from "@/components/Icons"
|
import { KingBedIcon } from "@/components/Icons"
|
||||||
import RadioCard from "@/components/TempDesignSystem/Form/ChoiceCard/Radio"
|
import RadioCard from "@/components/TempDesignSystem/Form/ChoiceCard/Radio"
|
||||||
|
|
||||||
@@ -16,8 +19,14 @@ import { bedTypeEnum } from "@/types/enums/bedType"
|
|||||||
|
|
||||||
export default function BedType() {
|
export default function BedType() {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
|
const bedType = useEnterDetailsStore((state) => state.data.bedType)
|
||||||
|
|
||||||
const methods = useForm<BedTypeSchema>({
|
const methods = useForm<BedTypeSchema>({
|
||||||
|
defaultValues: bedType
|
||||||
|
? {
|
||||||
|
bedType,
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
criteriaMode: "all",
|
criteriaMode: "all",
|
||||||
mode: "all",
|
mode: "all",
|
||||||
resolver: zodResolver(bedTypeSchema),
|
resolver: zodResolver(bedTypeSchema),
|
||||||
@@ -28,15 +37,32 @@ export default function BedType() {
|
|||||||
{ id: "<b>Included</b> (based on availability)" },
|
{ id: "<b>Included</b> (based on availability)" },
|
||||||
{ b: (str) => <b>{str}</b> }
|
{ b: (str) => <b>{str}</b> }
|
||||||
)
|
)
|
||||||
|
const completeStep = useEnterDetailsStore((state) => state.completeStep)
|
||||||
|
|
||||||
|
const onSubmit = useCallback(
|
||||||
|
(values: BedTypeSchema) => {
|
||||||
|
completeStep(values)
|
||||||
|
},
|
||||||
|
[completeStep]
|
||||||
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (methods.formState.isSubmitting) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const subscription = methods.watch(() => methods.handleSubmit(onSubmit)())
|
||||||
|
return () => subscription.unsubscribe()
|
||||||
|
}, [methods, onSubmit])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormProvider {...methods}>
|
<FormProvider {...methods}>
|
||||||
<form className={styles.form}>
|
<form className={styles.form} onSubmit={methods.handleSubmit(onSubmit)}>
|
||||||
<RadioCard
|
<RadioCard
|
||||||
Icon={KingBedIcon}
|
Icon={KingBedIcon}
|
||||||
iconWidth={46}
|
iconWidth={46}
|
||||||
id={bedTypeEnum.KING}
|
id={bedTypeEnum.KING}
|
||||||
name="bed"
|
name="bedType"
|
||||||
subtitle={intl.formatMessage(
|
subtitle={intl.formatMessage(
|
||||||
{ id: "{width} cm × {length} cm" },
|
{ id: "{width} cm × {length} cm" },
|
||||||
{
|
{
|
||||||
@@ -52,7 +78,7 @@ export default function BedType() {
|
|||||||
Icon={KingBedIcon}
|
Icon={KingBedIcon}
|
||||||
iconWidth={46}
|
iconWidth={46}
|
||||||
id={bedTypeEnum.QUEEN}
|
id={bedTypeEnum.QUEEN}
|
||||||
name="bed"
|
name="bedType"
|
||||||
subtitle={intl.formatMessage(
|
subtitle={intl.formatMessage(
|
||||||
{ id: "{width} cm × {length} cm" },
|
{ id: "{width} cm × {length} cm" },
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,5 +3,5 @@ import { z } from "zod"
|
|||||||
import { bedTypeEnum } from "@/types/enums/bedType"
|
import { bedTypeEnum } from "@/types/enums/bedType"
|
||||||
|
|
||||||
export const bedTypeSchema = z.object({
|
export const bedTypeSchema = z.object({
|
||||||
bed: z.nativeEnum(bedTypeEnum),
|
bedType: z.nativeEnum(bedTypeEnum),
|
||||||
})
|
})
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user