Handle missing capacity fields on listing view
This commit is contained in:
parent
3c3fb10c2c
commit
fb564e8b2f
2 changed files with 10 additions and 1 deletions
|
|
@ -77,7 +77,13 @@ export default async function ListingPage({ params }: ListingPageProps) {
|
|||
listing.hasFreeParking ? { icon: amenityIcons.parking, label: t('amenityFreeParking') } : null,
|
||||
].filter(Boolean) as { icon: string; label: string }[];
|
||||
const addressLine = `${listing.streetAddress ? `${listing.streetAddress}, ` : ''}${listing.city}, ${listing.region}, ${listing.country}`;
|
||||
const capacityLine = `${t('capacityGuests', { count: listing.maxGuests })} · ${t('capacityBedrooms', { count: listing.bedrooms })} · ${t('capacityBeds', { count: listing.beds })} · ${t('capacityBathrooms', { count: listing.bathrooms })}`;
|
||||
const capacityParts = [
|
||||
listing.maxGuests ? t('capacityGuests', { count: listing.maxGuests }) : null,
|
||||
listing.bedrooms ? t('capacityBedrooms', { count: listing.bedrooms }) : null,
|
||||
listing.beds ? t('capacityBeds', { count: listing.beds }) : null,
|
||||
listing.bathrooms ? t('capacityBathrooms', { count: listing.bathrooms }) : null,
|
||||
].filter(Boolean) as string[];
|
||||
const capacityLine = capacityParts.length ? capacityParts.join(' · ') : t('capacityUnknown');
|
||||
const contactLine = `${listing.contactName} · ${listing.contactEmail}${listing.contactPhone ? ` · ${listing.contactPhone}` : ''}`;
|
||||
const coverImage = listing.images.find((img) => img.isCover) ?? listing.images[0] ?? null;
|
||||
const priceLine =
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ const baseMessages = {
|
|||
capacityBedrooms: '{count} bedrooms',
|
||||
capacityBeds: '{count} beds',
|
||||
capacityBathrooms: '{count} bathrooms',
|
||||
capacityUnknown: 'Capacity not set',
|
||||
browseListingsTitle: 'Browse listings',
|
||||
browseListingsLead: 'Search public listings, filter by location, and explore them on the map.',
|
||||
sampleBadge: 'Sample',
|
||||
|
|
@ -524,6 +525,7 @@ const baseMessages = {
|
|||
capacityBedrooms: '{count} makuuhuonetta',
|
||||
capacityBeds: '{count} vuodetta',
|
||||
capacityBathrooms: '{count} kylpyhuonetta',
|
||||
capacityUnknown: 'Kapasiteettia ei ole asetettu',
|
||||
browseListingsTitle: 'Selaa kohteita',
|
||||
browseListingsLead: 'Hae julkaistuja kohteita, rajaa sijainnilla ja tutki kartalla.',
|
||||
sampleBadge: 'Mallikohde',
|
||||
|
|
@ -638,6 +640,7 @@ const svMessages: Record<keyof typeof baseMessages.en, string> = {
|
|||
priceWeekendShort: '{price}€ helg',
|
||||
priceNotSet: 'Ej angivet',
|
||||
listingPrices: 'Priser',
|
||||
capacityUnknown: 'Kapacitet ej angiven',
|
||||
amenityEvAvailable: 'EV-laddning i närheten',
|
||||
amenitySkiPass: 'Liftkort ingår',
|
||||
amenityMicrowave: 'Mikrovågsugn',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue