🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(web): table sort caret and centred selection checkboxes (#18354)
Trang Nguyendd01343a055b
diff --git a/web/src/components/table/data-table.clienttest.tsx b/web/src/components/table/data-table.clienttest.tsxindex 6f2b0dd955..ec35d79ab2 100644--- a/web/src/components/table/data-table.clienttest.tsx+++ b/web/src/components/table/data-table.clienttest.tsx@@ -59,8 +59,8 @@ describe("DataTable column sorting affordances", () => {);expect(screen.getByText("Status")).toBeInTheDocument();- expect(screen.queryByText("â–²")).not.toBeInTheDocument();- expect(screen.queryByText("â–¼")).not.toBeInTheDocument();+ expect(screen.queryByText("sorted ascending")).not.toBeInTheDocument();+ expect(screen.queryByText("sorted descending")).not.toBeInTheDocument();});it("shows a sort indicator on a sortable column and toggles order on click", () => {@@ -69,14 +69,14 @@ describe("DataTable column sorting affordances", () => {);const nameHeader = screen.getByText("Generated Score Name").closest("th");- expect(nameHeader).toHaveTextContent("â–²");+ expect(nameHeader).toHaveTextContent("sorted ascending");fireEvent.click(nameHeader!);- expect(nameHeader).not.toHaveTextContent("â–²");- expect(nameHeader).not.toHaveTextContent("â–¼");+ expect(nameHeader).not.toHaveTextContent("sorted ascending");+ expect(nameHeader).not.toHaveTextContent("sorted descending");fireEvent.click(nameHeader!);- expect(nameHeader).toHaveTextContent("â–¼");+ expect(nameHeader).toHaveTextContent("sorted descending");});it("does not change orderBy when a non-sortable header is clicked", () => {@@ -89,8 +89,8 @@ describe("DataTable column sorting affordances", () => {fireEvent.click(statusHeader!);- expect(nameHeader).toHaveTextContent("â–²");- expect(statusHeader).not.toHaveTextContent("â–²");- expect(statusHeader).not.toHaveTextContent("â–¼");+ expect(nameHeader).toHaveTextContent("sorted ascending");+ expect(statusHeader).not.toHaveTextContent("sorted ascending");+ expect(statusHeader).not.toHaveTextContent("sorted descending");});});diff --git a/web/src/components/table/data-table.tsx b/web/src/components/table/data-table.tsxindex cc4ca25422..27030e1609 100644--- a/web/src/components/table/data-table.tsx+++ b/web/src/components/table/data-table.tsx@@ -779,10 +779,19 @@ function TableRefetchBar({ active }: { active: boolean }) {function renderOrderingIndicator(orderBy?: OrderByState) {if (!orderBy) return null;- if (orderBy.order === "ASC") return <span className="ml-1">â–²</span>;+ const ascending = orderBy.order === "ASC";return (- <span className="ml-1" title="Sort by this column">- â–¼+ <span className="ml-1 inline-flex shrink-0 items-center">+ <svg+ viewBox="0 0 24 24"+ className="icon-base text-icon-foreground fill-current"+ aria-hidden="true"+ >+ <path d={ascending ? "M7 14h10l-5-6z" : "M7 10h10l-5 6z"} />+ </svg>+ <span className="sr-only">+ {ascending ? "sorted ascending" : "sorted descending"}+ </span></span>);}@@ -1049,7 +1058,7 @@ function TableBodyComponent<TData>({) : (<TableRow className="hover:bg-transparent"><TableCell colSpan={columns.length} className="h-24">- <div className="pointer-events-none absolute left-[50%] flex -translate-x-1/2 -translate-y-1/2 items-center justify-center text-center">+ <div className="text-muted-foreground pointer-events-none absolute left-[50%] flex -translate-x-1/2 -translate-y-1/2 items-center justify-center text-center text-sm">{noResultsMessage ?? (<>No results.{" "}diff --git a/web/src/features/table/components/TableSelectionManager.tsx b/web/src/features/table/components/TableSelectionManager.tsxindex 671b0de53f..84c0adb3b6 100644--- a/web/src/features/table/components/TableSelectionManager.tsx+++ b/web/src/features/table/components/TableSelectionManager.tsx@@ -130,6 +130,7 @@ function SelectionRowCheckbox<TData>({return (<div+ className="flex items-center"onClick={(e) => {e.stopPropagation();}}@@ -204,7 +205,7 @@ export function TableSelectionManager<TData>({selectActionColumn: {id: "select",accessorKey: "select",- size: 35,+ size: 32,isFixedPosition: true,isPinnedLeft: true,loadingCell: <Skeleton className="h-4 w-4 shrink-0 rounded-sm" />,