making pins clickable + adding the corresponding panels/buttons

This commit is contained in:
2026-06-06 15:41:51 +09:00
parent b8567ef513
commit bd9e4f652b
4 changed files with 213 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
import { onMount } from 'svelte';
import { env } from '$env/dynamic/public';
import { messagesStore } from '$lib/stores/messagesStore.js'; // pass the messages store here
import { mapStore } from '$lib/stores/mapStore.js'; // use this to track interactions with da map
// export let latitude;
// export let longitude;
@@ -44,6 +45,11 @@
map: mapDiv,
title: message.text // firestore field for messages
});
marker.addListener('click', () => {
mapStore.set({ selectedMessage: message, composing: false}); //it updated the message object
});
markers.push(marker); // add the new pin to the array
});
}