feat(SW-2973): Added bookingCode if available to links inside campaign pages
* feat(SW-2973): Moved block types to trpc lib Approved-by: Matilda Landström
This commit is contained in:
@@ -24,6 +24,7 @@ import styles from "./campaignHotelListing.module.css"
|
||||
interface CampaignHotelListingClientProps {
|
||||
heading: string
|
||||
preamble?: string | null
|
||||
bookingCode?: string | null
|
||||
visibleCountMobile: 3 | 6
|
||||
visibleCountDesktop: 3 | 6
|
||||
isMainBlock: boolean
|
||||
@@ -35,6 +36,7 @@ export default function CampaignHotelListingClient({
|
||||
visibleCountMobile,
|
||||
visibleCountDesktop,
|
||||
isMainBlock,
|
||||
bookingCode,
|
||||
}: CampaignHotelListingClientProps) {
|
||||
const intl = useIntl()
|
||||
const isMobile = useMediaQuery("(max-width: 767px)")
|
||||
@@ -119,16 +121,24 @@ export default function CampaignHotelListingClient({
|
||||
) : null}
|
||||
</header>
|
||||
<ul className={styles.list}>
|
||||
{activeHotels.map(({ hotel, url }, index) => (
|
||||
<li
|
||||
key={hotel.id}
|
||||
className={cx(styles.listItem, {
|
||||
[styles.hidden]: index >= visibleCount,
|
||||
})}
|
||||
>
|
||||
<HotelListingItem hotel={hotel} url={url} />
|
||||
</li>
|
||||
))}
|
||||
{activeHotels.map(({ hotel, url }, index) => {
|
||||
const urlWithOptionalBookingCode = bookingCode
|
||||
? `${url}?bookingCode=${bookingCode}`
|
||||
: url
|
||||
return (
|
||||
<li
|
||||
key={hotel.id}
|
||||
className={cx(styles.listItem, {
|
||||
[styles.hidden]: index >= visibleCount,
|
||||
})}
|
||||
>
|
||||
<HotelListingItem
|
||||
hotel={hotel}
|
||||
url={urlWithOptionalBookingCode}
|
||||
/>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
|
||||
{showButton ? (
|
||||
|
||||
@@ -19,6 +19,7 @@ interface CampaignHotelListingProps {
|
||||
heading: string
|
||||
preamble?: string | null
|
||||
hotelIds: string[]
|
||||
bookingCode?: string | null
|
||||
visibleCountMobile?: 3 | 6
|
||||
visibleCountDesktop?: 3 | 6
|
||||
isMainBlock?: boolean
|
||||
@@ -28,6 +29,7 @@ export default async function CampaignHotelListing({
|
||||
heading,
|
||||
preamble,
|
||||
hotelIds,
|
||||
bookingCode,
|
||||
visibleCountMobile = 3,
|
||||
visibleCountDesktop = 6,
|
||||
isMainBlock = false,
|
||||
@@ -66,6 +68,7 @@ export default async function CampaignHotelListing({
|
||||
<CampaignHotelListingClient
|
||||
heading={heading}
|
||||
preamble={preamble}
|
||||
bookingCode={bookingCode}
|
||||
visibleCountMobile={visibleCountMobile}
|
||||
visibleCountDesktop={visibleCountDesktop}
|
||||
isMainBlock={isMainBlock}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Suspense } from "react"
|
||||
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
|
||||
import CardsGrid from "@/components/Blocks/CardsGrid"
|
||||
import CarouselCards from "@/components/Blocks/CarouselCards"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
|
||||
import CampaignHotelListing from "@/components/Blocks/CampaignHotelListing"
|
||||
import CarouselCards from "@/components/Blocks/CarouselCards"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Suspense } from "react"
|
||||
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
|
||||
import AccordionSection from "@/components/Blocks/Accordion"
|
||||
import CampaignHotelListing from "@/components/Blocks/CampaignHotelListing"
|
||||
@@ -8,7 +8,11 @@ import CampaignHotelListingSkeleton from "@/components/Blocks/CampaignHotelListi
|
||||
import CarouselCards from "@/components/Blocks/CarouselCards"
|
||||
import Essentials from "@/components/Blocks/Essentials"
|
||||
|
||||
import type { BlocksProps } from "@/types/components/blocks"
|
||||
import type { Block as CampaignPageBlock } from "@scandic-hotels/trpc/types/campaignPage"
|
||||
|
||||
interface BlocksProps {
|
||||
blocks: CampaignPageBlock[]
|
||||
}
|
||||
|
||||
export default function Blocks({ blocks }: BlocksProps) {
|
||||
return blocks.map(async (block) => {
|
||||
@@ -39,6 +43,7 @@ export default function Blocks({ blocks }: BlocksProps) {
|
||||
heading={block.hotel_listing.heading}
|
||||
hotelIds={block.hotel_listing.hotelIds}
|
||||
isMainBlock={true}
|
||||
bookingCode={block.hotel_listing.bookingCode}
|
||||
/>
|
||||
</Suspense>
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
|
||||
import { useDestinationDataStore } from "@/stores/destination-data"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import Title from "@scandic-hotels/design-system/Title"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
|
||||
import { getStartPage } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
import { DynamicContentEnum } from "@scandic-hotels/trpc/types/dynamicContent"
|
||||
|
||||
import Overview from "@/components/Blocks/DynamicContent/Overview"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocksEnum"
|
||||
|
||||
import CardsGrid from "@/components/Blocks/CardsGrid"
|
||||
import DynamicContent from "@/components/Blocks/DynamicContent"
|
||||
@@ -8,7 +8,6 @@ import { getLang } from "@/i18n/serverContext"
|
||||
import { modWebviewLink } from "@/utils/webviews"
|
||||
|
||||
import type { BlocksProps } from "@/types/components/blocks"
|
||||
// import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
export default async function Blocks({ blocks }: BlocksProps) {
|
||||
const lang = await getLang()
|
||||
|
||||
Reference in New Issue
Block a user