@@ -18,6 +18,7 @@ import {
1818} from "@/modules/util" ;
1919import { reservationUnitPath } from "@/modules/const" ;
2020import { getImageSource } from "common/src/helpers" ;
21+ import ClientOnly from "common/src/ClientOnly" ;
2122
2223type Type = "pending" | "confirmed" | "complete" ;
2324
@@ -180,47 +181,50 @@ export function ReservationInfoCard({
180181 ? reservationUnitPath ( reservationUnit . pk )
181182 : "" ;
182183
184+ // Have to make client only because date formatting doesn't work on server side
183185 return (
184- < Wrapper $type = { type } >
185- < MainImage src = { imgSrc } alt = { name } />
186- < Content data-testid = "reservation__reservation-info-card__content" >
187- < Heading >
188- < StyledLink
189- data-testid = "reservation__reservation-info-card__reservationUnit"
190- href = { link }
191- >
192- { name }
193- </ StyledLink >
194- </ Heading >
195- { [ "confirmed" , "complete" ] . includes ( type ) && (
186+ < ClientOnly >
187+ < Wrapper $type = { type } >
188+ < MainImage src = { imgSrc } alt = { name } />
189+ < Content data-testid = "reservation__reservation-info-card__content" >
190+ < Heading >
191+ < StyledLink
192+ data-testid = "reservation__reservation-info-card__reservationUnit"
193+ href = { link }
194+ >
195+ { name }
196+ </ StyledLink >
197+ </ Heading >
198+ { [ "confirmed" , "complete" ] . includes ( type ) && (
199+ < Subheading >
200+ { t ( "reservations:reservationNumber" ) } :{ " " }
201+ < span data-testid = "reservation__reservation-info-card__reservationNumber" >
202+ { reservation . pk ?? "-" }
203+ </ span >
204+ </ Subheading >
205+ ) }
196206 < Subheading >
197- { t ( "reservations:reservationNumber" ) } :{ " " }
198- < span data-testid = "reservation__reservation-info-card__reservationNumber" >
199- { reservation . pk ?? "-" }
200- </ span >
207+ { reservationUnit . unit != null
208+ ? getTranslation ( reservationUnit . unit , "name" )
209+ : "-" }
201210 </ Subheading >
202- ) }
203- < Subheading >
204- { reservationUnit . unit != null
205- ? getTranslation ( reservationUnit . unit , "name" )
206- : "-" }
207- </ Subheading >
208- < Value data-testid = "reservation__reservation-info-card__duration" >
209- < Strong >
210- { capitalize ( timeString ) } , { formatDuration ( duration , t ) }
211- </ Strong >
212- </ Value >
213- < Value data-testid = "reservation__reservation-info-card__price" >
214- { t ( "reservationUnit:price" ) } : < Strong > { price } </ Strong > { " " }
215- { taxPercentageValue &&
216- shouldDisplayTaxPercentage &&
217- `(${ t ( "common:inclTax" , {
218- taxPercentage : formatters . strippedDecimal . format (
219- parseFloat ( taxPercentageValue )
220- ) ,
221- } ) } )`}
222- </ Value >
223- </ Content >
224- </ Wrapper >
211+ < Value data-testid = "reservation__reservation-info-card__duration" >
212+ < Strong >
213+ { capitalize ( timeString ) } , { formatDuration ( duration , t ) }
214+ </ Strong >
215+ </ Value >
216+ < Value data-testid = "reservation__reservation-info-card__price" >
217+ { t ( "reservationUnit:price" ) } : < Strong > { price } </ Strong > { " " }
218+ { taxPercentageValue &&
219+ shouldDisplayTaxPercentage &&
220+ `(${ t ( "common:inclTax" , {
221+ taxPercentage : formatters . strippedDecimal . format (
222+ parseFloat ( taxPercentageValue )
223+ ) ,
224+ } ) } )`}
225+ </ Value >
226+ </ Content >
227+ </ Wrapper >
228+ </ ClientOnly >
225229 ) ;
226230}
0 commit comments