import type { CostByUserReport } from "@paperclipai/shared"; import { CostAmount } from "./CostAmount"; import { Identity } from "./Identity"; import { Card, CardContent, CardHeader, CardTitle } from "./ui/card"; import { formatTokens } from "../lib/utils"; export function CostByUserTable({ report }: { report: CostByUserReport }) { return ( By user
{report.rows.length === 0 && ( )} {report.rows.map(row => ( ))}
User Runs Input Output Cost
No user-attributed costs yet.
{row.userId ? : "Unattributed"} {row.runCount.toLocaleString()} {formatTokens(row.inputTokens + row.cachedInputTokens)} {row.cachedInputTokens > 0 &&
{formatTokens(row.cachedInputTokens)} cached
}
{formatTokens(row.outputTokens)} {row.unpricedEventCount > 0 &&
{row.unpricedEventCount} unpriced {row.unpricedEventCount === 1 ? "charge" : "charges"}
}
{report.rows.some(row => row.userId === null) && (

Unattributed costs have no recorded user in this organization.

)}
); }