Feat/lokalise rebuild * chore(lokalise): update translation ids * chore(lokalise): easier to switch between projects * chore(lokalise): update translation ids * . * . * . * . * . * . * chore(lokalise): update translation ids * chore(lokalise): update translation ids * . * . * . * chore(lokalise): update translation ids * chore(lokalise): update translation ids * . * . * chore(lokalise): update translation ids * chore(lokalise): update translation ids * chore(lokalise): new translations * merge * switch to errors for missing id's * merge * sync translations Approved-by: Linus Flood
82 lines
2.1 KiB
TypeScript
82 lines
2.1 KiB
TypeScript
import { Suspense } from "react"
|
|
|
|
import {
|
|
type HotelSortItem,
|
|
HotelSortOption,
|
|
} from "@scandic-hotels/trpc/types/hotel"
|
|
import { getFiltersFromHotels } from "@scandic-hotels/trpc/utils/getFiltersFromHotels"
|
|
|
|
import { getHotelsByCSFilter } from "@/lib/trpc/memoizedRequests"
|
|
|
|
import { getIntl } from "@/i18n"
|
|
import { getLang } from "@/i18n/serverContext"
|
|
import HotelListingDataProvider from "@/providers/HotelListingDataProvider"
|
|
|
|
import CampaignHotelListingSkeleton from "./CampaignHotelListingSkeleton"
|
|
import CampaignHotelListingClient from "./Client"
|
|
|
|
interface CampaignHotelListingProps {
|
|
heading: string
|
|
preamble?: string | null
|
|
hotelIds: string[]
|
|
bookingCode?: string | null
|
|
visibleCountMobile?: 3 | 6
|
|
visibleCountDesktop?: 3 | 6
|
|
isMainBlock?: boolean
|
|
}
|
|
|
|
export default async function CampaignHotelListing({
|
|
heading,
|
|
preamble,
|
|
hotelIds,
|
|
bookingCode,
|
|
visibleCountMobile = 3,
|
|
visibleCountDesktop = 6,
|
|
isMainBlock = false,
|
|
}: CampaignHotelListingProps) {
|
|
const intl = await getIntl()
|
|
const lang = await getLang()
|
|
const hotels = await getHotelsByCSFilter({ hotelsToInclude: hotelIds })
|
|
|
|
if (!hotels.length) {
|
|
return null
|
|
}
|
|
|
|
const allFilters = getFiltersFromHotels(hotels, lang)
|
|
const sortItems: HotelSortItem[] = [
|
|
{
|
|
label: intl.formatMessage({
|
|
id: "common.name",
|
|
defaultMessage: "Name",
|
|
}),
|
|
value: HotelSortOption.Name,
|
|
},
|
|
{
|
|
label: intl.formatMessage({
|
|
id: "common.tripAdvisorRating",
|
|
defaultMessage: "TripAdvisor rating",
|
|
}),
|
|
value: HotelSortOption.TripAdvisorRating,
|
|
},
|
|
]
|
|
|
|
return (
|
|
<Suspense fallback={<CampaignHotelListingSkeleton />}>
|
|
<HotelListingDataProvider
|
|
allHotels={hotels}
|
|
allFilters={allFilters}
|
|
sortItems={sortItems}
|
|
>
|
|
<CampaignHotelListingClient
|
|
heading={heading}
|
|
preamble={preamble}
|
|
bookingCode={bookingCode}
|
|
visibleCountMobile={visibleCountMobile}
|
|
visibleCountDesktop={visibleCountDesktop}
|
|
isMainBlock={isMainBlock}
|
|
/>
|
|
</HotelListingDataProvider>
|
|
</Suspense>
|
|
)
|
|
}
|