Files
web/apps/scandic-web/components/HotelReservation/MyStay/Rooms/SingleRoom/Details/Breakfast.tsx
Anton Gunnarsson 800dc5c3c1 Merged in feat/sw-3225-move-parking-information-to-booking-flow (pull request #2614)
feat(SW-3225): Move ParkingInformation to design-system

* Inline ParkingInformation types to remove trpc dependency

* Move ParkingInformation to design-system

* Move numberFormatting to common package

* Add deps to external

* Fix imports and i18n script

* Add common as dependency

* Merge branch 'master' into feat/sw-3225-move-parking-information-to-booking-flow


Approved-by: Linus Flood
2025-08-12 12:36:31 +00:00

40 lines
1.1 KiB
TypeScript

"use client"
import { useIntl } from "react-intl"
import { formatPrice } from "@scandic-hotels/common/utils/numberFormatting"
import { useMyStayStore } from "@/stores/my-stay"
import Row from "./Row"
export default function Breakfast() {
const intl = useIntl()
const { breakfast, breakfastChildren, rateDefinition } = useMyStayStore(
(state) => ({
breakfast: state.bookedRoom.breakfast,
breakfastChildren: state.bookedRoom.breakfastChildren,
rateDefinition: state.bookedRoom.rateDefinition,
})
)
let breakfastPrice = intl.formatMessage({
defaultMessage: "No breakfast",
})
if (rateDefinition.breakfastIncluded) {
breakfastPrice = intl.formatMessage({
defaultMessage: "Included",
})
} else if (breakfast) {
const childPrice = breakfastChildren?.localPrice.totalPrice || 0
breakfastPrice = formatPrice(
intl,
breakfast.localPrice.totalPrice + childPrice,
breakfast.localPrice.currency
)
}
const title = intl.formatMessage({ defaultMessage: "Breakfast" })
return <Row icon="coffee" text={breakfastPrice} title={title} />
}