From e77ed2407b89ed6e9f8e93e44e2259131793bd51 Mon Sep 17 00:00:00 2001 From: Hrishikesh Vaipurkar Date: Tue, 24 Jun 2025 07:39:18 +0000 Subject: [PATCH] Merged in feat/SW-3002-new-hotel-move-tripadvisor (pull request #2375) feat: SW-3002 Changed tripadvisor review subpage to Sidepeek * feat: SW-3002 Changed tripadvisor review subpage to Sidepeek * feat: SW-3002 Optimised styles Approved-by: Erik Tiekstra --- .../IntroSection/TripAdvisorLink/index.tsx | 4 +- .../HotelPage/SidePeeks/Tripadvisor/index.tsx | 87 +++++++++++++ .../Tripadvisor/tripAdvisor.module.css | 40 ++++++ .../ContentType/HotelPage/index.tsx | 6 + .../HotelSubpage/ReviewsSubpage/index.tsx | 121 ------------------ .../ReviewsSubpage/reviewsSubpage.module.css | 84 ------------ .../ContentType/HotelSubpage/index.tsx | 3 - .../types/components/hotelPage/hotelPage.ts | 1 + 8 files changed, 136 insertions(+), 210 deletions(-) create mode 100644 apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Tripadvisor/index.tsx create mode 100644 apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Tripadvisor/tripAdvisor.module.css delete mode 100644 apps/scandic-web/components/ContentType/HotelSubpage/ReviewsSubpage/index.tsx delete mode 100644 apps/scandic-web/components/ContentType/HotelSubpage/ReviewsSubpage/reviewsSubpage.module.css diff --git a/apps/scandic-web/components/ContentType/HotelPage/IntroSection/TripAdvisorLink/index.tsx b/apps/scandic-web/components/ContentType/HotelPage/IntroSection/TripAdvisorLink/index.tsx index 3da477547..0b935e71f 100644 --- a/apps/scandic-web/components/ContentType/HotelPage/IntroSection/TripAdvisorLink/index.tsx +++ b/apps/scandic-web/components/ContentType/HotelPage/IntroSection/TripAdvisorLink/index.tsx @@ -2,10 +2,10 @@ import TripadvisorIcon from "@scandic-hotels/design-system/Icons/TripadvisorIcon import Link from "@/components/TempDesignSystem/Link" import { getIntl } from "@/i18n" -import { appendSlugToPathname } from "@/utils/appendSlugToPathname" import styles from "./tripAdvisorLink.module.css" +import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage" import type { HotelTripAdvisor } from "@/types/hotel" interface TripAdvisorLinkProps { @@ -32,7 +32,7 @@ export default async function TripAdvisorLink({ const hasTripAdvisorIframeSrc = !!reviews.widgetScriptEmbedUrlIframe const tripAdvisorHref = hasTripAdvisorIframeSrc - ? await appendSlugToPathname("reviews") + ? `?s=${SidepeekSlugs.tripAdvisor}` : null if (!tripAdvisorHref) { diff --git a/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Tripadvisor/index.tsx b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Tripadvisor/index.tsx new file mode 100644 index 000000000..41e902aa3 --- /dev/null +++ b/apps/scandic-web/components/ContentType/HotelPage/SidePeeks/Tripadvisor/index.tsx @@ -0,0 +1,87 @@ +import { notFound } from "next/navigation" + +import Image from "@/components/Image" +import SidePeek from "@/components/TempDesignSystem/SidePeek" +import { getIntl } from "@/i18n" +import { getLang } from "@/i18n/serverContext" + +import styles from "./tripAdvisor.module.css" + +import { SidepeekSlugs } from "@/types/components/hotelPage/hotelPage" +import type { HotelRatings } from "@/types/hotel" + +type TripAdvisorSidePeekProps = { + hotelName: string + hotelRatings: HotelRatings + showNordicEcoLabel?: boolean +} + +export default async function TripAdvisorSidePeek({ + hotelName, + hotelRatings, + showNordicEcoLabel, +}: TripAdvisorSidePeekProps) { + const intl = await getIntl() + const lang = await getLang() + + const tripAdvisorData = hotelRatings?.tripAdvisor + if (!tripAdvisorData?.reviews.widgetScriptEmbedUrlIframe) { + notFound() + } + + const awardsLogos = tripAdvisorData.awards + .map((award) => ({ + imageUrl: award.images.small, + altText: award.displayName, + })) + .filter((award) => !!award.imageUrl) + + const hotelHasAwards = showNordicEcoLabel || awardsLogos.length > 0 + + return ( + +
+ {hotelHasAwards ? ( +
+ {showNordicEcoLabel ? ( + {intl.formatMessage({ + ) : null} + {awardsLogos?.map((award) => ( + {award.altText} + ))} +
+ ) : null} +
+