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)}
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() {
) : ( ) : (
<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"