Seed-packet scan UI: camera/upload → proposal → confirm (#102)
Build image / build-and-push (push) Successful in 6s
Build image / build-and-push (push) Successful in 6s
Adds the mobile-first UI for the seed-packet capture backend (live since #94): a capability-gated "Scan a packet" entry in the Plants catalog opens a camera/upload → editable proposal → confirm flow that creates a plant (new or matched) + a seed lot. Frontend only. Closes #102 — the last open child of epic #96. Co-authored-by: Steve Dudenhoeffer <[email protected]>
This commit was merged in pull request #119.
This commit is contained in:
+17
-8
@@ -11,18 +11,27 @@ import { API_BASE, api } from './api'
|
||||
import { gardenFullKey } from './objects'
|
||||
import { historyKey } from './history'
|
||||
|
||||
const capabilitiesSchema = z.object({ agent: z.boolean() })
|
||||
// What this instance can actually do, so the UI offers only what works: `agent`
|
||||
// (the assistant is live now) and `vision` (a seed-packet scan will work). Both
|
||||
// default to false so a partial/older response just hides the feature rather
|
||||
// than failing the whole parse.
|
||||
const capabilitiesSchema = z.object({
|
||||
agent: z.boolean().default(false),
|
||||
vision: z.boolean().default(false),
|
||||
})
|
||||
export type Capabilities = z.infer<typeof capabilitiesSchema>
|
||||
|
||||
export const capabilitiesKey = ['capabilities'] as const
|
||||
|
||||
/** Whether the assistant is live RIGHT NOW. Without it the panel isn't rendered
|
||||
* at all — a dead button is worse than no button.
|
||||
/** What this instance can do right now: whether the assistant is live and whether
|
||||
* seed-packet scanning will work. Without a capability the matching feature isn't
|
||||
* offered at all — a dead button is worse than no button.
|
||||
*
|
||||
* Not `staleTime: Infinity` any more: an admin can turn the assistant on or off
|
||||
* in Settings (#79), so this must be able to change under a running page. The
|
||||
* settings save invalidates this key directly; the finite staleTime just means
|
||||
* another admin's change is picked up on the next focus/remount rather than
|
||||
* never. */
|
||||
* Not `staleTime: Infinity` any more: an admin can turn the assistant or a vision
|
||||
* model on or off in Settings (#79), so this must be able to change under a
|
||||
* running page. The settings save invalidates this key directly; the finite
|
||||
* staleTime just means another admin's change is picked up on the next
|
||||
* focus/remount rather than never. */
|
||||
export function useCapabilities() {
|
||||
return useQuery({
|
||||
queryKey: capabilitiesKey,
|
||||
|
||||
Reference in New Issue
Block a user