diff --git a/frontend/src/admin/InventoryFilters.tsx b/frontend/src/admin/InventoryFilters.tsx index e1e6197..3fd2f1a 100644 --- a/frontend/src/admin/InventoryFilters.tsx +++ b/frontend/src/admin/InventoryFilters.tsx @@ -1,20 +1,27 @@ import { useMemo } from 'react'; import TreeSelect from 'antd/es/tree-select'; import Select from 'antd/es/select'; -import Segmented from 'antd/es/segmented'; import InputNumber from 'antd/es/input-number'; import Button from 'antd/es/button'; import type { Category, Tag } from '../api'; import { ItemFilters, - SaleState, - ADMIN_SALE_STATUSES, + ItemStatus, buildCategoryTree, CategoryNode, - hasActiveFilters, - saleStateFromStatuses + hasActiveFilters } from '../filters'; +// Named individually rather than grouped, because grouping is what the preset +// this replaces did. Pending is listed first: "what is waiting to be published" +// is the question that prompted #132. +const STATUS_OPTIONS: { value: ItemStatus; label: string }[] = [ + { value: 'pending', label: 'Pending' }, + { value: 'available', label: 'Available' }, + { value: 'reserved', label: 'Reserved' }, + { value: 'sold', label: 'Sold' } +]; + interface CategoryTreeOption { value: number; title: string; @@ -93,32 +100,34 @@ export default function InventoryFilters({ categories, tags, filters, onChange, onChange={(value) => onChange({ ...filters, maxPriceCents: dollarsToCents(value) })} /> - {/* Replaces the four-way status dropdown that used to sit here. One - control instead of two overlapping ways to say the same thing. - Note what it costs: a single status can no longer be isolated, so - there is no longer a way to view only Reserved, or only Pending. - Not Sold folds pending in with available and reserved. If isolating - one status turns out to matter — the pending workflow from #90 is the - likeliest candidate — the fix is to put that back alongside this - preset, not to remove it. See the decision recorded on #105. */} - { - const state = value as SaleState; - onChange({ - ...filters, - // All is the admin's default, so it is held as "no preference" - // rather than as a list naming every status — which keeps it out of - // the active-filter count and out of Clear filters' way. - status: state === 'all' ? null : ADMIN_SALE_STATUSES[state] - }); - }} - options={[ - { label: 'Not sold', value: 'not-sold' }, - { label: 'Sold', value: 'sold' }, - { label: 'All', value: 'all' } - ]} + {/* The status dimension itself rather than presets over it, which #105's + Sold / Not sold / All control was. Presets could not express Published + or Unpublished, could not isolate Reserved, and would have grown a new + button for every new question. Selecting statuses answers all of them: + Unpublished is Pending, Published is the other three, and Not sold is + everything except Sold. + + A second control for publication would have read more naturally and + reintroduced what #105 avoided — Sold and Unpublished is an impossible + pair, since a sold item is necessarily published. One dimension cannot + contradict itself. See #132. + + The storefront keeps the three-way preset: pending is excluded from + every public read, so Published and Unpublished are not distinctions a + customer can draw. */} +