Add "Scan a packet" to the editor's Plants mode #120
@@ -110,6 +110,9 @@ export function GardenEditorPage() {
|
||||
const [sharing, setSharing] = useState(false)
|
||||
const [clearing, setClearing] = 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 nudgeFire = useRef<(() => void) | null>(null)
|
||||
|
||||
@@ -634,7 +637,7 @@ export function GardenEditorPage() {
|
||||
onClear={() => setClearing(true)}
|
||||
|
|
||||
onFill={fillBed}
|
||||
filling={fillObject.isPending}
|
||||
canScan={!!capabilities.data?.vision}
|
||||
canScan={canScan}
|
||||
onScan={() => setScanning(true)}
|
||||
/>
|
||||
) : (
|
||||
@@ -732,7 +735,7 @@ export function GardenEditorPage() {
|
||||
) : (
|
||||
|
gitea-actions
commented
🟡 Mobile pre-focus hint duplicates the "📷 Scan packet" button JSX instead of sharing it with PlantPlacementTools maintainability · flagged by 1 model
🪰 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">
|
||||
<p className="px-1 text-xs text-muted">Tap a bed, then “🌱 Plant here” to start planting.</p>
|
||||
{capabilities.data?.vision && (
|
||||
{canScan && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
className="ml-auto px-2 py-1 text-xs"
|
||||
|
||||
Reference in New Issue
Block a user
⚪ 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 intoPlantPlacementTools(lines 819-823). The PR's stated premise is dedup viaPlantPlacementTools, and it holds for the two focused-bed sites, but this third site duplicates the label,variant="ghost", thetext-xsghost-button styling, andonClick={() => setScanning(true)}(theml-autoclass differs here vs. th…🪰 Gadfly · advisory