Merged in fix/SW-1686-show-correct-room-number (pull request #1417)
fix(SW-1686): display total rooms and available rooms when filtering * fix(SW-1686): display total rooms and available rooms when filtering Approved-by: Arvid Norlin Approved-by: Simon.Emanuelsson
This commit is contained in:
@@ -21,6 +21,7 @@ export default function RoomTypeFilter() {
|
|||||||
actions: { selectFilter },
|
actions: { selectFilter },
|
||||||
rooms,
|
rooms,
|
||||||
selectedPackage,
|
selectedPackage,
|
||||||
|
totalRooms,
|
||||||
} = useRoomContext()
|
} = useRoomContext()
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
|
|
||||||
@@ -37,15 +38,31 @@ export default function RoomTypeFilter() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const notAllRoomsAvailableText = intl.formatMessage(
|
||||||
|
{
|
||||||
|
id: "{availableRooms}/{numberOfRooms, plural, one {# room type} other {# room types}} available",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
availableRooms: rooms.length,
|
||||||
|
numberOfRooms: totalRooms,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const allRoomsAvailableText = intl.formatMessage(
|
||||||
|
{
|
||||||
|
id: "{numberOfRooms, plural, one {# room type} other {# room types}} available",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
numberOfRooms: totalRooms,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<Caption color="uiTextHighContrast">
|
<Caption color="uiTextHighContrast">
|
||||||
{intl.formatMessage(
|
{rooms.length !== totalRooms
|
||||||
{
|
? notAllRoomsAvailableText
|
||||||
id: "{numberOfRooms, plural, one {# room type} other {# room types}} available",
|
: allRoomsAvailableText}
|
||||||
},
|
|
||||||
{ numberOfRooms: rooms.length }
|
|
||||||
)}
|
|
||||||
</Caption>
|
</Caption>
|
||||||
<ToggleButtonGroup
|
<ToggleButtonGroup
|
||||||
aria-label="Filter"
|
aria-label="Filter"
|
||||||
|
|||||||
@@ -756,6 +756,7 @@
|
|||||||
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotel} other {hoteller}}",
|
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotel} other {hoteller}}",
|
||||||
"{amount}/night per adult": "{amount}/nat per voksen",
|
"{amount}/night per adult": "{amount}/nat per voksen",
|
||||||
"{ancillary} added to your booking!": "{ancillary} tilføjet til din booking!",
|
"{ancillary} added to your booking!": "{ancillary} tilføjet til din booking!",
|
||||||
|
"{availableRooms}/{numberOfRooms, plural, one {# room type} other {# room types}} available": "{availableRooms}/{numberOfRooms, plural, one {# værelsestype} other {# værelsestyper}} tilgængelig",
|
||||||
"{card} ending with {cardno}": "{card} slutter med {cardno}",
|
"{card} ending with {cardno}": "{card} slutter med {cardno}",
|
||||||
"{checkInDate} from {checkInTime}": "{checkInDate} fra {checkInTime}",
|
"{checkInDate} from {checkInTime}": "{checkInDate} fra {checkInTime}",
|
||||||
"{checkOutDate} from {checkOutTime}": "{checkOutDate} fra {checkOutTime}",
|
"{checkOutDate} from {checkOutTime}": "{checkOutDate} fra {checkOutTime}",
|
||||||
@@ -771,7 +772,7 @@
|
|||||||
"{lowest} to {highest} persons": "{lowest} bis {highest} Personen",
|
"{lowest} to {highest} persons": "{lowest} bis {highest} Personen",
|
||||||
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
||||||
"{min} to {max} characters": "{min} til {max} tegn",
|
"{min} to {max} characters": "{min} til {max} tegn",
|
||||||
"{numberOfRooms, plural, one {# room type} other {# room types}} available": "{numberOfRooms, plural, one {# room type} other {# room types}} tilgængelig",
|
"{numberOfRooms, plural, one {# room type} other {# room types}} available": "{numberOfRooms, plural, one {# værelsestype} other {# værelsestyper}} tilgængelig",
|
||||||
"{number} km to city center": "{number} km til centrum",
|
"{number} km to city center": "{number} km til centrum",
|
||||||
"{number} people": "{number} people",
|
"{number} people": "{number} people",
|
||||||
"{points, number} Bonus points": "{points, number} Bonus points",
|
"{points, number} Bonus points": "{points, number} Bonus points",
|
||||||
|
|||||||
@@ -757,6 +757,7 @@
|
|||||||
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotel} other {hotels}}",
|
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotel} other {hotels}}",
|
||||||
"{amount}/night per adult": "{amount}/Nacht pro Erwachsenem",
|
"{amount}/night per adult": "{amount}/Nacht pro Erwachsenem",
|
||||||
"{ancillary} added to your booking!": "{ancillary} zu Ihrer Buchung hinzugefügt!",
|
"{ancillary} added to your booking!": "{ancillary} zu Ihrer Buchung hinzugefügt!",
|
||||||
|
"{availableRooms}/{numberOfRooms, plural, one {# room type} other {# room types}} available": "{availableRooms}/{numberOfRooms, plural, one {# Zimmertyp} other {# Zimmertypen}} verfügbar",
|
||||||
"{card} ending with {cardno}": "{card} endet mit {cardno}",
|
"{card} ending with {cardno}": "{card} endet mit {cardno}",
|
||||||
"{checkInDate} from {checkInTime}": "{checkInDate} aus {checkInTime}",
|
"{checkInDate} from {checkInTime}": "{checkInDate} aus {checkInTime}",
|
||||||
"{checkOutDate} from {checkOutTime}": "{checkOutDate} aus {checkOutTime}",
|
"{checkOutDate} from {checkOutTime}": "{checkOutDate} aus {checkOutTime}",
|
||||||
@@ -772,7 +773,7 @@
|
|||||||
"{lowest} to {highest} persons": "{lowest} til {highest} personer",
|
"{lowest} to {highest} persons": "{lowest} til {highest} personer",
|
||||||
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
||||||
"{min} to {max} characters": "{min} zu {max} figuren",
|
"{min} to {max} characters": "{min} zu {max} figuren",
|
||||||
"{numberOfRooms, plural, one {# room type} other {# room types}} available": "{numberOfRooms, plural, one {# room type} other {# room types}} verfügbar",
|
"{numberOfRooms, plural, one {# room type} other {# room types}} available": "{numberOfRooms, plural, one {# Zimmertyp} other {# Zimmertypen}} verfügbar",
|
||||||
"{number} km to city center": "{number} km zum Stadtzentrum",
|
"{number} km to city center": "{number} km zum Stadtzentrum",
|
||||||
"{number} people": "{number} people",
|
"{number} people": "{number} people",
|
||||||
"{points, number} Bonus points": "{points, number} Bonus points",
|
"{points, number} Bonus points": "{points, number} Bonus points",
|
||||||
|
|||||||
@@ -762,6 +762,7 @@
|
|||||||
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotel} other {hotels}}",
|
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotel} other {hotels}}",
|
||||||
"{amount}/night per adult": "{amount}/night per adult",
|
"{amount}/night per adult": "{amount}/night per adult",
|
||||||
"{ancillary} added to your booking!": "{ancillary} added to your booking!",
|
"{ancillary} added to your booking!": "{ancillary} added to your booking!",
|
||||||
|
"{availableRooms}/{numberOfRooms, plural, one {# room type} other {# room types}} available": "{availableRooms}/{numberOfRooms, plural, one {# room type} other {# room types}} available",
|
||||||
"{card} ending with {cardno}": "{card} ending with {cardno}",
|
"{card} ending with {cardno}": "{card} ending with {cardno}",
|
||||||
"{checkInDate} from {checkInTime}": "{checkInDate} from {checkInTime}",
|
"{checkInDate} from {checkInTime}": "{checkInDate} from {checkInTime}",
|
||||||
"{checkOutDate} from {checkOutTime}": "{checkOutDate} from {checkOutTime}",
|
"{checkOutDate} from {checkOutTime}": "{checkOutDate} from {checkOutTime}",
|
||||||
|
|||||||
@@ -757,6 +757,7 @@
|
|||||||
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotelli} other {hotellit}}",
|
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotelli} other {hotellit}}",
|
||||||
"{amount}/night per adult": "{amount}/yötä aikuista kohti",
|
"{amount}/night per adult": "{amount}/yötä aikuista kohti",
|
||||||
"{ancillary} added to your booking!": "{ancillary} lisätty varaukseesi!",
|
"{ancillary} added to your booking!": "{ancillary} lisätty varaukseesi!",
|
||||||
|
"{availableRooms}/{numberOfRooms, plural, one {# room type} other {# room types}} available": "{availableRooms}/{numberOfRooms, plural, one {# huonetyyppi} other {# huonetyyppiä}} saatavilla",
|
||||||
"{card} ending with {cardno}": "{card} päättyen {cardno}",
|
"{card} ending with {cardno}": "{card} päättyen {cardno}",
|
||||||
"{checkInDate} from {checkInTime}": "{checkInDate} alkaen {checkInTime}",
|
"{checkInDate} from {checkInTime}": "{checkInDate} alkaen {checkInTime}",
|
||||||
"{checkOutDate} from {checkOutTime}": "{checkOutDate} alkaen {checkOutTime}",
|
"{checkOutDate} from {checkOutTime}": "{checkOutDate} alkaen {checkOutTime}",
|
||||||
@@ -772,7 +773,7 @@
|
|||||||
"{lowest} to {highest} persons": "{lowest} - {highest} henkilöä",
|
"{lowest} to {highest} persons": "{lowest} - {highest} henkilöä",
|
||||||
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
||||||
"{min} to {max} characters": "{min} to {max} hahmoja",
|
"{min} to {max} characters": "{min} to {max} hahmoja",
|
||||||
"{numberOfRooms, plural, one {# room type} other {# room types}} available": "{numberOfRooms, plural, one {# room type} other {# room types}} saatavilla",
|
"{numberOfRooms, plural, one {# room type} other {# room types}} available": "{numberOfRooms, plural, one {# huonetyyppi} other {# huonetyyppiä}} saatavilla",
|
||||||
"{number} km to city center": "{number} km Etäisyys kaupunkiin",
|
"{number} km to city center": "{number} km Etäisyys kaupunkiin",
|
||||||
"{number} people": "{number} people",
|
"{number} people": "{number} people",
|
||||||
"{points, number} Bonus points": "{points, number} Bonus points",
|
"{points, number} Bonus points": "{points, number} Bonus points",
|
||||||
|
|||||||
@@ -753,6 +753,7 @@
|
|||||||
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotell} other {hoteller}}",
|
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotell} other {hoteller}}",
|
||||||
"{amount}/night per adult": "{amount}/natt per voksen",
|
"{amount}/night per adult": "{amount}/natt per voksen",
|
||||||
"{ancillary} added to your booking!": "{ancillary} lagt til bestillingen din!",
|
"{ancillary} added to your booking!": "{ancillary} lagt til bestillingen din!",
|
||||||
|
"{availableRooms}/{numberOfRooms, plural, one {# room type} other {# room types}} available": "{availableRooms}/{numberOfRooms, plural, one {# romtype} other {# romtyper}} tilgjengelig",
|
||||||
"{card} ending with {cardno}": "{card} slutter med {cardno}",
|
"{card} ending with {cardno}": "{card} slutter med {cardno}",
|
||||||
"{checkInDate} from {checkInTime}": "{checkInDate} fra {checkInTime}",
|
"{checkInDate} from {checkInTime}": "{checkInDate} fra {checkInTime}",
|
||||||
"{checkOutDate} from {checkOutTime}": "{checkOutDate} fra {checkOutTime}",
|
"{checkOutDate} from {checkOutTime}": "{checkOutDate} fra {checkOutTime}",
|
||||||
@@ -768,7 +769,7 @@
|
|||||||
"{lowest} to {highest} persons": "{lowest} til {highest} personer",
|
"{lowest} to {highest} persons": "{lowest} til {highest} personer",
|
||||||
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
||||||
"{min} to {max} characters": "{min} til {max} tegn",
|
"{min} to {max} characters": "{min} til {max} tegn",
|
||||||
"{numberOfRooms, plural, one {# room type} other {# room types}} available": "{numberOfRooms, plural, one {# room type} other {# room types}} tilgjengelig",
|
"{numberOfRooms, plural, one {# room type} other {# room types}} available": "{numberOfRooms, plural, one {# romtype} other {# romtyper}} tilgjengelig",
|
||||||
"{number} km to city center": "{number} km til sentrum",
|
"{number} km to city center": "{number} km til sentrum",
|
||||||
"{number} people": "{number} people",
|
"{number} people": "{number} people",
|
||||||
"{points, number} Bonus points": "{points, number} Bonus points",
|
"{points, number} Bonus points": "{points, number} Bonus points",
|
||||||
|
|||||||
@@ -755,6 +755,7 @@
|
|||||||
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotell} other {hotell}}",
|
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotell} other {hotell}}",
|
||||||
"{amount}/night per adult": "{amount}/natt per vuxen",
|
"{amount}/night per adult": "{amount}/natt per vuxen",
|
||||||
"{ancillary} added to your booking!": "{ancillary} har lagts till i din bokning!",
|
"{ancillary} added to your booking!": "{ancillary} har lagts till i din bokning!",
|
||||||
|
"{availableRooms}/{numberOfRooms, plural, one {# room type} other {# room types}} available": "{availableRooms}/{numberOfRooms, plural, one {# rumstyp tillgänglig} other {# rumstyper tillgängliga}}",
|
||||||
"{card} ending with {cardno}": "{card} som slutar på {cardno}",
|
"{card} ending with {cardno}": "{card} som slutar på {cardno}",
|
||||||
"{checkInDate} from {checkInTime}": "{checkInDate} från {checkInTime}",
|
"{checkInDate} from {checkInTime}": "{checkInDate} från {checkInTime}",
|
||||||
"{checkOutDate} from {checkOutTime}": "{checkOutDate} från {checkOutTime}",
|
"{checkOutDate} from {checkOutTime}": "{checkOutDate} från {checkOutTime}",
|
||||||
@@ -770,7 +771,7 @@
|
|||||||
"{lowest} to {highest} persons": "{lowest} till {highest} personer",
|
"{lowest} to {highest} persons": "{lowest} till {highest} personer",
|
||||||
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
||||||
"{min} to {max} characters": "{min} till {max} tecken",
|
"{min} to {max} characters": "{min} till {max} tecken",
|
||||||
"{numberOfRooms, plural, one {# room type} other {# room types}} available": "{numberOfRooms, plural, one {# room type} other {# room types}} tillgängliga",
|
"{numberOfRooms, plural, one {# room type} other {# room types}} available": "{numberOfRooms, plural, one {# rumstyp tillgänglig} other {# rumstyper tillgängliga}}",
|
||||||
"{number} km to city center": "{number} km till centrum",
|
"{number} km to city center": "{number} km till centrum",
|
||||||
"{number} people": "{number} personer",
|
"{number} people": "{number} personer",
|
||||||
"{points, number} Bonus points": "{points, number} Bonus points",
|
"{points, number} Bonus points": "{points, number} Bonus points",
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export default function RoomProvider({
|
|||||||
const modifyRate = useRatesStore((state) => state.actions.modifyRate(idx))
|
const modifyRate = useRatesStore((state) => state.actions.modifyRate(idx))
|
||||||
const selectFilter = useRatesStore((state) => state.actions.selectFilter(idx))
|
const selectFilter = useRatesStore((state) => state.actions.selectFilter(idx))
|
||||||
const selectRate = useRatesStore((state) => state.actions.selectRate(idx))
|
const selectRate = useRatesStore((state) => state.actions.selectRate(idx))
|
||||||
|
const totalRooms = useRatesStore((state) => state.allRooms.length)
|
||||||
const roomNr = idx + 1
|
const roomNr = idx + 1
|
||||||
return (
|
return (
|
||||||
<RoomContext.Provider
|
<RoomContext.Provider
|
||||||
@@ -30,6 +31,7 @@ export default function RoomProvider({
|
|||||||
isActiveRoom: activeRoom === idx,
|
isActiveRoom: activeRoom === idx,
|
||||||
isMainRoom: roomNr === 1,
|
isMainRoom: roomNr === 1,
|
||||||
roomNr,
|
roomNr,
|
||||||
|
totalRooms,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -11,4 +11,5 @@ export interface RoomContextValue extends SelectedRoom {
|
|||||||
isActiveRoom: boolean
|
isActiveRoom: boolean
|
||||||
isMainRoom: boolean
|
isMainRoom: boolean
|
||||||
roomNr: number
|
roomNr: number
|
||||||
|
totalRooms: number
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user