updates
This commit is contained in:
@@ -23,7 +23,6 @@ import {
|
||||
Sparkles,
|
||||
Flame,
|
||||
Lock,
|
||||
Baby,
|
||||
Heart,
|
||||
MapPin,
|
||||
Building,
|
||||
@@ -31,13 +30,10 @@ import {
|
||||
Laptop,
|
||||
Smartphone,
|
||||
Monitor,
|
||||
Radio,
|
||||
Gamepad,
|
||||
Headphones,
|
||||
UtensilsCrossed as Restaurant,
|
||||
Briefcase,
|
||||
Printer,
|
||||
Mail,
|
||||
Clock,
|
||||
Sunrise,
|
||||
Moon,
|
||||
@@ -61,32 +57,32 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
if (Array.isArray(input)) return input;
|
||||
if (!input) return [];
|
||||
if (typeof input === 'string') {
|
||||
// Try JSON.parse first (stringified JSON)
|
||||
|
||||
try {
|
||||
const parsed = JSON.parse(input);
|
||||
if (Array.isArray(parsed)) return parsed;
|
||||
} catch (e) {
|
||||
// ignore
|
||||
|
||||
}
|
||||
|
||||
// Fallback: comma separated list
|
||||
|
||||
return input
|
||||
.split(',')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
// If it's an object with values as amenities
|
||||
|
||||
if (typeof input === 'object') {
|
||||
try {
|
||||
// Convert object values to array if possible
|
||||
|
||||
const vals = Object.values(input);
|
||||
if (Array.isArray(vals) && vals.length > 0) {
|
||||
// flatten nested arrays
|
||||
|
||||
return vals.flat().map((v: any) => String(v).trim()).filter(Boolean);
|
||||
}
|
||||
} catch (e) {
|
||||
// ignore
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,16 +91,16 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
|
||||
const safeAmenities = normalizeAmenities(amenities);
|
||||
|
||||
// Icon mapping for comprehensive amenities
|
||||
|
||||
const amenityIcons: Record<string, React.ReactNode> = {
|
||||
// Basic & Internet
|
||||
|
||||
wifi: <Wifi className="w-5 h-5" />,
|
||||
'wi-fi': <Wifi className="w-5 h-5" />,
|
||||
'free wifi': <Wifi className="w-5 h-5" />,
|
||||
'wifi in room': <Wifi className="w-5 h-5" />,
|
||||
'high-speed internet': <Wifi className="w-5 h-5" />,
|
||||
|
||||
// Entertainment
|
||||
|
||||
tv: <Tv className="w-5 h-5" />,
|
||||
television: <Tv className="w-5 h-5" />,
|
||||
'flat-screen tv': <Tv className="w-5 h-5" />,
|
||||
@@ -125,7 +121,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'surround sound': <Headphones className="w-5 h-5" />,
|
||||
'music system': <Music className="w-5 h-5" />,
|
||||
|
||||
// Climate
|
||||
|
||||
'air-conditioning': <Wind className="w-5 h-5" />,
|
||||
'air conditioning': <Wind className="w-5 h-5" />,
|
||||
ac: <Wind className="w-5 h-5" />,
|
||||
@@ -134,7 +130,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'ceiling fan': <Wind className="w-5 h-5" />,
|
||||
'air purifier': <Wind className="w-5 h-5" />,
|
||||
|
||||
// Bathroom
|
||||
|
||||
'private bathroom': <Bath className="w-5 h-5" />,
|
||||
'ensuite bathroom': <Bath className="w-5 h-5" />,
|
||||
bathtub: <Bath className="w-5 h-5" />,
|
||||
@@ -153,7 +149,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'premium toiletries': <Bath className="w-5 h-5" />,
|
||||
towels: <Bath className="w-5 h-5" />,
|
||||
|
||||
// Food & Beverage
|
||||
|
||||
'mini bar': <Coffee className="w-5 h-5" />,
|
||||
minibar: <Coffee className="w-5 h-5" />,
|
||||
refrigerator: <Coffee className="w-5 h-5" />,
|
||||
@@ -173,7 +169,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'complimentary water': <Coffee className="w-5 h-5" />,
|
||||
'bottled water': <Coffee className="w-5 h-5" />,
|
||||
|
||||
// Furniture
|
||||
|
||||
desk: <Briefcase className="w-5 h-5" />,
|
||||
'writing desk': <Briefcase className="w-5 h-5" />,
|
||||
'office desk': <Briefcase className="w-5 h-5" />,
|
||||
@@ -190,7 +186,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'full-length mirror': <Sparkles className="w-5 h-5" />,
|
||||
'seating area': <Sofa className="w-5 h-5" />,
|
||||
|
||||
// Bed & Sleep
|
||||
|
||||
'king size bed': <Bed className="w-5 h-5" />,
|
||||
'queen size bed': <Bed className="w-5 h-5" />,
|
||||
'double bed': <Bed className="w-5 h-5" />,
|
||||
@@ -202,7 +198,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'blackout curtains': <Moon className="w-5 h-5" />,
|
||||
soundproofing: <Shield className="w-5 h-5" />,
|
||||
|
||||
// Safety & Security
|
||||
|
||||
safe: <Shield className="w-5 h-5" />,
|
||||
'in-room safe': <Shield className="w-5 h-5" />,
|
||||
'safety deposit box': <Shield className="w-5 h-5" />,
|
||||
@@ -212,7 +208,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'key card access': <Key className="w-5 h-5" />,
|
||||
'door lock': <Lock className="w-5 h-5" />,
|
||||
|
||||
// Technology
|
||||
|
||||
'usb charging ports': <Zap className="w-5 h-5" />,
|
||||
'usb ports': <Zap className="w-5 h-5" />,
|
||||
'usb outlets': <Zap className="w-5 h-5" />,
|
||||
@@ -226,7 +222,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'alarm clock': <Clock className="w-5 h-5" />,
|
||||
'digital clock': <Clock className="w-5 h-5" />,
|
||||
|
||||
// View & Outdoor
|
||||
|
||||
balcony: <MapPin className="w-5 h-5" />,
|
||||
'private balcony': <MapPin className="w-5 h-5" />,
|
||||
terrace: <MapPin className="w-5 h-5" />,
|
||||
@@ -242,7 +238,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'large windows': <Eye className="w-5 h-5" />,
|
||||
'floor-to-ceiling windows': <Eye className="w-5 h-5" />,
|
||||
|
||||
// Services
|
||||
|
||||
'24-hour front desk': <Building className="w-5 h-5" />,
|
||||
'24 hour front desk': <Building className="w-5 h-5" />,
|
||||
'24/7 front desk': <Building className="w-5 h-5" />,
|
||||
@@ -268,7 +264,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'car rental': <Car className="w-5 h-5" />,
|
||||
'taxi service': <Car className="w-5 h-5" />,
|
||||
|
||||
// Fitness & Wellness
|
||||
|
||||
'gym access': <Dumbbell className="w-5 h-5" />,
|
||||
'fitness center': <Dumbbell className="w-5 h-5" />,
|
||||
'fitness room': <Dumbbell className="w-5 h-5" />,
|
||||
@@ -281,7 +277,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'massage service': <Heart className="w-5 h-5" />,
|
||||
'beauty services': <Sparkles className="w-5 h-5" />,
|
||||
|
||||
// Recreation
|
||||
|
||||
'swimming pool': <Waves className="w-5 h-5" />,
|
||||
pool: <Waves className="w-5 h-5" />,
|
||||
'indoor pool': <Waves className="w-5 h-5" />,
|
||||
@@ -293,7 +289,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'beach access': <Waves className="w-5 h-5" />,
|
||||
'water sports': <Waves className="w-5 h-5" />,
|
||||
|
||||
// Business
|
||||
|
||||
'business center': <Briefcase className="w-5 h-5" />,
|
||||
'meeting room': <Briefcase className="w-5 h-5" />,
|
||||
'conference room': <Briefcase className="w-5 h-5" />,
|
||||
@@ -302,7 +298,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'printing service': <Printer className="w-5 h-5" />,
|
||||
'secretarial services': <Briefcase className="w-5 h-5" />,
|
||||
|
||||
// Accessibility
|
||||
|
||||
'wheelchair accessible': <Accessibility className="w-5 h-5" />,
|
||||
'accessible room': <Accessibility className="w-5 h-5" />,
|
||||
'elevator access': <Accessibility className="w-5 h-5" />,
|
||||
@@ -313,7 +309,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'hearing accessible': <Ear className="w-5 h-5" />,
|
||||
'visual alarm': <Eye className="w-5 h-5" />,
|
||||
|
||||
// Family & Pets
|
||||
|
||||
'family room': <Users className="w-5 h-5" />,
|
||||
'kids welcome': <BabyIcon className="w-5 h-5" />,
|
||||
'baby crib': <BabyIcon className="w-5 h-5" />,
|
||||
@@ -324,7 +320,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
pets: <PawPrint className="w-5 h-5" />,
|
||||
'pet friendly': <PawPrint className="w-5 h-5" />,
|
||||
|
||||
// Additional
|
||||
|
||||
'smoking room': <Cigarette className="w-5 h-5" />,
|
||||
'non-smoking room': <Shield className="w-5 h-5" />,
|
||||
'no smoking': <Cigarette className="w-5 h-5" />,
|
||||
@@ -345,7 +341,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
umbrella: <Home className="w-5 h-5" />,
|
||||
'shoe shine service': <Sparkles className="w-5 h-5" />,
|
||||
|
||||
// Luxury
|
||||
|
||||
fireplace: <Fireplace className="w-5 h-5" />,
|
||||
jacuzzi: <Waves className="w-5 h-5" />,
|
||||
'spa bath': <Bath className="w-5 h-5" />,
|
||||
@@ -360,10 +356,10 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'private elevator': <Building className="w-5 h-5" />,
|
||||
'panic button': <Shield className="w-5 h-5" />,
|
||||
|
||||
// Restaurant
|
||||
|
||||
restaurant: <Restaurant className="w-5 h-5" />,
|
||||
|
||||
// Special
|
||||
|
||||
library: <Briefcase className="w-5 h-5" />,
|
||||
'reading room': <Briefcase className="w-5 h-5" />,
|
||||
'study room': <Briefcase className="w-5 h-5" />,
|
||||
@@ -377,14 +373,14 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
};
|
||||
|
||||
const amenityLabels: Record<string, string> = {
|
||||
// Basic & Internet
|
||||
|
||||
wifi: 'Wi‑Fi',
|
||||
'wi-fi': 'Wi‑Fi',
|
||||
'free wifi': 'Free WiFi',
|
||||
'wifi in room': 'WiFi in Room',
|
||||
'high-speed internet': 'High-Speed Internet',
|
||||
|
||||
// Entertainment
|
||||
|
||||
tv: 'TV',
|
||||
television: 'TV',
|
||||
'flat-screen tv': 'Flat-Screen TV',
|
||||
@@ -405,7 +401,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'surround sound': 'Surround Sound',
|
||||
'music system': 'Music System',
|
||||
|
||||
// Climate
|
||||
|
||||
'air-conditioning': 'Air Conditioning',
|
||||
'air conditioning': 'Air Conditioning',
|
||||
ac: 'Air Conditioning',
|
||||
@@ -414,7 +410,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'ceiling fan': 'Ceiling Fan',
|
||||
'air purifier': 'Air Purifier',
|
||||
|
||||
// Bathroom
|
||||
|
||||
'private bathroom': 'Private Bathroom',
|
||||
'ensuite bathroom': 'Ensuite Bathroom',
|
||||
bathtub: 'Bathtub',
|
||||
@@ -433,7 +429,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'premium toiletries': 'Premium Toiletries',
|
||||
towels: 'Towels',
|
||||
|
||||
// Food & Beverage
|
||||
|
||||
'mini bar': 'Mini Bar',
|
||||
minibar: 'Mini Bar',
|
||||
refrigerator: 'Refrigerator',
|
||||
@@ -453,7 +449,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'complimentary water': 'Complimentary Water',
|
||||
'bottled water': 'Bottled Water',
|
||||
|
||||
// Furniture
|
||||
|
||||
desk: 'Desk',
|
||||
'writing desk': 'Writing Desk',
|
||||
'office desk': 'Office Desk',
|
||||
@@ -470,7 +466,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'full-length mirror': 'Full-Length Mirror',
|
||||
'seating area': 'Seating Area',
|
||||
|
||||
// Bed & Sleep
|
||||
|
||||
'king size bed': 'King Size Bed',
|
||||
'queen size bed': 'Queen Size Bed',
|
||||
'double bed': 'Double Bed',
|
||||
@@ -482,7 +478,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'blackout curtains': 'Blackout Curtains',
|
||||
soundproofing: 'Soundproofing',
|
||||
|
||||
// Safety & Security
|
||||
|
||||
safe: 'Safe',
|
||||
'in-room safe': 'In-Room Safe',
|
||||
'safety deposit box': 'Safety Deposit Box',
|
||||
@@ -492,7 +488,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'key card access': 'Key Card Access',
|
||||
'door lock': 'Door Lock',
|
||||
|
||||
// Technology
|
||||
|
||||
'usb charging ports': 'USB Charging Ports',
|
||||
'usb ports': 'USB Ports',
|
||||
'usb outlets': 'USB Outlets',
|
||||
@@ -506,7 +502,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'alarm clock': 'Alarm Clock',
|
||||
'digital clock': 'Digital Clock',
|
||||
|
||||
// View & Outdoor
|
||||
|
||||
balcony: 'Balcony',
|
||||
'private balcony': 'Private Balcony',
|
||||
terrace: 'Terrace',
|
||||
@@ -522,7 +518,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'large windows': 'Large Windows',
|
||||
'floor-to-ceiling windows': 'Floor-to-Ceiling Windows',
|
||||
|
||||
// Services
|
||||
|
||||
'24-hour front desk': '24/7 Front Desk',
|
||||
'24 hour front desk': '24/7 Front Desk',
|
||||
'24/7 front desk': '24/7 Front Desk',
|
||||
@@ -548,7 +544,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'car rental': 'Car Rental',
|
||||
'taxi service': 'Taxi Service',
|
||||
|
||||
// Fitness & Wellness
|
||||
|
||||
'gym access': 'Gym Access',
|
||||
'fitness center': 'Fitness Center',
|
||||
'fitness room': 'Fitness Room',
|
||||
@@ -561,7 +557,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'massage service': 'Massage Service',
|
||||
'beauty services': 'Beauty Services',
|
||||
|
||||
// Recreation
|
||||
|
||||
'swimming pool': 'Swimming Pool',
|
||||
pool: 'Swimming Pool',
|
||||
'indoor pool': 'Indoor Pool',
|
||||
@@ -573,7 +569,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'beach access': 'Beach Access',
|
||||
'water sports': 'Water Sports',
|
||||
|
||||
// Business
|
||||
|
||||
'business center': 'Business Center',
|
||||
'meeting room': 'Meeting Room',
|
||||
'conference room': 'Conference Room',
|
||||
@@ -582,7 +578,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'printing service': 'Printing Service',
|
||||
'secretarial services': 'Secretarial Services',
|
||||
|
||||
// Accessibility
|
||||
|
||||
'wheelchair accessible': 'Wheelchair Accessible',
|
||||
'accessible room': 'Accessible Room',
|
||||
'elevator access': 'Elevator Access',
|
||||
@@ -593,7 +589,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'hearing accessible': 'Hearing Accessible',
|
||||
'visual alarm': 'Visual Alarm',
|
||||
|
||||
// Family & Pets
|
||||
|
||||
'family room': 'Family Room',
|
||||
'kids welcome': 'Kids Welcome',
|
||||
'baby crib': 'Baby Crib',
|
||||
@@ -604,7 +600,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
pets: 'Pets Allowed',
|
||||
'pet friendly': 'Pet Friendly',
|
||||
|
||||
// Additional
|
||||
|
||||
'smoking room': 'Smoking Room',
|
||||
'non-smoking room': 'Non-Smoking Room',
|
||||
'no smoking': 'No Smoking',
|
||||
@@ -625,7 +621,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
umbrella: 'Umbrella',
|
||||
'shoe shine service': 'Shoe Shine Service',
|
||||
|
||||
// Luxury
|
||||
|
||||
fireplace: 'Fireplace',
|
||||
jacuzzi: 'Jacuzzi',
|
||||
'spa bath': 'Spa Bath',
|
||||
@@ -640,10 +636,10 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
'private elevator': 'Private Elevator',
|
||||
'panic button': 'Panic Button',
|
||||
|
||||
// Restaurant
|
||||
|
||||
restaurant: 'Restaurant',
|
||||
|
||||
// Special
|
||||
|
||||
library: 'Library',
|
||||
'reading room': 'Reading Room',
|
||||
'study room': 'Study Room',
|
||||
@@ -684,7 +680,7 @@ const RoomAmenities: React.FC<RoomAmenitiesProps> = ({
|
||||
const getLabel = (amenity: string) => {
|
||||
const key = amenity.toLowerCase().trim();
|
||||
if (amenityLabels[key]) return amenityLabels[key];
|
||||
// Fallback: capitalize words and replace dashes/underscores
|
||||
|
||||
return amenity
|
||||
.toLowerCase()
|
||||
.replace(/[_-]/g, ' ')
|
||||
|
||||
Reference in New Issue
Block a user