diff --git a/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/index.tsx index 6b0bf7c4d..39eef31ff 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/BookingSummary/index.tsx @@ -1,3 +1,8 @@ +"use client" + +import { useEffect } from "react" +import { useIntl } from "react-intl" + import { dt } from "@/lib/dt" import { @@ -12,10 +17,10 @@ import Body from "@/components/TempDesignSystem/Text/Body" import Caption from "@/components/TempDesignSystem/Text/Caption" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import { Toast } from "@/components/TempDesignSystem/Toasts" -import { getIntl } from "@/i18n" -import { getLang } from "@/i18n/serverContext" +import useLang from "@/hooks/useLang" import { formatPrice } from "@/utils/numberFormatting" +import { useMyStayTotalPriceStore } from "../stores/myStayTotalPrice" import SummaryCard from "./SummaryCard" import styles from "./bookingSummary.module.css" @@ -28,12 +33,22 @@ interface BookingSummaryProps { hotel: Hotel } -export default async function BookingSummary({ +export default function BookingSummary({ booking, hotel, }: BookingSummaryProps) { - const intl = await getIntl() - const lang = getLang() + const intl = useIntl() + const lang = useLang() + const { totalPrice, currencyCode, addRoomPrice } = useMyStayTotalPriceStore() + + useEffect(() => { + addRoomPrice({ + id: booking.confirmationNumber ?? "", + totalPrice: booking.totalPrice, + currencyCode: booking.currencyCode, + isMainBooking: true, + }) + }, [booking, addRoomPrice]) const directionsUrl = `https://www.google.com/maps/dir/?api=1&destination=${hotel.location.latitude},${hotel.location.longitude}` const isPaid = @@ -49,7 +64,7 @@ export default async function BookingSummary({