Merged in feat/SW-3229-filter-map-pois (pull request #2644)
feat(SW-3229): filter map card pois * feat(SW-3229): filter map card pois Approved-by: Erik Tiekstra
This commit is contained in:
@@ -41,6 +41,7 @@ import { Rooms } from "./Rooms"
|
||||
import SidePeeks from "./SidePeeks"
|
||||
import TabNavigation from "./TabNavigation"
|
||||
import {
|
||||
getFilteredSlicedPois,
|
||||
getPageSectionsData,
|
||||
getTrackingHotelData,
|
||||
getTrackingPageData,
|
||||
@@ -230,7 +231,10 @@ export default async function HotelPage({ hotelId }: HotelPageProps) {
|
||||
hotelName={name}
|
||||
markerInfo={{ hotelType, hotelId }}
|
||||
/>
|
||||
<MapCard hotelName={name} pois={pointsOfInterest.slice(0, 3)} />
|
||||
<MapCard
|
||||
hotelName={name}
|
||||
pois={getFilteredSlicedPois(pointsOfInterest)}
|
||||
/>
|
||||
</MapWithCardWrapper>
|
||||
</aside>
|
||||
<MobileMapToggle />
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import { logger } from "@scandic-hotels/common/logger"
|
||||
import { PointOfInterestGroupEnum } from "@scandic-hotels/trpc/enums/pointOfInterest"
|
||||
|
||||
import type { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import type { Hotel, HotelData } from "@scandic-hotels/trpc/types/hotel"
|
||||
import type {
|
||||
Hotel,
|
||||
HotelData,
|
||||
PointOfInterest,
|
||||
} from "@scandic-hotels/trpc/types/hotel"
|
||||
import type { HotelPage } from "@scandic-hotels/trpc/types/hotelPage"
|
||||
import type { IntlShape } from "react-intl"
|
||||
|
||||
@@ -186,3 +191,15 @@ export function getPageSectionsData(
|
||||
|
||||
return sections
|
||||
}
|
||||
|
||||
export function getFilteredSlicedPois(pois: PointOfInterest[]) {
|
||||
return pois
|
||||
.filter(
|
||||
(poi) =>
|
||||
poi.categoryName === PointOfInterestGroupEnum.ATTRACTIONS ||
|
||||
poi.categoryName === PointOfInterestGroupEnum.LOCATION ||
|
||||
poi.categoryName === PointOfInterestGroupEnum.SHOPPING_DINING ||
|
||||
poi.categoryName === PointOfInterestGroupEnum.PUBLIC_TRANSPORT
|
||||
)
|
||||
.slice(0, 3)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user