adds create waypoint map popup

This commit is contained in:
Christian Beutel
2025-03-14 18:54:08 +01:00
parent ec15392c31
commit 4ad1cf3e09
12 changed files with 71 additions and 19 deletions

View File

@@ -53,6 +53,7 @@
"contribute": "Mitwirken",
"copy-link": "Link kopieren",
"create-new-list": "Neue Liste erstellen",
"create-waypoint": "",
"creation-date": "Erstellungsdatum",
"current-password": "Aktuelles Passwort",
"cycling": "Radfahren",

View File

@@ -53,6 +53,7 @@
"contribute": "Contribute",
"copy-link": "Copy Link",
"create-new-list": "Create new list",
"create-waypoint": "Create waypoint",
"creation-date": "Creation date",
"current-password": "Current password",
"cycling": "Cycling",

View File

@@ -53,6 +53,7 @@
"contribute": "Contribuir",
"copy-link": "Copiar Enlace",
"create-new-list": "Crear una nueva lista",
"create-waypoint": "",
"creation-date": "Fecha de creación",
"current-password": "Contraseña actual",
"cycling": "Ciclismo",

View File

@@ -53,6 +53,7 @@
"contribute": "Contribuer",
"copy-link": "Copier le lien",
"create-new-list": "Créer une nouvelle liste",
"create-waypoint": "",
"creation-date": "Date de création",
"current-password": "Mot de passe actuel",
"cycling": "Vélo",

View File

@@ -53,6 +53,7 @@
"contribute": "Hozzájárulás",
"copy-link": "Copy Link",
"create-new-list": "Új lista létrehozása",
"create-waypoint": "",
"creation-date": "létrehozás dátuma",
"current-password": "Current password",
"cycling": "Cycling",

View File

@@ -53,6 +53,7 @@
"contribute": "Contribuisci",
"copy-link": "Copia link",
"create-new-list": "Crea nuova lista",
"create-waypoint": "",
"creation-date": "Data di creazione",
"current-password": "Password attuale",
"cycling": "Ciclismo",

View File

@@ -53,6 +53,7 @@
"contribute": "Bijdragen",
"copy-link": "Copy Link",
"create-new-list": "Nieuwe lijst",
"create-waypoint": "",
"creation-date": "Aanmaakdatum",
"current-password": "Huidig wachtwoord",
"cycling": "Fietsen",

View File

@@ -53,6 +53,7 @@
"contribute": "Kontrybuuj",
"copy-link": "Kopiuj link",
"create-new-list": "Stwórz nową listę",
"create-waypoint": "",
"creation-date": "Data dodania",
"current-password": "Obecne hasło",
"cycling": "Rower",

View File

@@ -53,6 +53,7 @@
"contribute": "Contribuir",
"copy-link": "Copiar ligação",
"create-new-list": "Criar nova lista",
"create-waypoint": "",
"creation-date": "Data de criação",
"current-password": "Senha atual",
"cycling": "Ciclismo",

View File

@@ -53,6 +53,7 @@
"contribute": "贡献",
"copy-link": "复制链接",
"create-new-list": "创建新列表",
"create-waypoint": "",
"creation-date": "创建日期",
"current-password": "当前密码",
"cycling": "骑行",

View File

@@ -136,6 +136,35 @@ export function createAnchorMarker(lat: number, lon: number, index: number,
return marker
}
export function createEditTrailMapPopup(lnglat: M.LngLat, onCreateWaypointClick: () => void) {
const popup = new M.Popup({ closeOnClick: false })
.setLngLat(lnglat)
const popupContent = document.createElement("div");
popupContent.className = "pt-1 pb-3 pl-3"
const popupH = document.createElement("h5")
popupH.classList.add("text-base", "font-medium", "mb-2");
popupH.textContent = `${lnglat.lat.toFixed(4)}, ${lnglat.lng.toFixed(4)}`;
const createWaypointButton = document.createElement("button");
createWaypointButton.className = "btn-secondary w-full mt-2 text-sm";
const deleteButtonIcon = document.createElement("i")
deleteButtonIcon.classList.add("fa", "fa-location-dot", "mr-2")
createWaypointButton.appendChild(deleteButtonIcon)
const createWaypointButtonText = document.createElement("span")
createWaypointButtonText.textContent = get(_)("create-waypoint")
createWaypointButton.appendChild(deleteButtonIcon)
createWaypointButton.appendChild(createWaypointButtonText)
createWaypointButton.addEventListener("click", onCreateWaypointClick)
popupContent.appendChild(popupH)
popupContent.appendChild(createWaypointButton)
popup.setDOMContent(popupContent)
return popup
}
export function createPopupFromTrail(trail: Trail) {
const thumbnail = trail.photos.length
? getFileURL(trail, trail.photos[trail.thumbnail ?? 0])