From 6a5350d681b1bfc9fcf5ee373f1b60f73d63bb65 Mon Sep 17 00:00:00 2001 From: Niclas Edenvin Date: Fri, 16 May 2025 13:35:15 +0000 Subject: [PATCH] Merged in fix/no-my-stay-for-external-bookings (pull request #2126) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: Only link web and app bookings to my stay Approved-by: Joakim Jäderberg --- .../DynamicContent/Stays/StayCard/index.tsx | 97 +++++++++++-------- 1 file changed, 55 insertions(+), 42 deletions(-) diff --git a/apps/scandic-web/components/Blocks/DynamicContent/Stays/StayCard/index.tsx b/apps/scandic-web/components/Blocks/DynamicContent/Stays/StayCard/index.tsx index c496813e9..ba5387da4 100644 --- a/apps/scandic-web/components/Blocks/DynamicContent/Stays/StayCard/index.tsx +++ b/apps/scandic-web/components/Blocks/DynamicContent/Stays/StayCard/index.tsx @@ -18,13 +18,37 @@ import styles from "./stay.module.css" import type { StayCardProps } from "@/types/components/myPages/stays/stayCard" export default function StayCard({ stay }: StayCardProps) { - const lang = useLang() - // TODO: Temporary loading. Remove when current web is deleted. const [loading, setLoading] = useState(false) - const { checkinDate, checkoutDate, hotelInformation, bookingUrl } = - stay.attributes + const { bookingUrl, isWebAppOrigin } = stay.attributes + + const shouldLinkToMyStay = isWebAppOrigin + + if (!shouldLinkToMyStay) { + return + } + + return ( + setLoading(true)} + > + + {loading && ( +
+ +
+ )} + + ) +} + +function CardContent({ stay }: StayCardProps) { + const lang = useLang() + + const { checkinDate, checkoutDate, hotelInformation } = stay.attributes const arrival = dt(checkinDate).locale(lang) const arrivalDate = arrival.format("DD MMM") @@ -34,44 +58,33 @@ export default function StayCard({ stay }: StayCardProps) { const departDateTime = depart.format("YYYY-MM-DD") return ( - setLoading(true)} - > -
- {hotelInformation.hotelContent.images.metaData.altText} -
- - {hotelInformation.hotelName} - -
- - - - - {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} - {" - "} - - - -
-
-
- {loading && ( -
- +
+ {hotelInformation.hotelContent.images.metaData.altText} + +
) }