fix(SW-712): remove hotelFacts.hotelFacilityDetail, hotelFacts.hotelInformation and use detailedFacilities
This commit is contained in:
@@ -16,22 +16,17 @@ import Contact from "../Contact"
|
||||
import styles from "./readMore.module.css"
|
||||
|
||||
import {
|
||||
DetailedAmenity,
|
||||
ParkingProps,
|
||||
ReadMoreProps,
|
||||
} from "@/types/components/hotelReservation/selectHotel/selectHotel"
|
||||
import { Hotel } from "@/types/hotel"
|
||||
import type { Amenities,Hotel } from "@/types/hotel"
|
||||
|
||||
function getAmenitiesList(hotel: Hotel) {
|
||||
const detailedAmenities: DetailedAmenity[] = Object.entries(
|
||||
hotel.hotelFacts.hotelFacilityDetail
|
||||
).map(([key, value]) => ({ name: key, ...value }))
|
||||
|
||||
// Remove Parking facilities since parking accordion is based on hotel.parking
|
||||
const simpleAmenities = hotel.detailedFacilities.filter(
|
||||
(facility) => !facility.name.startsWith("Parking")
|
||||
const detailedAmenities: Amenities = hotel.detailedFacilities.filter(
|
||||
// Remove Parking facilities since parking accordion is based on hotel.parking
|
||||
(facility) => !facility.name.startsWith("Parking") && facility.public
|
||||
)
|
||||
return [...detailedAmenities, ...simpleAmenities]
|
||||
return detailedAmenities
|
||||
}
|
||||
|
||||
export default function ReadMore({ label, hotel, hotelId }: ReadMoreProps) {
|
||||
@@ -80,11 +75,7 @@ export default function ReadMore({ label, hotel, hotelId }: ReadMoreProps) {
|
||||
TODO: What content should be in the accessibility section?
|
||||
</AccordionItem>
|
||||
{amenitiesList.map((amenity) => {
|
||||
return "description" in amenity ? (
|
||||
<AccordionItem key={amenity.name} title={amenity.heading}>
|
||||
{amenity.description}
|
||||
</AccordionItem>
|
||||
) : (
|
||||
return (
|
||||
<div key={amenity.id} className={styles.amenity}>
|
||||
{amenity.name}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user