1
+ import { Str } from 'expensify-common' ;
1
2
import React from 'react' ;
2
3
import type { OnyxEntry } from 'react-native-onyx' ;
3
4
import * as Expensicons from '@components/Icon/Expensicons' ;
@@ -20,17 +21,24 @@ function HotelTripDetails({reservation, personalDetails}: HotelTripDetailsProps)
20
21
const styles = useThemeStyles ( ) ;
21
22
const { translate} = useLocalize ( ) ;
22
23
24
+ const cancellationMapping : Record < string , string > = {
25
+ [ CONST . CANCELLATION_POLICY . UNKNOWN ] : translate ( 'travel.hotelDetails.cancellationPolicies.unknown' ) ,
26
+ [ CONST . CANCELLATION_POLICY . NON_REFUNDABLE ] : translate ( 'travel.hotelDetails.cancellationPolicies.nonRefundable' ) ,
27
+ [ CONST . CANCELLATION_POLICY . FREE_CANCELLATION_UNTIL ] : translate ( 'travel.hotelDetails.cancellationPolicies.freeCancellationUntil' ) ,
28
+ [ CONST . CANCELLATION_POLICY . PARTIALLY_REFUNDABLE ] : translate ( 'travel.hotelDetails.cancellationPolicies.partiallyRefundable' ) ,
29
+ } ;
30
+
23
31
const checkInDate = DateUtils . getFormattedTransportDateAndHour ( new Date ( reservation . start . date ) ) ;
24
32
const checkOutDate = DateUtils . getFormattedTransportDateAndHour ( new Date ( reservation . end . date ) ) ;
25
33
const cancellationText = reservation . cancellationDeadline
26
34
? `${ translate ( 'travel.hotelDetails.cancellationUntil' ) } ${ DateUtils . getFormattedTransportDateAndHour ( new Date ( reservation . cancellationDeadline ) ) . date } `
27
- : reservation . cancellationPolicy ;
35
+ : cancellationMapping [ reservation . cancellationPolicy ?? CONST . CANCELLATION_POLICY . UNKNOWN ] ;
28
36
29
37
const displayName = personalDetails ?. displayName ?? reservation . travelerPersonalInfo ?. name ;
30
38
31
39
return (
32
40
< >
33
- < Text style = { [ styles . textHeadlineH1 , styles . mh5 , styles . mv3 ] } > { reservation . start . longName } </ Text >
41
+ < Text style = { [ styles . textHeadlineH1 , styles . mh5 , styles . mv3 ] } > { Str . recapitalize ( reservation . start . longName ?? '' ) } </ Text >
34
42
< MenuItemWithTopDescription
35
43
description = { translate ( 'common.address' ) }
36
44
title = { reservation . start . address }
0 commit comments