{#if isShowingLinkModal} { isShowingLinkModal = false; }} collectionId={collection.id} on:add={addAdventure} /> {/if} {#if isShowingTransportationModal} (isShowingTransportationModal = false)} on:save={saveOrCreateTransportation} {collection} /> {/if} {#if isShowingLodgingModal} (isShowingLodgingModal = false)} on:save={saveOrCreateLodging} {collection} /> {/if} {#if isAdventureModalOpen} (isAdventureModalOpen = false)} on:save={saveOrCreateAdventure} {collection} /> {/if} {#if isNoteModalOpen} (isNoteModalOpen = false)} {collection} on:save={(event) => { notes = notes.map((note) => { if (note.id === event.detail.id) { return event.detail; } return note; }); isNoteModalOpen = false; }} on:close={() => (isNoteModalOpen = false)} on:create={(event) => { notes = [event.detail, ...notes]; isNoteModalOpen = false; }} /> {/if} {#if isShowingChecklistModal} (isShowingChecklistModal = false)} on:create={(event) => { checklists = [event.detail, ...checklists]; isShowingChecklistModal = false; }} on:save={(event) => { checklists = checklists.map((checklist) => { if (checklist.id === event.detail.id) { return event.detail; } return checklist; }); isShowingChecklistModal = false; }} /> {/if} {#if !collection && !notFound}
{/if} {#if collection} {#if data.user && data.user.uuid && (data.user.uuid == collection.user_id || (collection.shared_with && collection.shared_with.includes(data.user.uuid))) && !collection.is_archived}
{/if} {#if collection.is_archived}
{/if} {#if collection.name}

{collection.name}

{/if} {#if collection.link} {/if} {#if collection.description}
{@html renderMarkdown(collection.description)}
{/if} {#if adventures.length > 0}
{$t('adventures.collection_stats')}
{numVisited}/{numAdventures} Visited
{#if numAdventures === numVisited}
{$t('adventures.collection_completed')}
{:else}
{$t('adventures.keep_exploring')}
{/if}
{/if} {#if collection.id} {/if} {#if currentView == 'all'} {#if adventures.length > 0}

{$t('adventures.linked_adventures')}

{#each adventures as adventure} {/each}
{/if} {#if transportations.length > 0}

{$t('adventures.transportations')}

{#each transportations as transportation} { transportations = transportations.filter((t) => t.id != event.detail); }} on:edit={editTransportation} {collection} /> {/each}
{/if} {#if lodging.length > 0}

{$t('adventures.lodging')}

{#each lodging as hotel} { lodging = lodging.filter((t) => t.id != event.detail); }} on:edit={editLodging} {collection} /> {/each}
{/if} {#if notes.length > 0}

{$t('adventures.notes')}

{#each notes as note} { noteToEdit = event.detail; isNoteModalOpen = true; }} on:delete={(event) => { notes = notes.filter((n) => n.id != event.detail); }} {collection} /> {/each}
{/if} {#if checklists.length > 0}

{$t('adventures.checklists')}

{#each checklists as checklist} { checklists = checklists.filter((n) => n.id != event.detail); }} on:edit={(event) => { checklistToEdit = event.detail; isShowingChecklistModal = true; }} {collection} /> {/each}
{/if} {#if adventures.length == 0 && transportations.length == 0 && notes.length == 0 && checklists.length == 0 && lodging.length == 0} {/if} {/if} {#if collection.start_date && collection.end_date} {#if currentView == 'itinerary'}

{$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' })}

(currentItineraryView = 'date')} /> (currentItineraryView = 'ordered')} />
{#if currentItineraryView == 'date'}
{#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 + 1)[ dateString ] || []} {@const dayTransportations = groupTransportationsByDate( transportations, new Date(collection.start_date), numberOfDays + 1 )[dateString] || []} {@const dayLodging = groupLodgingByDate(lodging, new Date(collection.start_date), numberOfDays + 1)[ dateString ] || []} {@const dayNotes = groupNotesByDate(notes, new Date(collection.start_date), numberOfDays + 1)[ dateString ] || []} {@const dayChecklists = groupChecklistsByDate(checklists, new Date(collection.start_date), numberOfDays + 1)[ 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; }} {collection} /> {/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); }} {collection} /> {/each} {/if} {#if dayLodging.length > 0} {#each dayLodging as hotel} { lodging = lodging.filter((t) => t.id != event.detail); }} on:edit={editLodging} {collection} /> {/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; }} {collection} /> {/each} {/if}
{#if dayAdventures.length == 0 && dayTransportations.length == 0 && dayNotes.length == 0 && dayChecklists.length == 0 && dayLodging.length == 0}

{$t('adventures.nothing_planned')}

{/if}
{/each}
{:else}
{#if orderedItems.length > 0}
{/if}
    {#each orderedItems as orderedItem, index}
  • {#if orderedItem.type === 'adventure' && orderedItem.item && 'category' in orderedItem.item && orderedItem.item.category && 'icon' in orderedItem.item.category} {orderedItem.item.category.icon} {:else if orderedItem.type === 'transportation' && orderedItem.item && 'origin_latitude' in orderedItem.item} {getTransportationEmoji(orderedItem.item.type)} {:else if orderedItem.type === 'lodging' && orderedItem.item && 'reservation_number' in orderedItem.item} {getLodgingIcon(orderedItem.item.type)} {/if}
    {$t(`adventures.${orderedItem.type}`)}
    {new Date(orderedItem.start).toLocaleDateString(undefined, { month: 'short', day: 'numeric' })} {#if orderedItem.start !== orderedItem.end}
    {new Date(orderedItem.start).toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' })} - {new Date(orderedItem.end).toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' })}
    {Math.round( (new Date(orderedItem.end).getTime() - new Date(orderedItem.start).getTime()) / 1000 / 60 / 60 )}h {Math.round( ((new Date(orderedItem.end).getTime() - new Date(orderedItem.start).getTime()) / 1000 / 60 / 60 - Math.floor( (new Date(orderedItem.end).getTime() - new Date(orderedItem.start).getTime()) / 1000 / 60 / 60 )) * 60 )}m
    {:else}

    {$t('adventures.all_day')} ⏱️

    {/if}
    {#if orderedItem.type === 'adventure' && orderedItem.item && 'images' in orderedItem.item} {:else if orderedItem.type === 'transportation' && orderedItem.item && 'origin_latitude' in orderedItem.item} { transportations = transportations.filter((t) => t.id != event.detail); }} on:edit={editTransportation} {collection} /> {:else if orderedItem.type === 'lodging' && orderedItem.item && 'reservation_number' in orderedItem.item} { lodging = lodging.filter((t) => t.id != event.detail); }} on:edit={editLodging} {collection} /> {/if}
  • {/each}
{#if orderedItems.length === 0}

{$t('adventures.no_ordered_items')}

{/if}
{/if} {/if} {/if} {#if currentView == 'map'}

Trip Map

{#each adventures as adventure} {#if adventure.longitude && adventure.latitude} {adventure.category?.icon} {#if isPopupOpen} (isPopupOpen = false)}> {#if adventure.images && adventure.images.length > 0} {/if}
{adventure.name}

{adventure.is_visited ? $t('adventures.visited') : $t('adventures.planned')}

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

{#if adventure.visits && adventure.visits.length > 0}

{#each adventure.visits as visit} {visit.start_date ? new Date(visit.start_date).toLocaleDateString(undefined, { timeZone: 'UTC' }) : ''} {visit.end_date && visit.end_date !== '' && visit.end_date !== visit.start_date ? ' - ' + new Date(visit.end_date).toLocaleDateString(undefined, { timeZone: 'UTC' }) : ''}
{/each}

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

{transportation.type}

{getTransportationEmoji(transportation.type)}
{transportation.name}

{transportation.type}

{/if} {/each} {#each lodging as hotel} {#if hotel.longitude && hotel.latitude} {getLodgingIcon(hotel.type)}
{hotel.name}

{hotel.type}

{/if} {/each}
{/if} {#if currentView == 'calendar'}

{$t('adventures.adventure_calendar')}

{/if} {#if currentView == 'recommendations' && data.user}

{$t('recomendations.adventure_recommendations')}

{#each adventures as adventure} {#if adventure.longitude && adventure.latitude} {/if} {/each} {#if adventures.length == 0}

{$t('adventures.no_adventures_to_recommendations')}

{/if}
{(recomendationsRange / 1609.344).toFixed(1)} mi ({( recomendationsRange / 1000 ).toFixed(1)} km)
(recomendationType = 'tourism')} /> (recomendationType = 'food')} /> (recomendationType = 'lodging')} />
{#if recomendationTags.length > 0} {/if}
{#if recomendationsData} {#each filteredRecomendations as recomendation} {#if recomendation.longitude && recomendation.latitude && recomendation.name} {osmTagToEmoji(recomendation.tag)} {#if isPopupOpen} (isPopupOpen = false)}>
{recomendation.name}

{`${recomendation.tag} ${osmTagToEmoji(recomendation.tag)}`}

{/if}
{/if} {/each}
{#each filteredRecomendations as recomendation} {#if recomendation.name && recomendation.longitude && recomendation.latitude}

{recomendation.name || $t('recomendations.recommendation')}

{#if recomendation.address}

{recomendation.address}

{/if} {#if recomendation.distance_km}

{$t('adventures.distance')}: {recomendation.distance_km.toFixed(1)} km ({( recomendation.distance_km / 1.609344 ).toFixed(1)} miles)

{/if}

{recomendation.tag}
{/if} {/each} {/if} {#if loadingRecomendations}

{$t('adventures.finding_recommendations')}...

{/if}
{/if} {/if} {data.props.adventure && data.props.adventure.name ? `${data.props.adventure.name}` : $t('adventures.collection')}