Hoist the vision-capability flag to one canScan local
Build image / build-and-push (push) Successful in 11s
Build image / build-and-push (push) Successful in 11s
Review nit: capabilities.data?.vision was read inline at all three Plants-mode scan entry points. Read it once into `canScan` so the gating is consistent. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01H3zbym8Doka2d7D48maSgZ
This commit is contained in:
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user