feat: make steps of enter details flow dynamic depending on data

This commit is contained in:
Simon Emanuelsson
2024-11-18 09:13:23 +01:00
parent 3c4907efce
commit 94f693c4f0
62 changed files with 959 additions and 659 deletions

View File

@@ -1,97 +1,59 @@
/** @type {import('@/types/routes').LangRoute} */
export const hotelReservation = {
en: "/en/hotelreservation",
sv: "/sv/hotelreservation",
no: "/no/hotelreservation",
fi: "/fi/hotelreservation",
da: "/da/hotelreservation",
de: "/de/hotelreservation",
/**
* @typedef {import('@/constants/languages').Lang} Lang
*/
/**
* @param {Lang} lang
*/
function base(lang) {
return `/${lang}/hotelreservation`
}
export const selectHotel = {
en: `${hotelReservation.en}/select-hotel`,
sv: `${hotelReservation.sv}/select-hotel`,
no: `${hotelReservation.no}/select-hotel`,
fi: `${hotelReservation.fi}/select-hotel`,
da: `${hotelReservation.da}/select-hotel`,
de: `${hotelReservation.de}/select-hotel`,
/**
* @param {Lang} lang
*/
export function bookingConfirmation(lang) {
return `${base(lang)}/booking-confirmation`
}
export const selectRate = {
en: `${hotelReservation.en}/select-rate`,
sv: `${hotelReservation.sv}/select-rate`,
no: `${hotelReservation.no}/select-rate`,
fi: `${hotelReservation.fi}/select-rate`,
da: `${hotelReservation.da}/select-rate`,
de: `${hotelReservation.de}/select-rate`,
/**
* @param {Lang} lang
*/
export function details(lang) {
return `${base(lang)}/details`
}
// TODO: Translate paths
export const selectBed = {
en: `${hotelReservation.en}/select-bed`,
sv: `${hotelReservation.sv}/select-bed`,
no: `${hotelReservation.no}/select-bed`,
fi: `${hotelReservation.fi}/select-bed`,
da: `${hotelReservation.da}/select-bed`,
de: `${hotelReservation.de}/select-bed`,
/**
* @param {Lang} lang
*/
export function payment(lang) {
return `${base(lang)}/payment`
}
// TODO: Translate paths
export const breakfast = {
en: `${hotelReservation.en}/breakfast`,
sv: `${hotelReservation.sv}/breakfast`,
no: `${hotelReservation.no}/breakfast`,
fi: `${hotelReservation.fi}/breakfast`,
da: `${hotelReservation.da}/breakfast`,
de: `${hotelReservation.de}/breakfast`,
/**
* @param {Lang} lang
*/
export function selectBed(lang) {
return `${base(lang)}/select-bed`
}
// TODO: Translate paths
export const details = {
en: `${hotelReservation.en}/details`,
sv: `${hotelReservation.sv}/details`,
no: `${hotelReservation.no}/details`,
fi: `${hotelReservation.fi}/details`,
da: `${hotelReservation.da}/details`,
de: `${hotelReservation.de}/details`,
/**
* @param {Lang} lang
*/
export function selectHotel(lang) {
return `${base(lang)}/select-hotel`
}
// TODO: Translate paths
export const payment = {
en: `${hotelReservation.en}/payment`,
sv: `${hotelReservation.sv}/payment`,
no: `${hotelReservation.no}/payment`,
fi: `${hotelReservation.fi}/payment`,
da: `${hotelReservation.da}/payment`,
de: `${hotelReservation.de}/payment`,
/**
* @param {Lang} lang
*/
export function selectHotelMap(lang) {
return `${base(lang)}/map`
}
export const selectHotelMap = {
en: `${selectHotel.en}/map`,
sv: `${selectHotel.sv}/map`,
no: `${selectHotel.no}/map`,
fi: `${selectHotel.fi}/map`,
da: `${selectHotel.da}/map`,
de: `${selectHotel.de}/map`,
/**
* @param {Lang} lang
*/
export function selectRate(lang) {
return `${base(lang)}/select-rate`
}
/** @type {import('@/types/routes').LangRoute} */
export const bookingConfirmation = {
en: `${hotelReservation.en}/booking-confirmation`,
sv: `${hotelReservation.sv}/booking-confirmation`,
no: `${hotelReservation.no}/booking-confirmation`,
fi: `${hotelReservation.fi}/booking-confirmation`,
da: `${hotelReservation.da}/booking-confirmation`,
de: `${hotelReservation.de}/booking-confirmation`,
}
export const bookingFlow = [
...Object.values(selectHotel),
...Object.values(selectBed),
...Object.values(breakfast),
...Object.values(details),
...Object.values(payment),
...Object.values(selectHotelMap),
...Object.values(bookingConfirmation),
...Object.values(selectRate),
]