Compare commits

...

2 Commits

Author SHA1 Message Date
josh 50d61a78d5 Simplify consume modal: asset ID scan only
Build and push image / build (push) Successful in 44s
Remove eyebrow header, dropdown picker, and SKU matching.
Require scanning the physical asset ID to mark consumed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-04 19:22:10 -04:00
josh cb26a8e634 Remove stale hint text from scan field
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-04 19:19:55 -04:00
2 changed files with 4 additions and 22 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ export function ScanField({
}, [scan, items, products]); // eslint-disable-line react-hooks/exhaustive-deps
return (
<Field label="Scan asset id or SKU" hint="Or pick from the list below.">
<Field label="Scan asset id or SKU">
<div
style={{
display: "flex",
+3 -21
View File
@@ -2,10 +2,9 @@ import { useState } from "react";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import type { Bootstrap, Item } from "../../types.js";
import { helpers, TODAY_STR, enrichItems } from "../../types.js";
import { remainingShort } from "../../stats.js";
import { fmt } from "../../format.js";
import { api } from "../../api.js";
import { Btn, Field, Icon, Input, Select, Textarea } from "../primitives/index.js";
import { Btn, Field, Icon, Input, Textarea } from "../primitives/index.js";
import { ScanField, type ScanResult } from "../ScanField.js";
import { ModalBackdrop, ModalHeader, ModalFooter } from "./ModalChrome.js";
import { useToast } from "../Toast.js";
@@ -44,11 +43,6 @@ export function ConsumeFlow({
const handleScan = (result: ScanResult) => {
if (result.kind === "item") {
setItemId(result.item.id);
} else {
const candidate = active
.filter((i) => i.productId === result.product.id)
.sort((a, b) => +new Date(b.purchaseDate) - +new Date(a.purchaseDate))[0];
if (candidate) setItemId(candidate.id);
}
};
@@ -68,28 +62,16 @@ export function ConsumeFlow({
boxShadow: "var(--shadow-lg)",
}}
>
<ModalHeader title="Mark as consumed" eyebrow="Archive · used up" onClose={onClose} />
<ModalHeader title="Mark as consumed" eyebrow="" onClose={onClose} />
<div style={{ padding: 32 }}>
<ScanField
items={active}
products={data.products}
products={[]}
matchedLabel={item ? `${item.assetId} · ${item.name}` : null}
onMatch={handleScan}
/>
<div style={{ marginTop: 16 }}>
<Field label="Or pick from list">
<Select value={itemId} onChange={(e) => setItemId(e.target.value)}>
{active.map((i) => (
<option key={i.id} value={i.id}>
{i.assetId} · {i.name} {helpers.brandName(data, i.brandId)} ({remainingShort(i)} left)
</option>
))}
</Select>
</Field>
</div>
<div
style={{
marginTop: 16,