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,
|
listing.hasFreeParking ? { icon: amenityIcons.parking, label: t('amenityFreeParking') } : null,
|
||||||
].filter(Boolean) as { icon: string; label: string }[];
|
].filter(Boolean) as { icon: string; label: string }[];
|
||||||
const addressLine = `${listing.streetAddress ? `${listing.streetAddress}, ` : ''}${listing.city}, ${listing.region}, ${listing.country}`;
|
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 contactLine = `${listing.contactName} · ${listing.contactEmail}${listing.contactPhone ? ` · ${listing.contactPhone}` : ''}`;
|
||||||
const coverImage = listing.images.find((img) => img.isCover) ?? listing.images[0] ?? null;
|
const coverImage = listing.images.find((img) => img.isCover) ?? listing.images[0] ?? null;
|
||||||
const priceLine =
|
const priceLine =
|
||||||
|
|
|
||||||
|
|
@ -235,6 +235,7 @@ const baseMessages = {
|
||||||
capacityBedrooms: '{count} bedrooms',
|
capacityBedrooms: '{count} bedrooms',
|
||||||
capacityBeds: '{count} beds',
|
capacityBeds: '{count} beds',
|
||||||
capacityBathrooms: '{count} bathrooms',
|
capacityBathrooms: '{count} bathrooms',
|
||||||
|
capacityUnknown: 'Capacity not set',
|
||||||
browseListingsTitle: 'Browse listings',
|
browseListingsTitle: 'Browse listings',
|
||||||
browseListingsLead: 'Search public listings, filter by location, and explore them on the map.',
|
browseListingsLead: 'Search public listings, filter by location, and explore them on the map.',
|
||||||
sampleBadge: 'Sample',
|
sampleBadge: 'Sample',
|
||||||
|
|
@ -524,6 +525,7 @@ const baseMessages = {
|
||||||
capacityBedrooms: '{count} makuuhuonetta',
|
capacityBedrooms: '{count} makuuhuonetta',
|
||||||
capacityBeds: '{count} vuodetta',
|
capacityBeds: '{count} vuodetta',
|
||||||
capacityBathrooms: '{count} kylpyhuonetta',
|
capacityBathrooms: '{count} kylpyhuonetta',
|
||||||
|
capacityUnknown: 'Kapasiteettia ei ole asetettu',
|
||||||
browseListingsTitle: 'Selaa kohteita',
|
browseListingsTitle: 'Selaa kohteita',
|
||||||
browseListingsLead: 'Hae julkaistuja kohteita, rajaa sijainnilla ja tutki kartalla.',
|
browseListingsLead: 'Hae julkaistuja kohteita, rajaa sijainnilla ja tutki kartalla.',
|
||||||
sampleBadge: 'Mallikohde',
|
sampleBadge: 'Mallikohde',
|
||||||
|
|
@ -638,6 +640,7 @@ const svMessages: Record<keyof typeof baseMessages.en, string> = {
|
||||||
priceWeekendShort: '{price}€ helg',
|
priceWeekendShort: '{price}€ helg',
|
||||||
priceNotSet: 'Ej angivet',
|
priceNotSet: 'Ej angivet',
|
||||||
listingPrices: 'Priser',
|
listingPrices: 'Priser',
|
||||||
|
capacityUnknown: 'Kapacitet ej angiven',
|
||||||
amenityEvAvailable: 'EV-laddning i närheten',
|
amenityEvAvailable: 'EV-laddning i närheten',
|
||||||
amenitySkiPass: 'Liftkort ingår',
|
amenitySkiPass: 'Liftkort ingår',
|
||||||
amenityMicrowave: 'Mikrovågsugn',
|
amenityMicrowave: 'Mikrovågsugn',
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue