feat(SW-467): add routing for details steps
This commit is contained in:
89
app/[lang]/(live)/(public)/hotelreservation/[step]/page.tsx
Normal file
89
app/[lang]/(live)/(public)/hotelreservation/[step]/page.tsx
Normal file
@@ -0,0 +1,89 @@
|
||||
"use client"
|
||||
|
||||
import { notFound } from "next/navigation"
|
||||
import { useIntl } from "react-intl"
|
||||
|
||||
import Summary from "@/components/HotelReservation/SelectRate/Summary"
|
||||
|
||||
import styles from "./page.module.css"
|
||||
|
||||
import { LangParams, PageArgs } from "@/types/params"
|
||||
|
||||
// const bedAlternatives = [
|
||||
// {
|
||||
// value: "queen",
|
||||
// name: "Queen bed",
|
||||
// payment: "160 cm",
|
||||
// pricePerNight: 0,
|
||||
// membersPricePerNight: 0,
|
||||
// currency: "SEK",
|
||||
// },
|
||||
// {
|
||||
// value: "king",
|
||||
// name: "King bed",
|
||||
// payment: "160 cm",
|
||||
// pricePerNight: 0,
|
||||
// membersPricePerNight: 0,
|
||||
// currency: "SEK",
|
||||
// },
|
||||
// {
|
||||
// value: "twin",
|
||||
// name: "Twin bed",
|
||||
// payment: "90 cm + 90 cm",
|
||||
// pricePerNight: 82,
|
||||
// membersPricePerNight: 67,
|
||||
// currency: "SEK",
|
||||
// },
|
||||
// ]
|
||||
|
||||
// const breakfastAlternatives = [
|
||||
// {
|
||||
// value: "no",
|
||||
// name: "No breakfast",
|
||||
// payment: "Always cheeper to get it online",
|
||||
// pricePerNight: 0,
|
||||
// currency: "SEK",
|
||||
// },
|
||||
// {
|
||||
// value: "buffe",
|
||||
// name: "Breakfast buffé",
|
||||
// payment: "Always cheeper to get it online",
|
||||
// pricePerNight: 150,
|
||||
// currency: "SEK",
|
||||
// },
|
||||
// ]
|
||||
|
||||
enum StepEnum {
|
||||
"select-bed" = "select-bed",
|
||||
breakfast = "breakfast",
|
||||
details = "details",
|
||||
payment = "payment",
|
||||
}
|
||||
|
||||
type Step = keyof typeof StepEnum
|
||||
|
||||
function isValidStep(step: string): step is Step {
|
||||
return Object.keys(StepEnum).includes(step)
|
||||
}
|
||||
|
||||
export default function StepPage({
|
||||
params,
|
||||
}: PageArgs<LangParams & { step: string }>) {
|
||||
const { step } = params
|
||||
const intl = useIntl()
|
||||
|
||||
if (isValidStep(step)) {
|
||||
return notFound()
|
||||
}
|
||||
|
||||
switch (step) {
|
||||
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["select-bed"]:
|
||||
return <div>Select BED</div>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user