feat(697): Made new fields optional

This commit is contained in:
Pontus Dreij
2024-11-04 16:09:31 +01:00
parent 83c1178ba5
commit 04df824ea1
7 changed files with 29 additions and 22 deletions

View File

@@ -78,8 +78,8 @@ export default function Breakfast({ packages }: BreakfastProps) {
? intl.formatMessage<React.ReactNode>(
{ id: "breakfast.price.free" },
{
amount: pkg.localPrice.price,
currency: pkg.localPrice.currency,
amount: pkg.localPrice?.price,
currency: pkg.localPrice?.currency,
free: (str) => <Highlight>{str}</Highlight>,
strikethrough: (str) => <s>{str}</s>,
}
@@ -87,8 +87,8 @@ export default function Breakfast({ packages }: BreakfastProps) {
: intl.formatMessage(
{ id: "breakfast.price" },
{
amount: pkg.localPrice.price,
currency: pkg.localPrice.currency,
amount: pkg.localPrice?.price,
currency: pkg.localPrice?.currency,
}
)
}

View File

@@ -150,8 +150,8 @@ export default function Summary({
{intl.formatMessage(
{ id: "{amount} {currency}" },
{
amount: chosenBreakfast.localPrice.price,
currency: chosenBreakfast.localPrice.currency,
amount: chosenBreakfast.localPrice?.price,
currency: chosenBreakfast.localPrice?.currency,
}
)}
</Caption>

View File

@@ -1,4 +1,5 @@
import { differenceInCalendarDays } from "date-fns"
import { useSearchParams } from "next/navigation"
import { useIntl } from "react-intl"
import Body from "@/components/TempDesignSystem/Text/Body"
@@ -27,8 +28,7 @@ export default function PriceList({
const petRoomRequestedPrice = petRoomPackage?.requestedPrice
const showRequestedPrice = publicRequestedPrice && memberRequestedPrice
const searchParams = new URLSearchParams(window.location.search)
const searchParams = useSearchParams()
const fromDate = searchParams.get("fromDate")
const toDate = searchParams.get("toDate")

View File

@@ -36,8 +36,8 @@ export default function RateSummary({
(pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM
)
const petRoomPrice = petRoomPackage?.localPrice.totalPrice ?? null
const petRoomCurrency = petRoomPackage?.localPrice.currency ?? null
const petRoomPrice = petRoomPackage?.localPrice?.totalPrice ?? null
const petRoomCurrency = petRoomPackage?.localPrice?.currency ?? null
const checkInDate = new Date(roomsAvailability.checkInDate)
const checkOutDate = new Date(roomsAvailability.checkOutDate)