diff --git a/frontend/src/routes/map/+page.svelte b/frontend/src/routes/map/+page.svelte index bcf2625..d3ec589 100644 --- a/frontend/src/routes/map/+page.svelte +++ b/frontend/src/routes/map/+page.svelte @@ -4,6 +4,8 @@ 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; let createModalOpen: boolean = false; @@ -39,6 +41,8 @@ let newLongitude: number | null = null; let newLatitude: number | null = null; + let openPopupId: string | null = null; // Store the ID of the currently open popup + function addMarker(e: { detail: { lngLat: { lng: any; lat: any } } }) { newMarker = null; newMarker = { lngLat: e.detail.lngLat }; @@ -46,17 +50,17 @@ newLatitude = e.detail.lngLat.lat; } - // let markers = []; - - // $: { - // markers = data.props.markers; - // } - function createNewAdventure(event: CustomEvent) { adventures = [...adventures, event.detail]; newMarker = null; createModalOpen = false; } + + let isPopupOpen = false; + + function togglePopup() { + isPopupOpen = !isPopupOpen; + }
- {adventure.is_visited ? $t('adventures.visited') : $t('adventures.planned')} -
-- {$t(`adventures.activities.${adventure.type}`)} -
- {#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'
- })
- : ''}
-
+ {adventure.is_visited ? $t('adventures.visited') : $t('adventures.planned')}
- {/each}
+ {#if isPopupOpen}
+
+ {$t(`adventures.activities.${adventure.type}`)} +
+ {#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}
+