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} +
+