-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatsPanel.jsx
More file actions
30 lines (27 loc) · 1.04 KB
/
StatsPanel.jsx
File metadata and controls
30 lines (27 loc) · 1.04 KB
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
import React from 'react';
export default function StatsPanel({ data }) {
const totalCitations = data.reduce((sum, r) => sum + r.citations, 0);
const avgCitations = data.length ? Math.round(totalCitations / data.length) : 0;
const published = data.filter(r => r.status === 'Published').length;
const highImpact = data.filter(r => r.impact === 'High').length;
const stats = [
{ label: 'Papers', value: data.length },
{ label: 'Published', value: published },
{ label: 'High impact', value: highImpact },
{ label: 'Total citations', value: totalCitations.toLocaleString() },
{ label: 'Avg citations', value: avgCitations },
];
return (
<div className="stats-panel">
<span className="filter-label">Summary</span>
<div className="stats-grid">
{stats.map(s => (
<div key={s.label} className="stat-item">
<span className="stat-value">{s.value}</span>
<span className="stat-label">{s.label}</span>
</div>
))}
</div>
</div>
);
}