([]);
const [coverImageIndex, setCoverImageIndex] = useState(1);
@@ -138,6 +140,8 @@ export default function EditListingPage({ params }: { params: { id: string } })
setHasFreeParking(listing.hasFreeParking);
setHasSkiPass(listing.hasSkiPass);
setEvChargingAvailable(listing.evChargingAvailable);
+ setEvChargingOnSite(Boolean(listing.evChargingOnSite));
+ setWheelchairAccessible(Boolean(listing.wheelchairAccessible));
setCalendarUrls((listing.calendarUrls || []).join('\n'));
if (listing.images?.length) {
const coverIdx = listing.images.find((img: any) => img.isCover)?.order ?? 1;
@@ -255,6 +259,39 @@ export default function EditListingPage({ params }: { params: { id: string } })
}
}
+ function toggleEvChargingNearby(next: boolean) {
+ setEvChargingAvailable(next);
+ if (!next) {
+ setEvChargingOnSite(false);
+ }
+ }
+
+ function toggleEvChargingOnSite(next: boolean) {
+ setEvChargingOnSite(next);
+ if (next) {
+ setEvChargingAvailable(true);
+ }
+ }
+
+ const amenityOptions = [
+ { key: 'sauna', label: t('amenitySauna'), icon: '🧖', checked: hasSauna, toggle: setHasSauna },
+ { key: 'fireplace', label: t('amenityFireplace'), icon: '🔥', checked: hasFireplace, toggle: setHasFireplace },
+ { key: 'wifi', label: t('amenityWifi'), icon: '📶', checked: hasWifi, toggle: setHasWifi },
+ { key: 'pets', label: t('amenityPets'), icon: '🐾', checked: petsAllowed, toggle: setPetsAllowed },
+ { key: 'lake', label: t('amenityLake'), icon: '🌊', checked: byTheLake, toggle: setByTheLake },
+ { key: 'ac', label: t('amenityAirConditioning'), icon: '❄️', checked: hasAirConditioning, toggle: setHasAirConditioning },
+ { key: 'kitchen', label: t('amenityKitchen'), icon: '🍽️', checked: hasKitchen, toggle: setHasKitchen },
+ { key: 'dishwasher', label: t('amenityDishwasher'), icon: '🧼', checked: hasDishwasher, toggle: setHasDishwasher },
+ { key: 'washer', label: t('amenityWashingMachine'), icon: '🧺', checked: hasWashingMachine, toggle: setHasWashingMachine },
+ { key: 'barbecue', label: t('amenityBarbecue'), icon: '🍖', checked: hasBarbecue, toggle: setHasBarbecue },
+ { key: 'microwave', label: t('amenityMicrowave'), icon: '🍲', checked: hasMicrowave, toggle: setHasMicrowave },
+ { key: 'parking', label: t('amenityFreeParking'), icon: '🅿️', checked: hasFreeParking, toggle: setHasFreeParking },
+ { key: 'ski', label: t('amenitySkiPass'), icon: '⛷️', checked: hasSkiPass, toggle: setHasSkiPass },
+ { key: 'ev', label: t('amenityEvNearby'), icon: '⚡', checked: evChargingAvailable, toggle: toggleEvChargingNearby },
+ { key: 'ev-onsite', label: t('amenityEvOnSite'), icon: '🔌', checked: evChargingOnSite, toggle: toggleEvChargingOnSite },
+ { key: 'accessible', label: t('amenityWheelchairAccessible'), icon: '♿', checked: wheelchairAccessible, toggle: setWheelchairAccessible },
+ ];
+
async function checkSlugAvailability() {
const value = slug.trim().toLowerCase();
if (!value) {
@@ -422,7 +459,10 @@ export default function EditListingPage({ params }: { params: { id: string } })
hasBarbecue,
hasMicrowave,
hasFreeParking,
+ hasSkiPass,
evChargingAvailable,
+ evChargingOnSite,
+ wheelchairAccessible,
coverImageIndex,
images: selectedImages.length ? parseImages() : undefined,
calendarUrls,
@@ -644,15 +684,38 @@ export default function EditListingPage({ params }: { params: { id: string } })
+ {t('priceHintHelp')}
+
-
-
{t('amenities')}
-
- {[
- { label: t('amenitySauna'), state: hasSauna, set: setHasSauna },
- { label: t('amenityFireplace'), state: hasFireplace, set: setHasFireplace },
- { label: t('amenityWifi'), state: hasWifi, set: setHasWifi },
- { label: t('amenityPets'), state: petsAllowed, set: setPetsAllowed },
- { label: t('amenityLake'), state: byTheLake, set: setByTheLake },
- { label: t('amenityAirConditioning'), state: hasAirConditioning, set: setHasAirConditioning },
- { label: t('amenityKitchen'), state: hasKitchen, set: setHasKitchen },
- { label: t('amenityDishwasher'), state: hasDishwasher, set: setHasDishwasher },
- { label: t('amenityWashingMachine'), state: hasWashingMachine, set: setHasWashingMachine },
- { label: t('amenityBarbecue'), state: hasBarbecue, set: setHasBarbecue },
- { label: t('amenityMicrowave'), state: hasMicrowave, set: setHasMicrowave },
- { label: t('amenityFreeParking'), state: hasFreeParking, set: setHasFreeParking },
- { label: t('amenitySkiPass'), state: hasSkiPass, set: setHasSkiPass },
- { label: t('amenityEvAvailable'), state: evChargingAvailable, set: setEvChargingAvailable },
- ].map((item) => (
-
+
+
{t('listingAmenities')}
+
+ {amenityOptions.map((option) => (
+
))}
@@ -708,26 +770,13 @@ export default function EditListingPage({ params }: { params: { id: string } })
{(img.size / 1024).toFixed(0)} KB · {img.mimeType || 'image/jpeg'}
-
{t('coverChoice', { index: idx + 1 })}
-
- ))}
-
- ) : (
- {t('imagesHelp', { count: MAX_IMAGES, sizeMb: Math.floor(MAX_IMAGE_BYTES / 1024 / 1024) })}
- )}
-
-
+
{t('coverChoice', { index: idx + 1 })}
+
+ ))}
+ ) : (
+ {t('imagesHelp', { count: MAX_IMAGES, sizeMb: Math.floor(MAX_IMAGE_BYTES / 1024 / 1024) })}
+ )}