From 96d7314317b68b6c9ecc594019e2a865d6a6fbbe Mon Sep 17 00:00:00 2001 From: Joachim Hummel Date: Tue, 2 Dec 2025 23:45:27 +0000 Subject: [PATCH] Move Geofence toggle button to map header next to Export MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Relocated the "Show/Hide Geofences" toggle button from floating position (top-right corner) to the main header toolbar. **Changes:** - Moved toggle button to header, positioned between Export and Admin buttons - Converted showGeofences from local state to prop passed from parent - Button now matches header design system (same styling as Export/Admin) - Purple background when active, white when inactive - Better UX: All controls now in one consistent location **New Button Position:** Export | Show/Hide Geofences | Admin | Logout Much cleaner and more intuitive than the floating button! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/map/page.tsx | 16 +++++++++++++++- components/map/MapView.tsx | 21 +++------------------ 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/app/map/page.tsx b/app/map/page.tsx index 0767a1b..13d760f 100644 --- a/app/map/page.tsx +++ b/app/map/page.tsx @@ -34,6 +34,7 @@ export default function MapPage() { const [timeFilter, setTimeFilter] = useState(1); // Default 1 hour const [isPaused, setIsPaused] = useState(false); const [devices, setDevices] = useState([]); + const [showGeofences, setShowGeofences] = useState(true); // Custom range state const [filterMode, setFilterMode] = useState<"quick" | "custom">("quick"); @@ -128,7 +129,7 @@ export default function MapPage() { {/* Spacer to push buttons to the right */}
- {/* Export, Admin and Logout Buttons */} + {/* Export, Geofences, Admin and Logout Buttons */}
📥 Export +
diff --git a/components/map/MapView.tsx b/components/map/MapView.tsx index 3ec98e2..ceddf20 100644 --- a/components/map/MapView.tsx +++ b/components/map/MapView.tsx @@ -22,6 +22,7 @@ interface MapViewProps { filterMode: "quick" | "custom"; startTime: string; // datetime-local format endTime: string; // datetime-local format + showGeofences: boolean; } interface DeviceInfo { @@ -67,14 +68,13 @@ function SetViewOnChange({ return null; } -export default function MapView({ selectedDevice, timeFilter, isPaused, filterMode, startTime, endTime }: MapViewProps) { +export default function MapView({ selectedDevice, timeFilter, isPaused, filterMode, startTime, endTime, showGeofences }: MapViewProps) { const [locations, setLocations] = useState([]); const [devices, setDevices] = useState>({}); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const [mapCenter, setMapCenter] = useState<[number, number] | null>(null); const [currentZoom, setCurrentZoom] = useState(12); - const [showGeofences, setShowGeofences] = useState(true); const intervalRef = useRef(null); // Add animation styles for latest marker @@ -228,22 +228,7 @@ export default function MapView({ selectedDevice, timeFilter, isPaused, filterMo } return ( -
- {/* Geofence Toggle Button */} -
- -
- +