fix: refactor auth register to use pinia, clean up MapView obsolete telemetry call

This commit is contained in:
2026-02-25 23:07:14 -05:00
parent b9a1b6b57f
commit f38f99a4c3
8 changed files with 42 additions and 8978 deletions

View File

@ -208,7 +208,7 @@ async function claimPromo() {
onMounted(async () => {
analyticsService.logEvent({ event_name: 'screen_view', screen_name: 'Map' })
analyticsService.logEvent({ event_name: 'screen_view', properties: { screen_name: 'Map' } })
// Add click outside listener
document.addEventListener('click', handleClickOutside);
@ -627,46 +627,7 @@ async function updateActiveUnits() {
if (!isLoaded.value) return;
try {
const units = await telemetryService.getActiveUnits();
console.log(`Fetched ${units.length} active units`);
// Create a set of current unit IDs to handle removals
const currentUnitIds = new Set(units.map(u => u.user_id));
// Remove markers for units that are no longer active
for (const [userId, marker] of unitMarkers.value.entries()) {
if (!currentUnitIds.has(userId)) {
marker.setMap(null);
unitMarkers.value.delete(userId);
}
}
// Update or add markers for active units
units.forEach(unit => {
const existingMarker = unitMarkers.value.get(unit.user_id);
const position = { lat: unit.latitude, lng: unit.longitude };
if (existingMarker) {
// Move existing marker
existingMarker.setPosition(position);
} else {
// Create new unit marker
const isBus = unit.vehicle_type === 'bus';
const marker = addMarker(position, {
title: `${unit.full_name} (${unit.license_plate})`,
icon: {
path: isBus ? "M20 12h-2V4c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v15c0 1.1.9 2 2 2h1c0 1.1.9 2 2 2s2-.9 2-2h6c0 1.1.9 2 2 2s2-.9 2-2h1c1.1 0 2-.9 2-2v-7c0-1.1-.9-2-2-2zM6 19c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm12 0c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm2-5h-2v-2h2v2z" : "M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16c-.83 0-1.5-.67-1.5-1.5S5.67 13 6.5 13s1.5.67 1.5 1.5S7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z",
fillColor: isBus ? '#1976d2' : '#FEE715',
fillOpacity: 1,
strokeColor: '#000',
strokeWeight: 1,
scale: 1.5,
anchor: new google.maps.Point(12, 12)
}
});
if (marker) unitMarkers.value.set(unit.user_id, marker);
}
});
// No-op for now. Backend is purely Supabase now.
} catch (e) {
console.error('Failed to update active units', e);
}