"use client" import { notFound } from "next/navigation" import { useState } from "react" import { useIntl } from "react-intl" import { trpc } from "@/lib/trpc/client" import BedType from "@/components/HotelReservation/EnterDetails/BedType" import Breakfast from "@/components/HotelReservation/EnterDetails/Breakfast" import Details from "@/components/HotelReservation/EnterDetails/Details" import Payment from "@/components/HotelReservation/SelectRate/Payment" import SectionAccordion from "@/components/HotelReservation/SelectRate/SectionAccordion" import LoadingSpinner from "@/components/LoadingSpinner" 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 { return Object.values(StepEnum).includes(step as StepEnum) } export default function StepPage({ params, }: PageArgs) { const { step } = params const [activeStep, setActiveStep] = useState(step) const intl = useIntl() if (!isValidStep(activeStep)) { return notFound() } const { data: hotel, isLoading: loadingHotel } = trpc.hotel.hotelData.get.useQuery({ hotelId: "811", language: params.lang, }) if (loadingHotel) { return } if (!hotel) { // TODO: handle case with hotel missing return notFound() } switch (activeStep) { case StepEnum.breakfast: //return
Select BREAKFAST
case StepEnum.details: //return
Select DETAILS
case StepEnum.payment: //return
Select PAYMENT
case StepEnum.selectBed: // return
Select BED
} function onNav(step: StepEnum) { setActiveStep(step) if (typeof window !== "undefined") { window.history.pushState({}, "", step) } } return (
) }