Add "Scan a packet" to the editor's Plants mode #120

Merged
steve merged 2 commits from feat/scan-in-editor-plants-mode into main 2026-07-22 17:25:39 +00:00
Showing only changes of commit df6200d858 - Show all commits
+5 -2
View File
1
@@ -110,6 +110,9 @@ export function GardenEditorPage() {
const [sharing, setSharing] = useState(false) const [sharing, setSharing] = useState(false)
const [clearing, setClearing] = useState(false) const [clearing, setClearing] = useState(false)
const [scanning, setScanning] = useState(false) const [scanning, setScanning] = useState(false)
// Whether to offer packet scanning — a vision model is configured. Read once
// here so all three Plants-mode entry points gate identically.
const canScan = !!capabilities.data?.vision
const nudgeTimer = useRef<number | null>(null) const nudgeTimer = useRef<number | null>(null)
const nudgeFire = useRef<(() => void) | null>(null) const nudgeFire = useRef<(() => void) | null>(null)
@@ -634,7 +637,7 @@ export function GardenEditorPage() {
onClear={() => setClearing(true)} onClear={() => setClearing(true)}
Outdated
Review

capabilities.data?.vision read inline at three sites; hoist to a single canScan local for consistency

maintainability · flagged by 1 model

  • web/src/pages/GardenEditorPage.tsx:735-743 — The mobile pre-focus hint inlines a second copy of the "📷 Scan packet" button JSX instead of reusing the one already factored into PlantPlacementTools (lines 819-823). The PR's stated premise is dedup via PlantPlacementTools, and it holds for the two focused-bed sites, but this third site duplicates the label, variant="ghost", the text-xs ghost-button styling, and onClick={() => setScanning(true)} (the ml-auto class differs here vs. th…

🪰 Gadfly · advisory

⚪ **capabilities.data?.vision read inline at three sites; hoist to a single canScan local for consistency** _maintainability · flagged by 1 model_ - `web/src/pages/GardenEditorPage.tsx:735-743` — The mobile pre-focus hint inlines a second copy of the "📷 Scan packet" button JSX instead of reusing the one already factored into `PlantPlacementTools` (lines 819-823). The PR's stated premise is dedup via `PlantPlacementTools`, and it holds for the two focused-bed sites, but this third site duplicates the label, `variant="ghost"`, the `text-xs` ghost-button styling, and `onClick={() => setScanning(true)}` (the `ml-auto` class differs here vs. th… <sub>🪰 Gadfly · advisory</sub>
onFill={fillBed} onFill={fillBed}
filling={fillObject.isPending} filling={fillObject.isPending}
canScan={!!capabilities.data?.vision} canScan={canScan}
onScan={() => setScanning(true)} onScan={() => setScanning(true)}
/> />
) : ( ) : (
@@ -732,7 +735,7 @@ export function GardenEditorPage() {
) : ( ) : (
Outdated
Review

🟡 Mobile pre-focus hint duplicates the "📷 Scan packet" button JSX instead of sharing it with PlantPlacementTools

maintainability · flagged by 1 model

  • web/src/pages/GardenEditorPage.tsx:735-743 — The mobile pre-focus hint inlines a second copy of the "📷 Scan packet" button JSX instead of reusing the one already factored into PlantPlacementTools (lines 819-823). The PR's stated premise is dedup via PlantPlacementTools, and it holds for the two focused-bed sites, but this third site duplicates the label, variant="ghost", the text-xs ghost-button styling, and onClick={() => setScanning(true)} (the ml-auto class differs here vs. th…

🪰 Gadfly · advisory

🟡 **Mobile pre-focus hint duplicates the "📷 Scan packet" button JSX instead of sharing it with PlantPlacementTools** _maintainability · flagged by 1 model_ - `web/src/pages/GardenEditorPage.tsx:735-743` — The mobile pre-focus hint inlines a second copy of the "📷 Scan packet" button JSX instead of reusing the one already factored into `PlantPlacementTools` (lines 819-823). The PR's stated premise is dedup via `PlantPlacementTools`, and it holds for the two focused-bed sites, but this third site duplicates the label, `variant="ghost"`, the `text-xs` ghost-button styling, and `onClick={() => setScanning(true)}` (the `ml-auto` class differs here vs. th… <sub>🪰 Gadfly · advisory</sub>
<div className="flex items-center gap-2"> <div className="flex items-center gap-2">
<p className="px-1 text-xs text-muted">Tap a bed, then 🌱 Plant here to start planting.</p> <p className="px-1 text-xs text-muted">Tap a bed, then 🌱 Plant here to start planting.</p>
{capabilities.data?.vision && ( {canScan && (
<Button <Button
variant="ghost" variant="ghost"
className="ml-auto px-2 py-1 text-xs" className="ml-auto px-2 py-1 text-xs"