diff --git a/frontend/src/lib/components/AdventureModal.svelte b/frontend/src/lib/components/AdventureModal.svelte index 88e3d0c..ff9770d 100644 --- a/frontend/src/lib/components/AdventureModal.svelte +++ b/frontend/src/lib/components/AdventureModal.svelte @@ -683,7 +683,7 @@
- {#if transportation.from_location && transportation.to_location} + {#if transportation.from_location || transportation.to_location} - - - -{/if} - {#if !collection && !notFound}
@@ -383,9 +383,6 @@
{/if} - {#if adventures.length == 0 && transportations.length == 0 && notes.length == 0 && checklists.length == 0} - - {/if} {#if adventures.length > 0}

{$t('adventures.linked_adventures')}

@@ -460,139 +457,195 @@ {/if} {#if collection.start_date && collection.end_date} -
-

{$t('adventures.itineary_by_date')}

- {#if numberOfDays} -

- {$t('adventures.duration')}: {numberOfDays} - {$t('adventures.days')} -

- {/if} -

- Dates: {new Date(collection.start_date).toLocaleDateString(undefined, { timeZone: 'UTC' })} - {new Date( - collection.end_date - ).toLocaleDateString(undefined, { timeZone: 'UTC' })} -

- - {#each Array(numberOfDays) as _, i} - {@const startDate = new Date(collection.start_date)} - {@const tempDate = new Date(startDate.getTime())} - - {@const adjustedDate = new Date(tempDate.setUTCDate(tempDate.getUTCDate() + i))} - - {@const dateString = adjustedDate.toISOString().split('T')[0]} - - {@const dayAdventures = - groupAdventuresByDate(adventures, new Date(collection.start_date), numberOfDays)[ - dateString - ] || []} - - {@const dayTransportations = - groupTransportationsByDate(transportations, new Date(collection.start_date), numberOfDays)[ - dateString - ] || []} - - {@const dayNotes = - groupNotesByDate(notes, new Date(collection.start_date), numberOfDays)[dateString] || []} - - {@const dayChecklists = - groupChecklistsByDate(checklists, new Date(collection.start_date), numberOfDays)[ - dateString - ] || []} - -

- {$t('adventures.day')} - {i + 1} -

-

- {adjustedDate.toLocaleDateString(undefined, { timeZone: 'UTC' })} -

-
- {#if dayAdventures.length > 0} - {#each dayAdventures as adventure} - - {/each} - {/if} - {#if dayTransportations.length > 0} - {#each dayTransportations as transportation} - { - transportations = transportations.filter((t) => t.id != event.detail); - }} - on:edit={(event) => { - transportationToEdit = event.detail; - isShowingTransportationModal = true; - }} - /> - {/each} - {/if} - {#if dayNotes.length > 0} - {#each dayNotes as note} - { - noteToEdit = event.detail; - isNoteModalOpen = true; - }} - on:delete={(event) => { - notes = notes.filter((n) => n.id != event.detail); - }} - /> - {/each} - {/if} - {#if dayChecklists.length > 0} - {#each dayChecklists as checklist} - { - notes = notes.filter((n) => n.id != event.detail); - }} - on:edit={(event) => { - checklistToEdit = event.detail; - isShowingChecklistModal = true; - }} - /> - {/each} - {/if} - - {#if dayAdventures.length == 0 && dayTransportations.length == 0 && dayNotes.length == 0 && dayChecklists.length == 0} -

{$t('adventures.nothing_planned')}

- {/if} +
+
+
+

{$t('adventures.itineary_by_date')}

+ {#if numberOfDays} +

+ {$t('adventures.duration')}: + {numberOfDays} {$t('adventures.days')} +

+ {/if} +

+ Dates: {new Date(collection.start_date).toLocaleDateString(undefined, { timeZone: 'UTC' })} - + {new Date(collection.end_date).toLocaleDateString(undefined, { + timeZone: 'UTC' + })} +

+
- {/each} +
- - - +
+ {#each Array(numberOfDays) as _, i} + {@const startDate = new Date(collection.start_date)} + {@const tempDate = new Date(startDate.getTime())} + {@const adjustedDate = new Date(tempDate.setUTCDate(tempDate.getUTCDate() + i))} + {@const dateString = adjustedDate.toISOString().split('T')[0]} - {#each adventures as adventure} - {#if adventure.longitude && adventure.latitude} - - -
{adventure.name}
-

- {adventure.category?.display_name + ' ' + adventure.category?.icon} -

-
-
- {/if} + {@const dayAdventures = + groupAdventuresByDate(adventures, new Date(collection.start_date), numberOfDays)[ + dateString + ] || []} + {@const dayTransportations = + groupTransportationsByDate( + transportations, + new Date(collection.start_date), + numberOfDays + )[dateString] || []} + {@const dayNotes = + groupNotesByDate(notes, new Date(collection.start_date), numberOfDays)[dateString] || []} + {@const dayChecklists = + groupChecklistsByDate(checklists, new Date(collection.start_date), numberOfDays)[ + dateString + ] || []} + +
+
+

+ {$t('adventures.day')} + {i + 1} +
+ {adjustedDate.toLocaleDateString(undefined, { timeZone: 'UTC' })} +
+

+ +
+ +
+ {#if dayAdventures.length > 0} + {#each dayAdventures as adventure} + + {/each} + {/if} + {#if dayTransportations.length > 0} + {#each dayTransportations as transportation} + { + transportations = transportations.filter((t) => t.id != event.detail); + }} + on:edit={(event) => { + transportationToEdit = event.detail; + isShowingTransportationModal = true; + }} + /> + {/each} + {/if} + {#if dayNotes.length > 0} + {#each dayNotes as note} + { + noteToEdit = event.detail; + isNoteModalOpen = true; + }} + on:delete={(event) => { + notes = notes.filter((n) => n.id != event.detail); + }} + /> + {/each} + {/if} + {#if dayChecklists.length > 0} + {#each dayChecklists as checklist} + { + notes = notes.filter((n) => n.id != event.detail); + }} + on:edit={(event) => { + checklistToEdit = event.detail; + isShowingChecklistModal = true; + }} + /> + {/each} + {/if} +
+ + {#if dayAdventures.length == 0 && dayTransportations.length == 0 && dayNotes.length == 0 && dayChecklists.length == 0} +

{$t('adventures.nothing_planned')}

+ {/if} +
+
{/each} - +
+ +
+
+

Trip Map

+ + {#each adventures as adventure} + {#if adventure.longitude && adventure.latitude} + + +
{adventure.name}
+

+ {adventure.category?.display_name + ' ' + adventure.category?.icon} +

+
+
+ {/if} + {/each} + {#each transportations as transportation} + {#if transportation.destination_latitude && transportation.destination_longitude} + + + {getTransportationEmoji(transportation.type)} + + +
{transportation.name}
+

+ {transportation.type} +

+
+
+ {/if} + {#if transportation.origin_latitude && transportation.origin_longitude} + + + {getTransportationEmoji(transportation.type)} + + +
{transportation.name}
+

+ {transportation.type} +

+
+
+ {/if} + {/each} +
+
+
{/if} {/if} diff --git a/frontend/src/routes/map/+page.svelte b/frontend/src/routes/map/+page.svelte index 705ce1c..f550760 100644 --- a/frontend/src/routes/map/+page.svelte +++ b/frontend/src/routes/map/+page.svelte @@ -3,7 +3,6 @@ import { DefaultMarker, MapEvents, MapLibre, Popup, Marker } from 'svelte-maplibre'; import { t } from 'svelte-i18n'; import type { Adventure, VisitedRegion } from '$lib/types.js'; - import { getAdventureTypeLabel } from '$lib'; import CardCarousel from '$lib/components/CardCarousel.svelte'; import { goto } from '$app/navigation'; export let data;