import React from 'react' import { EmptyState, ToolDot, Spark } from '../../primitives' import type { Project } from '../../api/adapters' interface ProjectsTableProps { projects: Project[] cursor: number onCursor: (i: number) => void onOpen: (p: Project) => void } const COLS = '1fr 90px 90px 110px 110px 90px' // Format TOK: 12400 → "12.4k"; small numbers unchanged function formatTok(n: number): string { if (n >= 1000) { return (n / 1000).toFixed(1) + 'k' } return String(n) } // Format lastActive ISO string: recent = "Apr 25 11:08"; empty = "—" function formatLastActive(iso: string): string { if (!iso) return '—' const d = new Date(iso) const now = new Date() const diffMs = now.getTime() - d.getTime() const h24 = 24 * 60 * 60 * 1000 if (diffMs <= h24) { return d.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: false }) } return ( d.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }) + ' ' + d.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', hour12: false }) ) } export function ProjectsTable({ projects, cursor, onCursor, onOpen }: ProjectsTableProps): React.JSX.Element { if (projects.length === 0) { return (