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 },
|
||||
rooms,
|
||||
selectedPackage,
|
||||
totalRooms,
|
||||
} = useRoomContext()
|
||||
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 (
|
||||
<div className={styles.container}>
|
||||
<Caption color="uiTextHighContrast">
|
||||
{intl.formatMessage(
|
||||
{
|
||||
id: "{numberOfRooms, plural, one {# room type} other {# room types}} available",
|
||||
},
|
||||
{ numberOfRooms: rooms.length }
|
||||
)}
|
||||
{rooms.length !== totalRooms
|
||||
? notAllRoomsAvailableText
|
||||
: allRoomsAvailableText}
|
||||
</Caption>
|
||||
<ToggleButtonGroup
|
||||
aria-label="Filter"
|
||||
|
||||
Reference in New Issue
Block a user