Spaces:
Running
Running
File size: 1,406 Bytes
b034029 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | import { formatNumber } from '../../lib/usage'
import styles from '../../pages/usage/UsagePage.module.css'
interface SourceStat {
source: string
requests: number
tokens: number
}
interface SourceStatsCardProps {
items: SourceStat[]
}
export function SourceStatsCard({ items }: SourceStatsCardProps) {
return (
<section className={styles.panel}>
<div className={styles.panelHeader}>
<div>
<h2>Source stats</h2>
<p className={styles.panelSubtitle}>Credential-like source activity summary for the selected range.</p>
</div>
<span>{items.length} sources</span>
</div>
<div className={styles.tableScroller}>
<div className={styles.table}>
<div className={styles.tableHeaderCompact}>
<span>Source</span>
<span>Requests</span>
<span>Tokens</span>
<span>Share</span>
<span>Status</span>
</div>
{items.map((item, index) => (
<div key={item.source} className={styles.tableRowCompact}>
<span>{item.source}</span>
<span>{formatNumber(item.requests)}</span>
<span>{formatNumber(item.tokens)}</span>
<span>#{index + 1}</span>
<span>{item.requests > 0 ? 'Active' : 'Idle'}</span>
</div>
))}
</div>
</div>
</section>
)
}
|