Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fix: dashboard filter UX and duplicate counter filters (#14646)

Damian Legawiece32b94d27584
diff --git a/docs/developer/core-concepts/reporting.mdx b/docs/developer/core-concepts/reporting.mdx
index 8321888df3..bebde599bf 100644
--- a/docs/developer/core-concepts/reporting.mdx
+++ b/docs/developer/core-concepts/reporting.mdx
@@ -191,7 +191,7 @@ beside metrics and dimensions, and `GET /dashboard/counters` evaluates them:
"nav": "orders",
"link": {
"resource": "orders",
- "filters": [{ "field": "fulfillment_status", "operator": "eq", "value": "unfulfilled" }]
+ "filters": [{ "field": "fulfillment_status", "operator": "in", "value": "unfulfilled" }]
}
}
]
diff --git a/packages/dashboard-core/src/components/table-toolbar.tsx b/packages/dashboard-core/src/components/table-toolbar.tsx
index c08e4c8bd5..4900d284cb 100644
--- a/packages/dashboard-core/src/components/table-toolbar.tsx
+++ b/packages/dashboard-core/src/components/table-toolbar.tsx
@@ -1,6 +1,7 @@
import {
Button,
Checkbox,
+ cn,
DropdownMenu,
DropdownMenuCheckboxItem,
DropdownMenuContent,
@@ -28,6 +29,7 @@ import {
ArrowUpDownIcon,
CheckIcon,
ChevronDownIcon,
+ ChevronLeftIcon,
ChevronRightIcon,
Columns3Icon,
ListFilter,
@@ -205,14 +207,18 @@ export function TableToolbar({
// `status not_eq active` set from the panel lands on a field a control owns
// but in an operator it cannot show, so it must keep its chip — hiding it
// would leave the list filtered by something invisible and unremovable.
- // The field list skips anything with a quick control on the row: that field
- // already has a visible control, and listing it here offers a second route
- // to the same thing. It stays reachable through the panel's field-switch
- // select, which is how a `status is not` gets built.
- const panelColumns = useMemo(() => {
- const covered = new Set(quickFilterColumns.map((c) => c.key))
- return filterableColumns.filter((c) => !covered.has(c.key))
- }, [filterableColumns, quickFilterColumns])
+ // The field list leads with what has no quick control. A quick-filtered
+ // field is listed after those, under its own heading, because the panel is
+ // the only place to express an operator its control cannot — a `status is
+ // not active` has no representation in a list of checkboxes.
+ const quickFilterKeys = useMemo(
+ () => new Set(quickFilterColumns.map((c) => c.key)),
+ [quickFilterColumns],
+ )
+ const panelColumns = useMemo(
+ () => filterableColumns.filter((c) => !quickFilterKeys.has(c.key)),
+ [filterableColumns, quickFilterKeys],
+ )
const chipFilters = useMemo(() => {
const covered = new Set(
quickFilterColumns.flatMap((c) =>
@@ -301,13 +307,13 @@ export function TableToolbar({
<FilterPanel
columns={panelColumns}
allColumns={filterableColumns}
+ quickFilterKeys={quickFilterKeys}
filters={filters}
onApply={(f) => {
onFiltersChange(f)
setFilterOpen(false)
}}
onChange={onFiltersChange}
- onClose={() => setFilterOpen(false)}
/>
</PopoverContent>
</Popover>
@@ -342,7 +348,7 @@ export function TableToolbar({
{/* The search term as a chip, mobile only — the field it came from is
hidden there, so this is the only way to see or clear it. */}
{search && (
- <span className="inline-flex h-11 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-muted py-1 pr-1 pl-2.5 text-sm lg:hidden">
+ <span className="inline-flex h-11 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card py-1 pr-1 pl-2.5 text-sm shadow-xs lg:hidden">
<span className="text-muted-foreground">
{t('admin.components.table_toolbar.search_placeholder')}
</span>
@@ -460,7 +466,13 @@ function FilterChip({
// like a Badge: on this row it is the same kind of thing — a constraint
// you can see and remove — and a chip that reads as a label instead of a
// control invites the reader to look for the control elsewhere.
- <span className="inline-flex h-11 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-muted py-1 pr-1 pl-2.5 text-sm lg:h-[2.125rem]">
+ //
+ // So it wears the outline button's own surface — `bg-card`, `shadow-xs`,
+ // `rounded-md` — rather than a `bg-muted` of its own. A filled chip beside
+ // outlined controls reads as a different kind of object, when the only
+ // real difference is that this one is set and they are not: the solid
+ // border already says that, against the dashed one an unused control wears.
+ <span className="inline-flex h-11 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card py-1 pr-1 pl-2.5 text-sm shadow-xs lg:h-[2.125rem]">
<span className="text-muted-foreground">{label}</span>
{isRange ? (
// "1 Aug – 29 Aug 2026" rather than two chips of ISO bounds: the range
@@ -615,6 +627,22 @@ function SortDropdown({
// Quick filters
// ============================================================================
+/**
+ * Trigger styling shared by the three quick filters.
+ *
+ * A control that is not narrowing anything wears a dashed border. Solid
+ * borders read as "this is set", and a row of four identical outlines made the
+ * operator check each one's value to find which were actually filtering the
+ * list. Dashed is the quieter state, so the ones doing work stand out without
+ * having to shout — the chips beside them stay solid for the same reason.
+ *
+ * `Add filter` keeps its solid border: it is an action, not a filter that
+ * happens to be empty.
+ */
+function quickFilterTriggerClass(unset: boolean) {
+ return cn('h-11 gap-1.5 lg:h-[2.125rem]', unset && 'border-dashed')
+}
+
/**
* Always-visible control for one heavily-used filter.
*
@@ -682,7 +710,7 @@ function QuickEnumFilter({
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <Button variant="outline" size="sm" className="h-11 gap-1.5 lg:h-[2.125rem]">
+ <Button variant="outline" size="sm" className={quickFilterTriggerClass(allSelected)}>
<span className="text-muted-foreground">{column.label}</span>
<span className="tabular-nums">
{allSelected ? t('admin.common.all') : `${selected.length}/${options.length}`}
@@ -788,7 +816,11 @@ function QuickResourceFilter({
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <Button variant="outline" size="sm" className="h-11 gap-1.5 lg:h-[2.125rem]">
+ <Button
+ variant="outline"
+ size="sm"
+ className={quickFilterTriggerClass(selected.length === 0)}
+ >
<span className="text-muted-foreground">{column.label}</span>
<span className="max-w-40 truncate">{summary}</span>
<ChevronDownIcon className="size-3.5 text-muted-foreground" />
@@ -888,7 +920,7 @@ function QuickDateFilter({
}}
>
<PopoverTrigger asChild>
- <Button variant="outline" size="sm" className="h-11 gap-1.5 lg:h-[2.125rem]">
+ <Button variant="outline" size="sm" className={quickFilterTriggerClass(active === 'all')}>
<span className="text-muted-foreground">{column.label}</span>
<span>{t(`admin.components.table_toolbar.date_presets.${active}`)}</span>
<ChevronDownIcon className="size-3.5 text-muted-foreground" />
@@ -1161,17 +1193,13 @@ function InlineValueList({
if (!isCurrency && (tags.isLoading || resources.isLoading)) {
return (
- <p className="px-2 py-6 text-center text-sm text-muted-foreground">
- {t('admin.common.loading')}
- </p>
+ <p className="px-2 py-6 text-center text-muted-foreground">{t('admin.common.loading')}</p>
)
}
if (ordered.length === 0) {
return (
- <p className="px-2 py-6 text-center text-sm text-muted-foreground">
- {t('admin.common.no_results')}
- </p>
+ <p className="px-2 py-6 text-center text-muted-foreground">{t('admin.common.no_results')}</p>
)
}
@@ -1181,7 +1209,7 @@ function InlineValueList({
<button
key={option.value}
type="button"
- className="flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left text-sm transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
+ className="flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
onClick={() => onToggle(option.value)}
>
<Checkbox checked={selected.includes(option.value)} className="pointer-events-none" />
@@ -1196,8 +1224,7 @@ function InlineValueList({
* The advanced filter panel, in two stages.
*
* Stage one lists the fields. Stage two commits to one of them and shows its
- * values, with the field name kept as a select in the header so switching
- * subject is one click rather than a trip back.
+ * values, with the field name kept in the header as the way back to stage one.
*
* One filter at a time, deliberately: filters compose by being applied in
* succession, and each one lands as a chip on the toolbar row, so the row is
@@ -1207,21 +1234,26 @@ function InlineValueList({
function FilterPanel({
columns,
allColumns,
+ quickFilterKeys,
filters,
onApply,
onChange,
- onClose,
}: {
- /** Fields offered in the list — excludes those with a quick control. */
+ /** Fields offered first — those with no quick control of their own. */
columns: ColumnDef[]
- /** Every filterable field, for the field-switch select once one is chosen. */
+ /** Every filterable field. The ones absent from `columns` are listed after
+ * them, for the operators their quick control cannot express. */
allColumns: ColumnDef[]
+ /** Which fields have a quick control on the row. Such a field goes to the
+ * operator picker rather than the one-click value list: the list writes
+ * `eq`, and only `in` is the operator a control displays, so a one-click
+ * `eq` would chip while its control still read "All". */
+ quickFilterKeys: Set<string>
filters: FilterRule[]
/** Commit and close — for the filters that are finished in one action. */
onApply: (filters: FilterRule[]) => void
/** Update without closing — for a multi-select the user is still building. */
onChange: (filters: FilterRule[]) => void
- onClose: () => void
}) {
const { t } = useTranslation()
const tenantId = useTenantId()
@@ -1245,22 +1277,6 @@ function FilterPanel({
() => getOperators(type).map((op) => ({ value: op.value, label: t(op.labelKey) })),
[type, t],
)
- // The switch select offers what the field list offered, plus whatever is
- // currently chosen. Listing every filterable field would put the
- // quick-filtered ones — which have their own control on the row — back into
- // the panel, so "Date" would appear twice on screen at once.
- const switchColumns = useMemo(() => {
- const offered = columns.slice()
- if (field && !offered.some((c) => c.key === field)) {
- const current = allColumns.find((c) => c.key === field)
- if (current) offered.unshift(current)
- }
- return offered
- }, [columns, allColumns, field])
- const fieldItems = useMemo(
- () => switchColumns.map((c) => ({ value: c.key, label: c.label })),
- [switchColumns],
- )
// Types whose values are a fixed list the panel can render inline. Anything
// else needs its own control (an autocomplete, a date picker, a text box),
@@ -1268,12 +1284,18 @@ function FilterPanel({
// Types whose values are chosen from a list rather than typed. `multi` ones
// accumulate a set and need an explicit Apply; the single ones commit on the
// click that picks them.
- const multi = type === 'tags' || type === 'resource' || type === 'currency'
+ // A field whose quick control already covers the straightforward case is
+ // here for the operators that control cannot express, so it skips the
+ // shorthands — the value list and the date presets — and goes to the
+ // operator picker. Those shorthands write exactly what the control already
+ // writes, which is the one thing the panel does not need to offer twice.
+ const quickFiltered = Boolean(field) && quickFilterKeys.has(field as string)
+ const multi = !quickFiltered && (type === 'tags' || type === 'resource' || type === 'currency')
// Dates are their own shape: a list of relative presets, with the calendar
// behind "custom". Same presets the quick filter offers, so a range means
// the same thing wherever it was set.
- const dated = type === 'date'
- const listed = type === 'enum' || type === 'boolean' || multi
+ const dated = !quickFiltered && type === 'date'
+ const listed = !quickFiltered && (type === 'enum' || type === 'boolean' || multi)
// The header search filters the list below it, so it earns its place only
// when there is a list: the fields, or a list-shaped type's values.
const searchable = (!field || listed) && !dated
@@ -1291,11 +1313,22 @@ function FilterPanel({
}, [type, column?.filterOptions, column?.booleanLabels, query, t])
const visibleFields = useMemo(() => {
- if (!query.trim()) return columns
const needle = query.trim().toLowerCase()
- return columns.filter((c) => c.label.toLowerCase().includes(needle))
+ const matching = (list: ColumnDef[]) =>
+ needle ? list.filter((c) => c.label.toLowerCase().includes(needle)) : list
+ return matching(columns)
}, [columns, query])
+ // The fields a quick control already owns, listed under their own heading
+ // below the rest. They are the only route to an operator the control cannot
+ // express, and burying them entirely is what left `status is not active`
+ // unbuildable from anywhere.
+ const visibleQuickFields = useMemo(() => {
+ const offered = allColumns.filter((c) => quickFilterKeys.has(c.key))
+ const needle = query.trim().toLowerCase()
+ return needle ? offered.filter((c) => c.label.toLowerCase().includes(needle)) : offered
+ }, [allColumns, quickFilterKeys, query])
+
function chooseField(key: string) {
const col = allColumns.find((c) => c.key === key)
const firstOperator = getOperators(col?.filterType ?? 'string')[0].value
@@ -1307,6 +1340,18 @@ function FilterPanel({
const applied = filters.find((f) => f.field === key && f.operator === 'in')
setValue(applied?.value ?? '')
setQuery('')
+ setCustomRange(null)
+ }
+
+ /** Back to the field list. Clears the half-built rule with it — the search
+ * box is shared between the two stages, and a value left behind would be
+ * seeded into whichever field is picked next. */
+ function clearField() {
+ setField(null)
+ setOperator('')
+ setValue('')
+ setQuery('')
+ setCustomRange(null)
}
/**
@@ -1371,34 +1416,40 @@ function FilterPanel({
}
return (
- <div className="flex flex-col">
+ // `rounded-xl` to match the popover, and `overflow-hidden` to enforce it:
+ // the panel is mounted with `p-0`, so the header meets the popover's edge
+ // directly and every square background inside it — the back button's hover
+ // fill, the search field's own ground — paints over the rounded corner and
+ // squares it off. Clipping here fixes both top corners once, rather than
+ // asking each child to round the one it happens to touch.
+ <div className="flex flex-col overflow-hidden rounded-xl">
{/* Header. Before a field is chosen this is a label and a search box over
- the field list; after, the label becomes a select, so changing subject
- costs one click instead of backing out. */}
- <div className="flex items-stretch border-b">
+ the field list; after, the label becomes the way back to it. */}
+ {/* The panel reads at the app's base size rather than the 13px the
+ dropdowns beside it use: it is a surface to read a list in, not a
+ menu to flick through, and its rows carry field names an operator has
+ to recognise. Set here and on the body below, so a row only names a
+ size when it departs from it. */}
+ <div className="flex items-stretch border-b text-base">
{field ? (
- <Select items={fieldItems} value={field} onValueChange={chooseField}>
- <SelectTrigger
- size="sm"
- // Sits flush in the panel's top-left corner, so it drops the
- // standalone-field focus treatment: a blue border and a 3px
- // outer glow paint past the panel's rounded edge and read as a
- // rendering fault. A background change carries focus instead,
- // which stays inside the element's own box.
- className="w-auto shrink-0 rounded-none border-0 border-r bg-transparent shadow-none focus:border-border focus:bg-accent focus:shadow-none"
- >
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- {switchColumns.map((c) => (
- <SelectItem key={c.key} value={c.key}>
- {c.label}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
+ // The field name is the way back, not a second picker. It used to
+ // open a dropdown over the value list underneath — a menu on top of
+ // the menu it was covering, offering the same fields the screen
+ // behind it was already showing. Clicking it now simply returns to
+ // that list, which is where changing subject was always going to
+ // end up.
+ <button
+ type="button"
+ className="flex shrink-0 cursor-pointer items-center gap-1.5 rounded-none border-r px-3 py-2 font-medium transition-colors hover:bg-accent focus-visible:bg-accent focus-visible:outline-none"
+ onClick={clearField}
+ >
+ {/* Leads the label rather than trailing it: a back arrow points at
+ what it returns to, and after the word it pointed at nothing. */}
+ <ChevronLeftIcon className="size-4 shrink-0 text-muted-foreground" />
+ {column?.label ?? field}
+ </button>
) : (
- <span className="flex shrink-0 items-center border-r px-3 py-2 text-sm font-medium">
+ <span className="flex shrink-0 items-center border-r px-3 py-2 font-medium">
{t('admin.components.table_toolbar.filter_by')}
</span>
)}
@@ -1417,16 +1468,30 @@ function FilterPanel({
) : (
<span className="flex-1" />
)}
- <Button onClick={onClose} size="icon-sm" variant="ghost" className="m-1 shrink-0">
- <XIcon className="size-4" />
- </Button>
+ {/* Clears the search box, and only that. It used to close the whole
+ panel, sitting a few pixels from a text field it looked like it
+ belonged to — so the one gesture that reliably means "empty this
+ field" threw away the filter being built instead. Closing is what
+ Escape and a click outside already do, and neither is ambiguous. */}
+ {searchable && query ? (
+ <Button
+ type="button"
+ onClick={() => setQuery('')}
+ size="icon-sm"
+ variant="ghost"
+ aria-label={t('admin.common.clear')}
+ className="m-1 shrink-0"
+ >
+ <XIcon className="size-4" />
+ </Button>
+ ) : null}
</div>
{/* Scrolls, and says so. `overscroll-contain` keeps a flick at the end of
the list from scrolling the page behind the panel; the themed
scrollbar the popover supplies is what tells the reader there is more
below, since the rows themselves end flush at the container's edge. */}
- <div className="max-h-[320px] overflow-y-auto overscroll-contain p-1 themed-scrollbar">
+ <div className="max-h-[320px] overflow-y-auto overscroll-contain p-1 text-base themed-scrollbar">
{/* Stage one: pick a subject. */}
{!field &&
visibleFields.map((col) => (
@@ -1434,7 +1499,7 @@ function FilterPanel({
key={col.key}
type="button"
data-slot="filter-panel-item"
- className="flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
+ className="flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
onClick={() => chooseField(col.key)}
>
{col.label}
@@ -1442,6 +1507,32 @@ function FilterPanel({
</button>
))}
+ {/* The fields that already have a control on the row. Set apart under
+ a heading rather than mixed in, because picking one here means
+ something narrower than picking any field above: not "filter by
+ status" — the control does that — but "filter by status in a way
+ the control cannot say". */}
+ {!field && visibleQuickFields.length > 0 && (
+ <>
+ {visibleFields.length > 0 && <div className="my-1 border-t" />}
+ <p className="px-2 py-1.5 text-xs text-muted-foreground">
+ {t('admin.components.table_toolbar.more_conditions')}
+ </p>
+ {visibleQuickFields.map((col) => (
+ <button
+ key={col.key}
+ type="button"
+ data-slot="filter-panel-item"
+ className="flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
+ onClick={() => chooseField(col.key)}
+ >
+ {col.label}
+ <ChevronRightIcon className="size-3.5 shrink-0 text-muted-foreground" />
+ </button>
+ ))}
+ </>
+ )}
+
{/* Stage two, list-shaped types: the values themselves, one click to
apply. No operator control — "is" is the only thing a list of
values can mean, and offering "is not" here would double the list's
@@ -1454,7 +1545,7 @@ function FilterPanel({
key={option.value}
type="button"
data-slot="filter-panel-item"
- className="flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left text-sm transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
+ className="flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
onClick={() => commit(option.value, 'eq')}
>
{/* Booleans get one too: their values carry the same
@@ -1489,7 +1580,7 @@ function FilterPanel({
key={preset}
type="button"
data-slot="filter-panel-item"
- className="flex w-full items-center rounded-lg px-2 py-1.5 text-left text-sm transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
+ className="flex w-full items-center rounded-lg px-2 py-1.5 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
onClick={() => commitDatePreset(preset)}
>
{t(`admin.components.table_toolbar.date_presets.${preset}`)}
@@ -1498,7 +1589,7 @@ function FilterPanel({
<button
type="button"
data-slot="filter-panel-item"
- className="flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-left text-sm transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
+ className="flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50"
onClick={() => setCustomRange({ from: '', to: '' })}
>
{t('admin.components.table_toolbar.date_presets.custom')}
@@ -1576,7 +1667,11 @@ function FilterPanel({
{field && !listed && !dated && (
<div data-slot="filter-panel-controls" className="flex flex-col gap-2 p-2">
<Select items={operators} value={operator} onValueChange={setOperator}>
- <SelectTrigger size="sm">
+ {/* Default size, not `sm`: this sits directly above the value
+ input, and `sm` pins a fixed 8 height while the input only
+ has that as a floor and grows with the panel's 14px text —
+ so the pair rendered at two different heights. */}
+ <SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
@@ -1588,10 +1683,31 @@ function FilterPanel({
</SelectContent>
</Select>
+ {/* A quick-filtered enum still knows its values, so it picks from
+ them rather than asking for a slug typed from memory: this
+ branch is reached for `is not`, which the control cannot say,
+ not because the values became unknown. */}
+ {!noValueOperators.includes(operator) && listOptions.length > 0 ? (
+ <Select items={listOptions} value={value} onValueChange={setValue}>
+ <SelectTrigger>
+ <SelectValue
+ placeholder={t('admin.components.table_toolbar.filter_select_placeholder')}
+ />
+ </SelectTrigger>
+ <SelectContent>
+ {listOptions.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ {option.label}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ ) : null}
+
{/* Everything picked from a list — currency, tags, resources — or
from a calendar is handled above; this branch is only the types
you type into. */}
- {!noValueOperators.includes(operator) && (
+ {!noValueOperators.includes(operator) && listOptions.length === 0 && (
<Input
type={type === 'number' ? 'number' : 'text'}
placeholder={t('admin.components.table_toolbar.filter_text_placeholder')}
@@ -1621,9 +1737,9 @@ function FilterPanel({
{/* Nothing matched the search — say so rather than showing a blank
panel that reads as broken. */}
- {((!field && visibleFields.length === 0) ||
+ {((!field && visibleFields.length === 0 && visibleQuickFields.length === 0) ||
(field && listed && !multi && listOptions.length === 0)) && (
- <p className="px-2 py-6 text-center text-sm text-muted-foreground">
+ <p className="px-2 py-6 text-center text-muted-foreground">
{t('admin.common.no_results')}
</p>
)}
diff --git a/packages/dashboard-core/src/locales/ar.json b/packages/dashboard-core/src/locales/ar.json
index efd65c5dd2..4c74e96d05 100644
--- a/packages/dashboard-core/src/locales/ar.json
+++ b/packages/dashboard-core/src/locales/ar.json
@@ -429,6 +429,7 @@
"filter_select_placeholder": "اختر…",
"filter_text_placeholder": "تصفية…",
"filter_to_placeholder": "التصفية إلى…",
+ "more_conditions": "شروط إضافية",
"operators": {
"after": "بعد",
"before": "قبل",
diff --git a/packages/dashboard-core/src/locales/de.json b/packages/dashboard-core/src/locales/de.json
index 35aa093644..8de6d569b7 100644
--- a/packages/dashboard-core/src/locales/de.json
+++ b/packages/dashboard-core/src/locales/de.json
@@ -429,6 +429,7 @@
"filter_select_placeholder": "Auswählen…",
"filter_text_placeholder": "Filtern…",
"filter_to_placeholder": "Filtern auf…",
+ "more_conditions": "Weitere Bedingungen",
"operators": {
"after": "nach",
"before": "vor",
diff --git a/packages/dashboard-core/src/locales/en.json b/packages/dashboard-core/src/locales/en.json
index d7898d4b5b..1f050dda9a 100644
--- a/packages/dashboard-core/src/locales/en.json
+++ b/packages/dashboard-core/src/locales/en.json
@@ -431,6 +431,7 @@
"filter_select_placeholder": "Select…",
"filter_text_placeholder": "Filter…",
"filter_to_placeholder": "Filter to…",
+ "more_conditions": "More conditions",
"operators": {
"after": "after",
"before": "before",
diff --git a/packages/dashboard-core/src/locales/fr.json b/packages/dashboard-core/src/locales/fr.json
index 126b98f936..e31aaaf28f 100644
--- a/packages/dashboard-core/src/locales/fr.json
+++ b/packages/dashboard-core/src/locales/fr.json
@@ -429,6 +429,7 @@
"filter_select_placeholder": "Sélectionner…",
"filter_text_placeholder": "Filtrer…",
"filter_to_placeholder": "Filtrer sur…",
+ "more_conditions": "Autres conditions",
"operators": {
"after": "après",
"before": "avant",
diff --git a/packages/dashboard-core/src/locales/pl.json b/packages/dashboard-core/src/locales/pl.json
index 85909842aa..fb96fbf205 100644
--- a/packages/dashboard-core/src/locales/pl.json
+++ b/packages/dashboard-core/src/locales/pl.json
@@ -430,6 +430,7 @@
"filter_select_placeholder": "Wybierz…",
"filter_text_placeholder": "Filtruj…",
"filter_to_placeholder": "Filtruj do…",
+ "more_conditions": "Więcej warunków",
"operators": {
"after": "po",
"before": "przed",
diff --git a/packages/dashboard-core/src/locales/zh-CN.json b/packages/dashboard-core/src/locales/zh-CN.json
index 3323e69b59..46e73f07b5 100644
--- a/packages/dashboard-core/src/locales/zh-CN.json
+++ b/packages/dashboard-core/src/locales/zh-CN.json
@@ -429,6 +429,7 @@
"filter_select_placeholder": "选择…",
"filter_text_placeholder": "筛选…",
"filter_to_placeholder": "筛选至…",
+ "more_conditions": "更多条件",
"operators": {
"after": "晚于",
"before": "早于",
diff --git a/packages/dashboard/e2e/customers.spec.ts b/packages/dashboard/e2e/customers.spec.ts
index 31401509e3..6d88532390 100644
--- a/packages/dashboard/e2e/customers.spec.ts
+++ b/packages/dashboard/e2e/customers.spec.ts
@@ -497,9 +497,13 @@ test.describe('customers', () => {
await gotoIndex(page, CUSTOMERS_PATH(creds.store_id), CTA)
await expect(page.getByRole('link', { name: email })).toHaveCount(0, { timeout: 15_000 })
+ // Scoped to the panel's list rows: once a field is picked, its name also
+ // appears on the header button that goes back to the field list, so a bare
+ // name match finds both. The field and its `true` value are both "Erased".
await page.getByRole('button', { name: /add filter/i }).click()
- await page.getByRole('button', { name: /^erased$/i }).click()
- await page.getByRole('button', { name: /^erased$/i }).click()
+ const filterOption = page.locator('[data-slot="filter-panel-item"]')
+ await filterOption.getByText(/^erased$/i).click()
+ await filterOption.getByText(/^erased$/i).click()
await expect(page.getByText('(erased)').first()).toBeVisible({ timeout: 15_000 })
})
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
index 27d63e2dab..5c46922e8d 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/index.tsx
@@ -301,7 +301,10 @@ function counterLink(
// The orders table's column key, not its ransack attribute — the filter
// chip looks the column up by key to render "Channel is Web" rather than
// the raw id.
- filters.push({ id: 'home-channel', field: 'channel', operator: 'eq', value: channelId })
+ // `in`, not `eq`: a resource filter offers only `is any of` / `is none
+ // of`, so an `eq` rule renders a chip labelled with the raw operator and
+ // no control on the row recognises it.
+ filters.push({ id: 'home-channel', field: 'channel', operator: 'in', value: channelId })
}
return { to, filters }
}
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/dashboard_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/dashboard_controller_spec.rb
index eae656d56e..9125a34f3e 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/dashboard_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/dashboard_controller_spec.rb
@@ -27,7 +27,7 @@ RSpec.describe Spree::Api::V3::Admin::DashboardController, type: :controller do
expect(fulfill.keys).to match_array(%w[key value link nav])
expect(fulfill['link']).to eq(
'resource' => 'orders',
- 'filters' => [{ 'field' => 'fulfillment_status', 'operator' => 'eq', 'value' => 'unfulfilled' }]
+ 'filters' => [{ 'field' => 'fulfillment_status', 'operator' => 'in', 'value' => 'unfulfilled' }]
)
end
diff --git a/spree/core/lib/spree/reporting/default_vocabulary.rb b/spree/core/lib/spree/reporting/default_vocabulary.rb
index b4186b193d..b74f00eb86 100644
--- a/spree/core/lib/spree/reporting/default_vocabulary.rb
+++ b/spree/core/lib/spree/reporting/default_vocabulary.rb
@@ -650,8 +650,12 @@ module Spree
counter :orders_to_fulfill,
subject: -> { Spree::Order }, key_scope: 'read_orders', nav: 'orders',
count: ->(store, channel:) { PLACED_ORDERS.call(store, channel).ready_to_ship.count },
+ # `in` rather than `eq`, though it names one value: the
+ # orders table's Fulfillment control reads `in`, so an `eq`
+ # rule lands beside it as a separate chip and the control
+ # still says "All" — two filters on screen for one idea.
link: { resource: 'orders',
- filters: [{ field: 'fulfillment_status', operator: 'eq', value: 'unfulfilled' }] }
+ filters: [{ field: 'fulfillment_status', operator: 'in', value: 'unfulfilled' }] }
# Placed orders still owed money: nothing collected yet, authorized
# but not captured, or only partially paid.
diff --git a/spree/core/spec/lib/spree/reporting/counters_spec.rb b/spree/core/spec/lib/spree/reporting/counters_spec.rb
index cce8c4371d..7cac22d48c 100644
--- a/spree/core/spec/lib/spree/reporting/counters_spec.rb
+++ b/spree/core/spec/lib/spree/reporting/counters_spec.rb
@@ -20,7 +20,7 @@ RSpec.describe Spree::Reporting::Counters do
expect(results['orders_to_fulfill'].nav).to eq('orders')
expect(results['orders_to_fulfill'].link).to eq(
'resource' => 'orders',
- 'filters' => [{ 'field' => 'fulfillment_status', 'operator' => 'eq', 'value' => 'unfulfilled' }]
+ 'filters' => [{ 'field' => 'fulfillment_status', 'operator' => 'in', 'value' => 'unfulfilled' }]
)
expect(results.values.map(&:value)).to all(be_a(Integer))
end