Bläddra i källkod

feat: visitor dots - orange #FF4907 for registered users, ghost for guests

neyrogovnarik 1 månad sedan
förälder
incheckning
c06faf84d7
2 ändrade filer med 5 tillägg och 3 borttagningar
  1. 2 1
      frontend/src/components/MapView.tsx
  2. 3 2
      frontend/src/lib/map.ts

+ 2 - 1
frontend/src/components/MapView.tsx

@@ -107,7 +107,8 @@ export default function MapView() {
     if (!provider || !provider.isReady()) return
 
     visitors.forEach((v, i) => {
-      provider.addMarker(`ws-visitor-${i}`, v.lat, v.lng, { type: 'visitor', ghost: !user })
+      const type = v.user_id ? 'visitor_registered' : 'visitor'
+      provider.addMarker(`ws-visitor-${i}`, v.lat, v.lng, { type, ghost: !user && !v.user_id })
     })
 
     return () => {

+ 3 - 2
frontend/src/lib/map.ts

@@ -11,7 +11,7 @@ export interface MapBounds {
 }
 
 export interface MarkerOptions {
-  type?: 'place' | 'studio' | 'visitor' | 'location'
+  type?: 'place' | 'studio' | 'visitor' | 'visitor_registered' | 'location'
   title?: string
   onClick?: () => void
   ghost?: boolean
@@ -22,6 +22,7 @@ const MARKER_COLORS: Record<string, string> = {
   place: '#3b82f6',
   studio: '#a855f7',
   visitor: '#22c55e',
+  visitor_registered: '#FF4907',
   location: '#3b82f6',
 }
 
@@ -120,7 +121,7 @@ export function createLeafletMapProvider(): MapProvider {
       if (!map) return
       const ghost = options?.ghost
       const type = options?.type || 'place'
-      const size = type === 'visitor' || type === 'location' ? 12 : 32
+      const size = type === 'visitor' || type === 'visitor_registered' || type === 'location' ? 12 : 32
       const icon = createIcon(type, size, ghost)
       const interactive = !ghost
       const marker = L.marker([lat, lng], { icon, interactive }).addTo(map)