This commit is contained in:
Jake Kasper
2025-09-04 07:49:50 -05:00
parent c7e52eacb4
commit 6e8fa900e4

View File

@@ -353,6 +353,7 @@ const PropertyDetail = () => {
const [gpsDistance, setGpsDistance] = useState(0);
const [gpsAccuracy, setGpsAccuracy] = useState(null);
const [isSnapPreview, setIsSnapPreview] = useState(false);
const [showAddMenu, setShowAddMenu] = useState(false);
const [currentColor, setCurrentColor] = useState(SECTION_COLORS[0]);
const [showNameModal, setShowNameModal] = useState(false);
const [pendingSection, setPendingSection] = useState(null);
@@ -810,40 +811,52 @@ const PropertyDetail = () => {
)}
</div>
</div>
<div className="flex gap-2">
<div className="relative">
<button
onClick={() => setIsDrawing(!isDrawing)}
className={`btn-primary flex items-center gap-2 ${isDrawing ? 'bg-red-600 hover:bg-red-700' : ''}`}
onClick={() => setShowAddMenu(v=>!v)}
className="btn-primary flex items-center gap-2"
title="Add a lawn section"
>
<PlusIcon className="h-5 w-5" />
{isDrawing ? 'Cancel Drawing' : 'Tap-to-Draw'}
Add Lawn Section
</button>
{showAddMenu && (
<div className="absolute right-0 mt-2 w-56 bg-white border rounded shadow-lg z-10">
<button
className="w-full text-left px-3 py-2 hover:bg-gray-50"
onClick={() => { setShowAddMenu(false); setIsDrawing(true); setIsGPSPointsMode(false); setIsGPSTraceMode(false); }}
>
Tap to Draw (manual)
</button>
<button
className="w-full text-left px-3 py-2 hover:bg-gray-50"
onClick={() => {
// Toggle GPS points mode; ensure trace mode off
setShowAddMenu(false);
// Enable GPS points mode, disable trace
setIsGPSTraceMode(false);
setIsTracing(false);
if (gpsWatchId) { navigator.geolocation.clearWatch(gpsWatchId); setGpsWatchId(null); }
setIsGPSPointsMode(v=>!v);
if (!isGPSPointsMode) clearGpsPoints();
clearGpsPoints();
setIsGPSPointsMode(true);
}}
className={`btn-secondary flex items-center gap-2 ${isGPSPointsMode ? 'ring-2 ring-blue-300' : ''}`}
>
{isGPSPointsMode ? 'Exit GPS Points' : 'GPS Points'}
GPS Points (walk and mark)
</button>
<button
className="w-full text-left px-3 py-2 hover:bg-gray-50"
onClick={() => {
// Toggle trace mode; ensure points mode off
setShowAddMenu(false);
// Enable trace mode, disable points mode
setIsGPSPointsMode(false);
if (!isGPSTraceMode) clearGpsPoints();
if (isGPSTraceMode && gpsWatchId) { navigator.geolocation.clearWatch(gpsWatchId); setGpsWatchId(null); setIsTracing(false); }
setIsGPSTraceMode(v=>!v);
clearGpsPoints();
setIsGPSTraceMode(true);
}}
className={`btn-secondary flex items-center gap-2 ${isGPSTraceMode ? 'ring-2 ring-blue-300' : ''}`}
>
{isGPSTraceMode ? 'Exit Trace' : 'Trace Boundary'}
Trace Boundary (continuous)
</button>
</div>
)}
</div>
</div>
<div className="grid grid-cols-1 lg:grid-cols-4 gap-6">