11"use client"
22
3+ import { useMemo } from "react"
34import { useRouter } from "next/navigation"
4- import { Rocket } from "lucide-react"
5+ import Link from "next/link"
6+ import { ChevronRight , Rocket } from "lucide-react"
57
68import type { Run , TaskMetrics } from "@evals/db"
79
8- import { formatCurrency , formatDuration } from "@/lib"
10+ import { formatCurrency , formatDuration , formatTokens } from "@/lib"
911import { Button , Table , TableBody , TableCell , TableHead , TableHeader , TableRow } from "@/components/ui"
10- import { useMemo } from "react"
11- import Link from "next/link"
1212
1313export function Home ( { runs } : { runs : ( Run & { taskMetrics : TaskMetrics | null } ) [ ] } ) {
1414 const router = useRouter ( )
@@ -20,32 +20,39 @@ export function Home({ runs }: { runs: (Run & { taskMetrics: TaskMetrics | null
2020 < Table className = "border border-t-0" >
2121 < TableHeader >
2222 < TableRow >
23- < TableHead > ID</ TableHead >
2423 < TableHead > Model</ TableHead >
25- < TableHead > Timestamp</ TableHead >
2624 < TableHead > Passed</ TableHead >
2725 < TableHead > Failed</ TableHead >
2826 < TableHead > % Correct</ TableHead >
27+ < TableHead className = "text-center" > Tokens In / Out</ TableHead >
2928 < TableHead > Cost</ TableHead >
3029 < TableHead > Duration</ TableHead >
30+ < TableHead />
3131 </ TableRow >
3232 </ TableHeader >
3333 < TableBody >
3434 { visibleRuns . length ? (
3535 visibleRuns . map ( ( { taskMetrics, ...run } ) => (
3636 < TableRow key = { run . id } >
37- < TableCell >
38- < Button variant = "link" asChild >
39- < Link href = { `/runs/${ run . id } ` } > { run . id } </ Link >
40- </ Button >
41- </ TableCell >
4237 < TableCell > { run . model } </ TableCell >
43- < TableCell > { new Date ( run . createdAt ) . toLocaleString ( ) } </ TableCell >
4438 < TableCell > { run . passed } </ TableCell >
4539 < TableCell > { run . failed } </ TableCell >
4640 < TableCell > { ( ( run . passed / ( run . passed + run . failed ) ) * 100 ) . toFixed ( 1 ) } %</ TableCell >
41+ < TableCell >
42+ < div className = "flex items-center justify-evenly" >
43+ < div > { formatTokens ( taskMetrics ! . tokensIn ) } </ div > /
44+ < div > { formatTokens ( taskMetrics ! . tokensOut ) } </ div >
45+ </ div >
46+ </ TableCell >
4747 < TableCell > { formatCurrency ( taskMetrics ! . cost ) } </ TableCell >
4848 < TableCell > { formatDuration ( taskMetrics ! . duration ) } </ TableCell >
49+ < TableCell >
50+ < Button variant = "ghost" size = "icon" asChild >
51+ < Link href = { `/runs/${ run . id } ` } >
52+ < ChevronRight />
53+ </ Link >
54+ </ Button >
55+ </ TableCell >
4956 </ TableRow >
5057 ) )
5158 ) : (
0 commit comments