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