Merged in feat/SW-1261 (pull request #1263)

feat: only show member price when logged in

* feat: only show member price when logged in


Approved-by: Michael Zetterberg
This commit is contained in:
Simon.Emanuelsson
2025-02-07 08:51:50 +00:00
parent c0f5c0278b
commit c204532acc
27 changed files with 479 additions and 238 deletions

View File

@@ -1,3 +1,5 @@
"use client"
import { useSession } from "next-auth/react"
import { useIntl } from "react-intl"
import { selectRate } from "@/constants/routes/hotelReservation"
@@ -5,7 +7,6 @@ import { selectRate } from "@/constants/routes/hotelReservation"
import { mapFacilityToIcon } from "@/components/ContentType/HotelPage/data"
import Button from "@/components/TempDesignSystem/Button"
import Link from "@/components/TempDesignSystem/Link"
import Body from "@/components/TempDesignSystem/Text/Body"
import Caption from "@/components/TempDesignSystem/Text/Caption"
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
@@ -31,6 +32,8 @@ export default function ListingHotelCardDialog({
setImageError,
}: ListingHotelCardProps) {
const intl = useIntl()
const { data: session } = useSession()
const isUserLoggedIn = !!session
const {
name,
publicPrice,
@@ -85,12 +88,14 @@ export default function ListingHotelCardDialog({
{intl.formatMessage({ id: "Per night from" })}
</Caption>
<div className={styles.listingPrices}>
{publicPrice && (
<Subtitle type="two">
{publicPrice} {currency}
</Subtitle>
{publicPrice && !isUserLoggedIn && (
<>
<Subtitle type="two">
{publicPrice} {currency}
</Subtitle>
{memberPrice && <Caption>/</Caption>}
</>
)}
{publicPrice && memberPrice && <Caption>/</Caption>}
{memberPrice && (
<Subtitle type="two" color="red" className={styles.memberPrice}>
{intl.formatMessage(

View File

@@ -1,3 +1,5 @@
"use client"
import { useSession } from "next-auth/react"
import { useIntl } from "react-intl"
import { selectRate } from "@/constants/routes/hotelReservation"
@@ -32,6 +34,8 @@ export default function StandaloneHotelCardDialog({
setImageError,
}: StandaloneHotelCardProps) {
const intl = useIntl()
const { data: session } = useSession()
const isUserLoggedIn = !!session
const {
name,
publicPrice,
@@ -86,7 +90,7 @@ export default function StandaloneHotelCardDialog({
<Caption type="bold">
{intl.formatMessage({ id: "From" })}
</Caption>
{publicPrice && (
{publicPrice && !isUserLoggedIn && (
<Subtitle type="two">
{intl.formatMessage(
{ id: "{price} {currency}" },