fix: make itinerary lodging cards compact and remove duplicate overnight summary

This commit is contained in:
2026-03-07 17:47:22 +00:00
parent 3af4f06944
commit 2579cd46ce
2 changed files with 108 additions and 80 deletions

View File

@@ -101,6 +101,7 @@
export let readOnly: boolean = false;
export let itineraryItem: CollectionItineraryItem | null = null;
export let showImage: boolean = true;
export let compact: boolean = false;
let isWarningModalOpen: boolean = false;
@@ -154,13 +155,17 @@
{/if}
<div
class="card w-full max-w-md bg-base-300 shadow hover:shadow-md transition-all duration-200 border border-base-300 group"
class="card w-full bg-base-300 shadow hover:shadow-md transition-all duration-200 border border-base-300 group"
aria-label="lodging-card"
>
{#if showImage}
<!-- Image Section with Overlay -->
<div class="relative overflow-hidden rounded-t-2xl">
<CardCarousel images={lodging.images} icon={getLodgingIcon(lodging.type)} name={lodging.name} />
<CardCarousel
images={lodging.images}
icon={getLodgingIcon(lodging.type)}
name={lodging.name}
/>
<!-- Privacy Indicator -->
<div class="absolute top-2 right-4">
@@ -193,12 +198,22 @@
{/if}
</div>
{/if}
<div class="card-body p-4 space-y-3 min-w-0">
<div
class="card-body min-w-0"
class:p-3={compact}
class:p-4={!compact}
class:space-y-2={compact}
class:space-y-3={!compact}
>
<!-- Header -->
<div class="flex items-start justify-between gap-3">
<a
href="/lodging/{lodging.id}"
class="hover:text-primary transition-colors duration-200 line-clamp-2 text-lg font-semibold"
class="hover:text-primary transition-colors duration-200 line-clamp-2"
class:text-base={compact}
class:text-lg={!compact}
class:font-medium={compact}
class:font-semibold={!compact}
>
{lodging.name}
</a>

View File

@@ -576,6 +576,10 @@
return day.items.filter((item) => item.id !== day.boundaryLodgingItem?.id);
}
function shouldShowOvernightSummary(day: DayGroup): boolean {
return day.overnightLodging.length > 0 && !day.boundaryLodgingItem?.resolvedObject;
}
function reinsertBoundaryLodgingItem(
day: DayGroup,
timelineItems: ResolvedItineraryItem[]
@@ -2332,6 +2336,7 @@
{collection}
itineraryItem={item}
showImage={false}
compact={true}
on:delete={handleItemDelete}
on:removeFromItinerary={handleRemoveItineraryItem}
on:edit={handleEditLodging}
@@ -2555,6 +2560,7 @@
{collection}
itineraryItem={boundaryLodgingItem}
showImage={false}
compact={true}
on:delete={handleItemDelete}
on:removeFromItinerary={handleRemoveItineraryItem}
on:edit={handleEditLodging}
@@ -2823,6 +2829,7 @@
{collection}
itineraryItem={item}
showImage={false}
compact={true}
on:delete={handleItemDelete}
on:removeFromItinerary={handleRemoveItineraryItem}
on:edit={handleEditLodging}
@@ -2899,7 +2906,9 @@
{getI18nText('itinerary.directions', 'Directions')}
</a>
{:else}
<span class="inline-flex items-center gap-1 text-primary/80 font-medium underline underline-offset-2">
<span
class="inline-flex items-center gap-1 text-primary/80 font-medium underline underline-offset-2"
>
<LocationMarker class="w-3.5 h-3.5" />
{getI18nText('itinerary.directions', 'Directions')}
</span>
@@ -2929,7 +2938,9 @@
{getI18nText('itinerary.directions', 'Directions')}
</a>
{:else}
<span class="inline-flex items-center gap-1 text-primary font-medium underline underline-offset-2">
<span
class="inline-flex items-center gap-1 text-primary font-medium underline underline-offset-2"
>
<LocationMarker class="w-3.5 h-3.5" />
{getI18nText('itinerary.directions', 'Directions')}
</span>
@@ -3011,6 +3022,7 @@
{collection}
itineraryItem={boundaryLodgingItem}
showImage={false}
compact={true}
on:delete={handleItemDelete}
on:removeFromItinerary={handleRemoveItineraryItem}
on:edit={handleEditLodging}
@@ -3130,10 +3142,10 @@
</div>
<!-- Overnight Lodging + Dated Trip-wide Indicators (share row to save space) -->
{#if day.overnightLodging.length > 0 || day.globalDatedItems.length > 0}
{#if shouldShowOvernightSummary(day) || day.globalDatedItems.length > 0}
<div class="mt-4 pt-4 border-t border-base-300 border-dashed">
<div class="flex flex-wrap gap-6 items-start">
{#if day.overnightLodging.length > 0}
{#if shouldShowOvernightSummary(day)}
<div class="space-y-2 min-w-[240px] flex-1">
<div class="flex items-center gap-2 mb-1 opacity-70">
<Bed class="w-4 h-4" />
@@ -3356,6 +3368,7 @@
{user}
{collection}
showImage={false}
compact={true}
on:delete={handleItemDelete}
on:edit={handleEditLodging}
/>