The app HAS a platform layer -- AnchoredPopover (22 importers, with arrows/typeahead/Escape/anchor-flip), QueryState (21), Modal (17), PageShell, DataTable, Tabs, Tooltip and ~26 more -- but it sat flat among ~160 feature components with nothing marking it as one. Several of those files describe themselves as 'the one place' or 'canonical' and were still bypassed by hand-rolled markup, because a layer nobody can see is a layer nobody uses; three separate inventory passes of this codebase misread it the same way. Moves the 33 domain-free modules into components/ui/, rewrites the imports in 89 files, and makes the boundary a lint rule rather than a convention: inside ui/ a one-level-up import (a feature component) and any lib/api slice are errors. The rule was verified to fire on both and to leave generic lib/ helpers alone. README.md states which side of the line a component belongs on and why. No behaviour change: 3x tsc, eslint, knip, prettier and 687 vitest tests all green; no backend file touched.
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { type Column } from "./DataTable";
|
|
import { type SortState } from "../../lib/columnSort";
|
|
import { optionsFromColumns } from "../../lib/sortOptions";
|
|
import SortControl from "./SortControl";
|
|
|
|
// The headerless sort control for views without clickable column headers (the channel manager's and
|
|
// discovery's card layouts). Now a thin adapter over the generic `SortControl`, feeding it the
|
|
// column-derived options and a "no sort" default — kept as its own component so the existing call
|
|
// sites stay untouched and table/cards keep sharing one `SortState`.
|
|
export default function ColumnSortControl<T>({
|
|
columns,
|
|
sort,
|
|
onChange,
|
|
label,
|
|
defaultLabel,
|
|
ascLabel,
|
|
descLabel,
|
|
}: {
|
|
columns: Column<T>[];
|
|
sort: SortState;
|
|
onChange: (next: SortState) => void;
|
|
/** Accessible name for the dropdown (e.g. "Sort"). */
|
|
label: string;
|
|
/** The "no sort / original order" option's text. */
|
|
defaultLabel: string;
|
|
ascLabel: string;
|
|
descLabel: string;
|
|
}) {
|
|
return (
|
|
<SortControl
|
|
options={optionsFromColumns(columns)}
|
|
sort={sort}
|
|
onChange={onChange}
|
|
label={label}
|
|
defaultLabel={defaultLabel}
|
|
ascLabel={ascLabel}
|
|
descLabel={descLabel}
|
|
/>
|
|
);
|
|
}
|