CityTracker/client/src/components/map/CityMarker.tsx
Claudio Schaad 0b73929fea Allow moving a saved city's pin to update its coordinates
In edit mode, the coordinate text is replaced with a small map showing
a draggable marker; dropping it autosaves the new lat/lng. Name and
country stay editable via text fields only. New-city creation still
uses the search box and shows plain coordinates.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-28 21:12:51 +02:00

13 lines
417 B
TypeScript

import L from 'leaflet';
import type { CityStatus } from '@citytracker/shared';
export function cityMarkerIcon(status: CityStatus): L.DivIcon {
const color = status === 'visited' ? '#2f9e44' : '#1971c2';
return L.divIcon({
className: 'city-marker',
html: `<span class="marker-pin" style="background:${color}"></span>`,
iconSize: [22, 22],
iconAnchor: [11, 11],
popupAnchor: [0, -14],
});
}