Merged in fix/refactor-currency-display (pull request #3434)
fix(SW-3616): Handle EuroBonus point type everywhere * Add tests to formatPrice * formatPrice * More work replacing config with api points type * More work replacing config with api points type * More fixing with currency * maybe actually fixed it * Fix MyStay * Clean up * Fix comments * Merge branch 'master' into fix/refactor-currency-display * Fix calculateTotalPrice for EB points + SF points + cash Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -7,6 +7,7 @@ import { Typography } from "../../../../Typography"
|
||||
import HotelMarker from "../../../Markers/HotelMarker"
|
||||
|
||||
import styles from "./hotelPin.module.css"
|
||||
import { PointType } from "@scandic-hotels/common/constants/pointType"
|
||||
|
||||
interface HotelPinProps {
|
||||
isActive: boolean
|
||||
@@ -14,6 +15,7 @@ interface HotelPinProps {
|
||||
currency: string
|
||||
hotelAdditionalPrice?: number
|
||||
hotelAdditionalCurrency?: string
|
||||
pointsType?: PointType | null
|
||||
}
|
||||
const NOT_AVAILABLE = "-"
|
||||
export function HotelPin({
|
||||
@@ -22,6 +24,7 @@ export function HotelPin({
|
||||
currency,
|
||||
hotelAdditionalPrice,
|
||||
hotelAdditionalCurrency,
|
||||
pointsType,
|
||||
}: HotelPinProps) {
|
||||
const intl = useIntl()
|
||||
const isNotAvailable = !hotelPrice
|
||||
@@ -51,7 +54,8 @@ export function HotelPin({
|
||||
hotelPrice,
|
||||
currency,
|
||||
hotelAdditionalPrice,
|
||||
hotelAdditionalCurrency
|
||||
hotelAdditionalCurrency,
|
||||
pointsType
|
||||
)}
|
||||
</p>
|
||||
</Typography>
|
||||
|
||||
@@ -5,13 +5,13 @@ import {
|
||||
} from "@vis.gl/react-google-maps"
|
||||
import { useMediaQuery } from "usehooks-ts"
|
||||
|
||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { useIntl } from "react-intl"
|
||||
import { StandaloneHotelCardDialog } from "../../../HotelCard/HotelDialogCard/StandaloneHotelCardDialog"
|
||||
import type { HotelPin as HotelPinType } from "../../types"
|
||||
import styles from "./hotelListingMapContent.module.css"
|
||||
import { HotelPin } from "./HotelPin"
|
||||
import { getCurrencyText } from "../../../currency-utils"
|
||||
|
||||
export type HotelListingMapContentProps = {
|
||||
hotelPins: HotelPinType[]
|
||||
@@ -19,7 +19,6 @@ export type HotelListingMapContentProps = {
|
||||
hoveredHotel?: string | null
|
||||
lang: Lang
|
||||
isUserLoggedIn: boolean
|
||||
pointsCurrency?: CurrencyEnum
|
||||
onClickHotel?: (hotelId: string) => void
|
||||
setActiveHotel?: (args: { hotelName: string; hotelId: string } | null) => void
|
||||
setHoveredHotel?: (
|
||||
@@ -35,7 +34,6 @@ export function HotelListingMapContent({
|
||||
setHoveredHotel,
|
||||
lang,
|
||||
onClickHotel,
|
||||
pointsCurrency,
|
||||
}: HotelListingMapContentProps) {
|
||||
const intl = useIntl()
|
||||
const isDesktop = useMediaQuery("(min-width: 900px)")
|
||||
@@ -65,10 +63,12 @@ export function HotelListingMapContent({
|
||||
null
|
||||
|
||||
const pinCurrency = pin.redemptionPrice
|
||||
? intl.formatMessage({
|
||||
id: "common.points",
|
||||
defaultMessage: "Points",
|
||||
})
|
||||
? getCurrencyText(
|
||||
intl,
|
||||
pin.currency,
|
||||
pin.redemptionPrice,
|
||||
pin.pointsType
|
||||
)
|
||||
: pin.currency
|
||||
|
||||
const hotelAdditionalPrice = pin.chequePrice
|
||||
@@ -116,7 +116,6 @@ export function HotelListingMapContent({
|
||||
onClick={() => {
|
||||
onClickHotel?.(pin.operaId)
|
||||
}}
|
||||
pointsCurrency={pointsCurrency}
|
||||
/>
|
||||
</InfoWindow>
|
||||
)}
|
||||
|
||||
@@ -15,7 +15,6 @@ import PoiMapMarkers from "./PoiMapMarkers"
|
||||
|
||||
import styles from "./interactiveMap.module.css"
|
||||
|
||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import { HotelPin, MarkerInfo, PointOfInterest } from "../types"
|
||||
|
||||
@@ -27,7 +26,6 @@ export type InteractiveMapProps = {
|
||||
}
|
||||
activePoi?: string | null
|
||||
hotelPins?: HotelPin[]
|
||||
pointsCurrency?: CurrencyEnum
|
||||
pointsOfInterest?: PointOfInterest[]
|
||||
markerInfo?: MarkerInfo
|
||||
mapId: string
|
||||
@@ -74,7 +72,6 @@ export function InteractiveMap({
|
||||
hoveredHotelPin,
|
||||
activeHotelPin,
|
||||
isUserLoggedIn,
|
||||
pointsCurrency,
|
||||
onClickHotel,
|
||||
onHoverHotelPin,
|
||||
onSetActiveHotelPin,
|
||||
@@ -124,7 +121,6 @@ export function InteractiveMap({
|
||||
activeHotel={activeHotelPin}
|
||||
hoveredHotel={hoveredHotelPin}
|
||||
onClickHotel={onClickHotel}
|
||||
pointsCurrency={pointsCurrency}
|
||||
/>
|
||||
)}
|
||||
{pointsOfInterest && markerInfo && (
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||
import { HotelPin } from "../types"
|
||||
import { PointType } from "@scandic-hotels/common/constants/pointType"
|
||||
|
||||
export const hotelPins: HotelPin[] = [
|
||||
{
|
||||
@@ -15,6 +16,7 @@ export const hotelPins: HotelPin[] = [
|
||||
voucherPrice: null,
|
||||
rateType: "Regular",
|
||||
currency: "SEK",
|
||||
pointsType: PointType.SCANDIC,
|
||||
amenities: [
|
||||
{
|
||||
filter: "Hotel facilities",
|
||||
@@ -90,6 +92,7 @@ export const hotelPins: HotelPin[] = [
|
||||
voucherPrice: null,
|
||||
rateType: "Regular",
|
||||
currency: "SEK",
|
||||
pointsType: PointType.SCANDIC,
|
||||
amenities: [
|
||||
{
|
||||
filter: "Hotel facilities",
|
||||
@@ -168,6 +171,7 @@ export const hotelPins: HotelPin[] = [
|
||||
voucherPrice: null,
|
||||
rateType: "Regular",
|
||||
currency: "CC",
|
||||
pointsType: PointType.SCANDIC,
|
||||
amenities: [
|
||||
{
|
||||
filter: "Hotel facilities",
|
||||
@@ -242,6 +246,7 @@ export const hotelPins: HotelPin[] = [
|
||||
voucherPrice: null,
|
||||
rateType: "Regular",
|
||||
currency: "Points",
|
||||
pointsType: PointType.SCANDIC,
|
||||
amenities: [
|
||||
{
|
||||
filter: "None",
|
||||
@@ -316,6 +321,7 @@ export const hotelPins: HotelPin[] = [
|
||||
voucherPrice: 1,
|
||||
rateType: "Regular",
|
||||
currency: "Voucher",
|
||||
pointsType: PointType.SCANDIC,
|
||||
amenities: [
|
||||
{
|
||||
filter: "Hotel facilities",
|
||||
|
||||
Reference in New Issue
Block a user