feat(09-01): add classification API route, client hook, badge component, and setup detail wiring

- Add PATCH /:id/items/:itemId/classification endpoint with Zod validation
- Add apiPatch helper to client API library
- Add useUpdateItemClassification mutation hook
- Add classification field to SetupItemWithCategory interface
- Create ClassificationBadge click-to-cycle component (base/worn/consumable)
- Wire ClassificationBadge into setup detail page item grid
- Add integration tests for PATCH classification route (valid + invalid)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 15:13:08 +01:00
parent 4491e4c6f1
commit fb738d7cc2
6 changed files with 169 additions and 13 deletions

View File

@@ -0,0 +1,30 @@
const CLASSIFICATION_LABELS: Record<string, string> = {
base: "Base Weight",
worn: "Worn",
consumable: "Consumable",
};
interface ClassificationBadgeProps {
classification: string;
onCycle: () => void;
}
export function ClassificationBadge({
classification,
onCycle,
}: ClassificationBadgeProps) {
const label = CLASSIFICATION_LABELS[classification] ?? "Base Weight";
return (
<button
type="button"
onClick={(e) => {
e.stopPropagation();
onCycle();
}}
className="inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-600 hover:bg-gray-200 transition-colors cursor-pointer"
>
{label}
</button>
);
}