fix: clean up dictionaries
This commit is contained in:
@@ -49,6 +49,7 @@ export function ReferenceCard({ booking, hotel }: ReferenceCardProps) {
|
||||
(acc, linkedReservation) => acc + linkedReservation.adults,
|
||||
0
|
||||
) ?? 0)
|
||||
|
||||
const children =
|
||||
booking.childrenAges.length +
|
||||
(booking.linkedReservations?.reduce(
|
||||
@@ -56,6 +57,25 @@ export function ReferenceCard({ booking, hotel }: ReferenceCardProps) {
|
||||
0
|
||||
) ?? 0)
|
||||
|
||||
const adultsMsg = intl.formatMessage(
|
||||
{ id: "{adults, plural, one {# adult} other {# adults}}" },
|
||||
{
|
||||
adults: adults,
|
||||
}
|
||||
)
|
||||
|
||||
const childrenMsg = intl.formatMessage(
|
||||
{
|
||||
id: "{children, plural, one {# child} other {# children}}",
|
||||
},
|
||||
{
|
||||
children: children,
|
||||
}
|
||||
)
|
||||
|
||||
const adultsOnlyMsg = adultsMsg
|
||||
const adultsAndChildrenMsg = [adultsMsg, childrenMsg].join(", ")
|
||||
|
||||
return (
|
||||
<div className={styles.referenceCard}>
|
||||
<div className={styles.referenceRow}>
|
||||
@@ -83,20 +103,7 @@ export function ReferenceCard({ booking, hotel }: ReferenceCardProps) {
|
||||
{intl.formatMessage({ id: "Guests" })}
|
||||
</Caption>
|
||||
<Caption type="bold" color="uiTextHighContrast">
|
||||
{children > 0
|
||||
? intl.formatMessage(
|
||||
{ id: "{adults} adults, {children} children" },
|
||||
{
|
||||
adults: adults,
|
||||
children: children,
|
||||
}
|
||||
)
|
||||
: intl.formatMessage(
|
||||
{ id: "{adults} adults" },
|
||||
{
|
||||
adults: adults,
|
||||
}
|
||||
)}
|
||||
{children > 0 ? adultsAndChildrenMsg : adultsOnlyMsg}
|
||||
</Caption>
|
||||
</div>
|
||||
<div className={styles.referenceRow}>
|
||||
|
||||
Reference in New Issue
Block a user