Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

Add autoanimate to tables (#91)

Marc Klingenf5a560170d17
diff --git a/package-lock.json b/package-lock.json
index dcafd066b2..02271b0010 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,6 +12,7 @@
"@anthropic-ai/tokenizer": "^0.0.4",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
+ "@formkit/auto-animate": "^0.7.0",
"@headlessui/react": "^1.7.15",
"@heroicons/react": "^2.0.18",
"@hookform/resolvers": "^3.1.1",
@@ -1122,6 +1123,11 @@
"resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.1.tgz",
"integrity": "sha512-m0G6wlnhm/AX0H12IOWtK8gASEMffnX08RtKkCgTdHb9JpHKGloI7icFfLg9ZmQeavcvR0PKmzxClyuFPSjKWw=="
},
+ "node_modules/@formkit/auto-animate": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/@formkit/auto-animate/-/auto-animate-0.7.0.tgz",
+ "integrity": "sha512-RczHUr0AhRPssREoNdRjLfk2b/id9/DFnbIq18QM8L7E4zNV3XH+WO480EZ46BQHDEsv76YPJ0JbG2Y2i3GfXw=="
+ },
"node_modules/@headlessui/react": {
"version": "1.7.16",
"resolved": "https://registry.npmjs.org/@headlessui/react/-/react-1.7.16.tgz",
diff --git a/package.json b/package.json
index 290c06a454..d900aff574 100644
--- a/package.json
+++ b/package.json
@@ -24,6 +24,7 @@
"@anthropic-ai/tokenizer": "^0.0.4",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
+ "@formkit/auto-animate": "^0.7.0",
"@headlessui/react": "^1.7.15",
"@heroicons/react": "^2.0.18",
"@hookform/resolvers": "^3.1.1",
diff --git a/src/components/table/data-table.tsx b/src/components/table/data-table.tsx
index bdd2ef64eb..d8f367e26f 100644
--- a/src/components/table/data-table.tsx
+++ b/src/components/table/data-table.tsx
@@ -18,6 +18,7 @@ import {
} from "@/src/components/ui/table";
import { useState } from "react";
import { type TableRowOptions } from "@/src/components/table/types";
+import { useAutoAnimate } from "@formkit/auto-animate/react";
interface DataTableProps<TData, TValue> {
columns: ColumnDef<TData, TValue>[];
@@ -37,6 +38,7 @@ export function DataTable<TData, TValue>({
data,
}: DataTableProps<TData, TValue>) {
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);
+ const [animationParent] = useAutoAnimate();
const table = useReactTable({
data: data.data ?? [],
@@ -76,7 +78,7 @@ export function DataTable<TData, TValue>({
</TableRow>
))}
</TableHeader>
- <TableBody>
+ <TableBody ref={animationParent}>
{data.isLoading || !data.data ? (
<TableRow>
<TableCell
diff --git a/src/components/token-usage-badge.tsx b/src/components/token-usage-badge.tsx
index 3de29cfb55..5ab9f513b2 100644
--- a/src/components/token-usage-badge.tsx
+++ b/src/components/token-usage-badge.tsx
@@ -40,6 +40,13 @@ export const TokenUsageBadge = (
}
: props;
+ if (
+ usage.promptTokens === 0 &&
+ usage.completionTokens === 0 &&
+ usage.totalTokens === 0
+ )
+ return <></>;
+
if (props.inline)
return (
<span>