Merged in fix/SW-3436-strikethrough-prices-summary (pull request #2776)
fix(SW-3436): show strikethrough price if discounted * fix(SW-3436): show strikethrough price if discounted Approved-by: Linus Flood
This commit is contained in:
@@ -21,12 +21,10 @@ export function DesktopSummary({
|
|||||||
input,
|
input,
|
||||||
selectedRates,
|
selectedRates,
|
||||||
isSubmitting,
|
isSubmitting,
|
||||||
bookingCode,
|
|
||||||
}: {
|
}: {
|
||||||
selectedRates: ReturnType<typeof useSelectRateContext>["selectedRates"]
|
selectedRates: ReturnType<typeof useSelectRateContext>["selectedRates"]
|
||||||
isSubmitting: boolean
|
isSubmitting: boolean
|
||||||
input: ReturnType<typeof useSelectRateContext>["input"]
|
input: ReturnType<typeof useSelectRateContext>["input"]
|
||||||
bookingCode: string
|
|
||||||
}) {
|
}) {
|
||||||
const intl = useIntl()
|
const intl = useIntl()
|
||||||
const isUserLoggedIn = useIsLoggedIn()
|
const isUserLoggedIn = useIsLoggedIn()
|
||||||
@@ -88,14 +86,6 @@ export function DesktopSummary({
|
|||||||
const mainRoomRate = selectedRates.rates.at(0)
|
const mainRoomRate = selectedRates.rates.at(0)
|
||||||
let mainRoomCurrency = getRoomCurrency(mainRoomRate)
|
let mainRoomCurrency = getRoomCurrency(mainRoomRate)
|
||||||
|
|
||||||
const totalRegularPrice = selectedRates.totalPrice.local?.regularPrice
|
|
||||||
? selectedRates.totalPrice.local.regularPrice
|
|
||||||
: 0
|
|
||||||
const isTotalRegularPriceGreaterThanPrice =
|
|
||||||
totalRegularPrice > selectedRates.totalPrice.local.price
|
|
||||||
const showStrikedThroughPrice =
|
|
||||||
(!!bookingCode || isUserLoggedIn) && isTotalRegularPriceGreaterThanPrice
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={styles.summaryText}>
|
<div className={styles.summaryText}>
|
||||||
@@ -168,20 +158,19 @@ export function DesktopSummary({
|
|||||||
selectedRates.totalPrice.local.additionalPriceCurrency
|
selectedRates.totalPrice.local.additionalPriceCurrency
|
||||||
)}
|
)}
|
||||||
</Subtitle>
|
</Subtitle>
|
||||||
{showStrikedThroughPrice &&
|
{showDiscounted && selectedRates.totalPrice.local.regularPrice && (
|
||||||
selectedRates.totalPrice.local.regularPrice && (
|
<Caption
|
||||||
<Caption
|
textAlign="right"
|
||||||
textAlign="right"
|
color="uiTextMediumContrast"
|
||||||
color="uiTextMediumContrast"
|
striked={true}
|
||||||
striked={true}
|
>
|
||||||
>
|
{formatPrice(
|
||||||
{formatPrice(
|
intl,
|
||||||
intl,
|
selectedRates.totalPrice.local.regularPrice,
|
||||||
selectedRates.totalPrice.local.regularPrice,
|
selectedRates.totalPrice.local.currency
|
||||||
selectedRates.totalPrice.local.currency
|
)}
|
||||||
)}
|
</Caption>
|
||||||
</Caption>
|
)}
|
||||||
)}
|
|
||||||
{selectedRates.totalPrice.requested ? (
|
{selectedRates.totalPrice.requested ? (
|
||||||
<Body color="uiTextMediumContrast">
|
<Body color="uiTextMediumContrast">
|
||||||
{intl.formatMessage(
|
{intl.formatMessage(
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ function InnerRateSummary() {
|
|||||||
isSubmitting={isSubmitting}
|
isSubmitting={isSubmitting}
|
||||||
input={input}
|
input={input}
|
||||||
selectedRates={selectedRates}
|
selectedRates={selectedRates}
|
||||||
bookingCode={input.data?.booking.bookingCode || ""}
|
|
||||||
/>
|
/>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user