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"
|
||||
|
||||
@@ -756,6 +756,7 @@
|
||||
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotel} other {hoteller}}",
|
||||
"{amount}/night per adult": "{amount}/nat per voksen",
|
||||
"{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}",
|
||||
"{checkInDate} from {checkInTime}": "{checkInDate} fra {checkInTime}",
|
||||
"{checkOutDate} from {checkOutTime}": "{checkOutDate} fra {checkOutTime}",
|
||||
@@ -771,7 +772,7 @@
|
||||
"{lowest} to {highest} persons": "{lowest} bis {highest} Personen",
|
||||
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
||||
"{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} people": "{number} people",
|
||||
"{points, number} Bonus points": "{points, number} Bonus points",
|
||||
@@ -802,4 +803,4 @@
|
||||
"{value} persons": "{number} Personen",
|
||||
"{value} square meters": "{number} Quadratmeter",
|
||||
"© {currentYear} Scandic AB All rights reserved": "© {currentYear} Scandic AB Alle rettigheder forbeholdes"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -757,6 +757,7 @@
|
||||
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotel} other {hotels}}",
|
||||
"{amount}/night per adult": "{amount}/Nacht pro Erwachsenem",
|
||||
"{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}",
|
||||
"{checkInDate} from {checkInTime}": "{checkInDate} aus {checkInTime}",
|
||||
"{checkOutDate} from {checkOutTime}": "{checkOutDate} aus {checkOutTime}",
|
||||
@@ -772,7 +773,7 @@
|
||||
"{lowest} to {highest} persons": "{lowest} til {highest} personer",
|
||||
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
||||
"{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} people": "{number} people",
|
||||
"{points, number} Bonus points": "{points, number} Bonus points",
|
||||
@@ -803,4 +804,4 @@
|
||||
"{value} persons": "{number} personer",
|
||||
"{value} square meters": "{number} kvadratmeter",
|
||||
"© {currentYear} Scandic AB All rights reserved": "© {currentYear} Scandic AB Alle Rechte vorbehalten"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -762,6 +762,7 @@
|
||||
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotel} other {hotels}}",
|
||||
"{amount}/night per adult": "{amount}/night per adult",
|
||||
"{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}",
|
||||
"{checkInDate} from {checkInTime}": "{checkInDate} from {checkInTime}",
|
||||
"{checkOutDate} from {checkOutTime}": "{checkOutDate} from {checkOutTime}",
|
||||
@@ -809,4 +810,4 @@
|
||||
"{value} persons": "{value} persons",
|
||||
"{value} square meters": "{value} square meters",
|
||||
"© {currentYear} Scandic AB All rights reserved": "© {currentYear} Scandic AB All rights reserved"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -757,6 +757,7 @@
|
||||
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotelli} other {hotellit}}",
|
||||
"{amount}/night per adult": "{amount}/yötä aikuista kohti",
|
||||
"{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}",
|
||||
"{checkInDate} from {checkInTime}": "{checkInDate} alkaen {checkInTime}",
|
||||
"{checkOutDate} from {checkOutTime}": "{checkOutDate} alkaen {checkOutTime}",
|
||||
@@ -772,7 +773,7 @@
|
||||
"{lowest} to {highest} persons": "{lowest} - {highest} henkilöä",
|
||||
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
||||
"{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} people": "{number} people",
|
||||
"{points, number} Bonus points": "{points, number} Bonus points",
|
||||
@@ -803,4 +804,4 @@
|
||||
"{value} persons": "{number} henkilöä",
|
||||
"{value} square meters": "{number} neliömetriä",
|
||||
"© {currentYear} Scandic AB All rights reserved": "© {currentYear} Scandic AB Kaikki oikeudet pidätetään"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -753,6 +753,7 @@
|
||||
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotell} other {hoteller}}",
|
||||
"{amount}/night per adult": "{amount}/natt per voksen",
|
||||
"{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}",
|
||||
"{checkInDate} from {checkInTime}": "{checkInDate} fra {checkInTime}",
|
||||
"{checkOutDate} from {checkOutTime}": "{checkOutDate} fra {checkOutTime}",
|
||||
@@ -768,7 +769,7 @@
|
||||
"{lowest} to {highest} persons": "{lowest} til {highest} personer",
|
||||
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
||||
"{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} people": "{number} people",
|
||||
"{points, number} Bonus points": "{points, number} Bonus points",
|
||||
@@ -799,4 +800,4 @@
|
||||
"{value} persons": "{number} personer",
|
||||
"{value} square meters": "{number} kvadratmeter",
|
||||
"© {currentYear} Scandic AB All rights reserved": "© {currentYear} Scandic AB Alle rettigheter forbeholdt"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -755,6 +755,7 @@
|
||||
"{amount} {amount, plural, one {hotel} other {hotels}}": "{amount} {amount, plural, one {hotell} other {hotell}}",
|
||||
"{amount}/night per adult": "{amount}/natt per vuxen",
|
||||
"{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}",
|
||||
"{checkInDate} from {checkInTime}": "{checkInDate} från {checkInTime}",
|
||||
"{checkOutDate} from {checkOutTime}": "{checkOutDate} från {checkOutTime}",
|
||||
@@ -770,7 +771,7 @@
|
||||
"{lowest} to {highest} persons": "{lowest} till {highest} personer",
|
||||
"{memberPrice} {currency}": "{memberPrice} {currency}",
|
||||
"{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} people": "{number} personer",
|
||||
"{points, number} Bonus points": "{points, number} Bonus points",
|
||||
@@ -801,4 +802,4 @@
|
||||
"{value} persons": "{number} personer",
|
||||
"{value} square meters": "{number} kvadratmeter",
|
||||
"© {currentYear} Scandic AB All rights reserved": "© {currentYear} Scandic AB Alla rättigheter förbehålls"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ export default function RoomProvider({
|
||||
const modifyRate = useRatesStore((state) => state.actions.modifyRate(idx))
|
||||
const selectFilter = useRatesStore((state) => state.actions.selectFilter(idx))
|
||||
const selectRate = useRatesStore((state) => state.actions.selectRate(idx))
|
||||
const totalRooms = useRatesStore((state) => state.allRooms.length)
|
||||
const roomNr = idx + 1
|
||||
return (
|
||||
<RoomContext.Provider
|
||||
@@ -30,6 +31,7 @@ export default function RoomProvider({
|
||||
isActiveRoom: activeRoom === idx,
|
||||
isMainRoom: roomNr === 1,
|
||||
roomNr,
|
||||
totalRooms,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -11,4 +11,5 @@ export interface RoomContextValue extends SelectedRoom {
|
||||
isActiveRoom: boolean
|
||||
isMainRoom: boolean
|
||||
roomNr: number
|
||||
totalRooms: number
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user