-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.jsx
More file actions
107 lines (100 loc) · 3.2 KB
/
index.jsx
File metadata and controls
107 lines (100 loc) · 3.2 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import Link from "@docusaurus/Link";
import styles from "./styles.module.css";
import statsJson from "@site/static/data/activity_stats.json";
function HorizontalBar({ label, value, max_value }) {
return (
<div className={styles.bar_row}>
<span>{label}</span>
<div className={styles.bar_track}>
<div className={styles.bar_fill} style={{ width: `${(value / max_value) * 100}%` }} />
</div>
<span>{value}</span>
</div>
);
}
export default function Activity() {
const maxCommitValue = Math.max(...Object.values(statsJson.commits_by_time));
const stats_commits = Object.entries(statsJson.commits_by_time).map(
([period, value]) => ({
label: period.replace("last_", "").replace("_", " "),
value: value,
max_value: maxCommitValue,
})
);
const maxMemberValue = Math.max(...Object.values(statsJson.commits_by_member));
const stats_members = Object.entries(statsJson.commits_by_member).map(
([member, value]) => ({
label: member,
value: value,
max_value: maxMemberValue,
})
);
const maxRepoValue = Math.max(...Object.values(statsJson.commits_by_repo));
const stats_repos = Object.entries(statsJson.commits_by_repo).map(
([repo, value]) => ({
label: repo,
value: value,
max_value: maxRepoValue,
})
);
return (
<section className={styles.activity}>
<div className={styles.about_description}>
<h1>Recent activity</h1>
<p>
We strive to build and improve our own workflows, but also to make
contributions to community projects such as{" "}
<Link to="https://snakemake.github.io">Snakemake</Link>.
</p>
</div>
<div className={styles.activity_panel}>
<div className={styles.panelHeader}>
<h3>Commits overview</h3>
<h4>(all repos)</h4>
</div>
{stats_commits.map((entry) => (
<HorizontalBar
key={entry.label}
label={entry.label}
value={entry.value}
max_value={entry.max_value}
/>
))}
</div>
<div className={styles.activity_panel}>
<div className={styles.panelHeader}>
<h3>Top repos by commits</h3>
<h4>(last 30 days)</h4>
</div>
{stats_repos.map((entry) => (
<HorizontalBar
key={entry.label}
label={entry.label}
value={entry.value}
max_value={entry.max_value}
/>
))}
</div>
<div className={styles.activity_panel}>
<div className={styles.panelHeader}>
<h3>Commits by Member</h3>
<h4>(last 30 days)</h4>
</div>
{stats_members.map((entry) => (
<HorizontalBar
key={entry.label}
label={entry.label}
value={entry.value}
max_value={entry.max_value}
/>
))}
</div>
<footer className={styles.activity_footer}>
<p>
Statistics are automatically retrieved from GitHub.
Last update on {new Date().toLocaleDateString()} (<Link to="https://github.com/MPUSP/mpusp.github.io/actions">Deployment history</Link>).
</p>
</footer>
</section>
);
}