mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-09-23 02:35:43 +00:00
style(frontend): trim JSDoc fluff on DataTable empty-state additions
The JSDoc blocks added in afb9b63 mostly paraphrased the 12 lines of
code below them. Reviewing line-by-line:
- "two axes" / "filter active vs no filter" / per-state copy — code
reads identically and is right next to the comment.
- "kept inline because tightly coupled to effectiveQuery" — every
helper in this file is inline, that's the existing convention.
- "colSpan={columns.length} parent" — the one call site is 10 lines
below in the same file.
- "for callers that have not migrated yet" — `empty?:` being optional
already says this.
- "so existing tests stay green" — the test itself documents the
contract; deleting the fallback fails it loudly.
Kept the one piece TypeScript can't express: a single-line hint that
`entityName` wants the plural lowercase form so the generated copy
reads naturally mid-sentence. That shows up in IDE autocomplete and
saves a "Flows" → "No Flows match" first-try mistake.
No behaviour change. 28/28 DataTable tests pass, 0 ESLint errors.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
afb9b637ef
commit
606eb7bf1f
@@ -74,18 +74,7 @@ interface DataTableProps<TData, TValue = unknown> {
|
||||
columns: ColumnDef<TData, TValue>[];
|
||||
columnVisibility?: VisibilityState;
|
||||
data: TData[];
|
||||
/**
|
||||
* Empty-state copy. When provided, the bare "No results." cell is replaced
|
||||
* with a shadcn `<Empty>` block whose title and description adapt to whether
|
||||
* a filter is currently active:
|
||||
* - filter empty + filter active → "No matches" + `No <entityName> match "<query>". Try a different query.`
|
||||
* - filter empty + no filter → `No <entityName> yet.`
|
||||
*
|
||||
* Pass the plural lowercase form (`"flows"`, `"knowledge documents"`,
|
||||
* `"API tokens"`) so the generated copy reads naturally. Omitting the prop
|
||||
* preserves the legacy `"No results."` fallback for callers that have not
|
||||
* migrated yet.
|
||||
*/
|
||||
/** Plural lowercase, e.g. `"flows"`, `"knowledge documents"`, `"API tokens"`. */
|
||||
empty?: { entityName?: string };
|
||||
/**
|
||||
* Search target(s) for the filter input. Three modes:
|
||||
@@ -175,18 +164,6 @@ interface DataTableFilterProps {
|
||||
query: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the body-row "no data" cell content. Two axes:
|
||||
* - `filterValue` empty/non-empty: distinguishes a truly empty dataset from a
|
||||
* filter that excluded every row.
|
||||
* - `entityName` provided/omitted: callers that pass `empty.entityName` get the
|
||||
* shadcn `<Empty>` block with a filter-aware copy; callers that don't keep
|
||||
* the legacy bare `"No results."` label so existing tests stay green.
|
||||
*
|
||||
* Kept inline (rather than exported) because the props are tightly coupled to
|
||||
* `DataTable`'s internal `effectiveQuery` and the layout assumes it lives
|
||||
* inside a `<TableCell>` with `colSpan={columns.length}`.
|
||||
*/
|
||||
function DataTableEmptyState({ entityName, filterValue }: DataTableEmptyStateProps) {
|
||||
if (!entityName) {
|
||||
return <>No results.</>;
|
||||
|
||||
Reference in New Issue
Block a user