{#if isShowingLinkModal} { isShowingLinkModal = false; }} on:add={addAdventure} /> {/if} {#if isTransportationEditModalOpen} (isTransportationEditModalOpen = false)} on:saveEdit={saveNewTransportation} startDate={collection.start_date} endDate={collection.end_date} /> {/if} {#if isEditModalOpen} (isEditModalOpen = false)} on:saveEdit={saveEdit} startDate={collection.start_date} endDate={collection.end_date} /> {/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 isShowingCreateModal} (isShowingCreateModal = false)} startDate={collection.start_date} endDate={collection.end_date} /> {/if} {#if isShowingTransportationModal} (isShowingTransportationModal = false)} on:add={(event) => { transportations = [event.detail, ...transportations]; isShowingTransportationModal = false; }} {collection} startDate={collection.start_date} endDate={collection.end_date} /> {/if} {#if notFound}
Lost

Adventure not Found

The adventure you were looking for could not be found. Please try a different adventure or check back later.

{/if} {#if !collection && !notFound}
{/if} {#if collection} {#if data.user}
{/if} {#if collection.name}

{collection.name}

{/if} {#if collection.description}

{collection.description}

{/if} {#if adventures.length > 0}
Collection Stats
{numVisited}/{numAdventures} Visited
{#if numAdventures === numVisited}
You've completed this collection! 🎉!
{:else}
Keep exploring!
{/if}
{/if} {#if adventures.length == 0 && transportations.length == 0} {/if} {#if adventures.length > 0}

Linked Adventures

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

Transportation

{#each transportations as transportation} { transportations = transportations.filter((t) => t.id != event.detail); }} on:edit={(event) => { transportationToEdit = event.detail; isTransportationEditModalOpen = true; }} /> {/each}
{/if} {#if notes.length > 0}

Notes

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

Checklists

{#each checklists as checklist} { checklists = checklists.filter((n) => n.id != event.detail); }} on:edit={(event) => { checklistToEdit = event.detail; isShowingChecklistModal = true; }} /> {/each}
{/if} {#if collection.start_date && collection.end_date}

Itinerary by Date

{#if numberOfDays}

Duration: {numberOfDays} days

{/if}

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

{#each Array(numberOfDays) as _, i} {@const currentDate = new Date(collection.start_date)} {@const temp = currentDate.setDate(currentDate.getDate() + i)} {@const dateString = currentDate.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]}

Day {i + 1} - {currentDate.toLocaleDateString('en-US', { 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; isTransportationEditModalOpen = 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}

Nothing planned for this day. Enjoy the journey!

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

{adventure.type.charAt(0).toUpperCase() + adventure.type.slice(1)}

{adventure.date ? new Date(adventure.date).toLocaleDateString('en-US', { timeZone: 'UTC' }) : ''}

{/if} {/each}
{/if} {/if} {data.props.adventure && data.props.adventure.name ? `${data.props.adventure.name}` : 'Collection'}