Move Geofence toggle button to map header next to Export

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 <noreply@anthropic.com>
This commit is contained in:
2025-12-02 23:45:27 +00:00
parent 042ae6ac6d
commit 96d7314317
2 changed files with 18 additions and 19 deletions

View File

@@ -34,6 +34,7 @@ export default function MapPage() {
const [timeFilter, setTimeFilter] = useState<number>(1); // Default 1 hour
const [isPaused, setIsPaused] = useState(false);
const [devices, setDevices] = useState<DeviceInfo[]>([]);
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 */}
<div className="hidden lg:block lg:flex-1"></div>
{/* Export, Admin and Logout Buttons */}
{/* Export, Geofences, Admin and Logout Buttons */}
<div className="flex items-center gap-2">
<a
href="/export"
@@ -137,6 +138,18 @@ export default function MapPage() {
<span className="mr-1.5">📥</span>
Export
</a>
<button
onClick={() => setShowGeofences(!showGeofences)}
className={`inline-flex items-center px-4 py-2 text-sm font-medium rounded-lg transition-all duration-200 shadow-sm ${
showGeofences
? "bg-purple-600 text-white border border-purple-600 hover:bg-purple-700 hover:border-purple-700"
: "bg-white text-gray-700 border border-gray-300 hover:bg-gray-50 hover:border-gray-400"
}`}
title={showGeofences ? "Hide Geofences" : "Show Geofences"}
>
<span className="mr-1.5">📍</span>
{showGeofences ? "Hide" : "Show"} Geofences
</button>
<a
href="/admin"
className="inline-flex items-center px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-blue-600 rounded-lg hover:bg-blue-700 hover:border-blue-700 transition-all duration-200 shadow-sm"
@@ -192,6 +205,7 @@ export default function MapPage() {
filterMode={filterMode}
startTime={startTime}
endTime={endTime}
showGeofences={showGeofences}
/>
</div>
</div>