forked from Ikalus1988/MisakaNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreputation-leaderboard.html
More file actions
147 lines (137 loc) · 5.78 KB
/
Copy pathreputation-leaderboard.html
File metadata and controls
147 lines (137 loc) · 5.78 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MisakaNet — Contributor Reputation</title>
<meta name="description" content="Public MisakaNet contributor reputation leaderboard. Points are internal recognition only and have no cash value.">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #0d1117; color: #c9d1d9; min-height: 100vh;
display: flex; flex-direction: column; align-items: center; padding: 2rem 1rem;
}
.container { max-width: 820px; width: 100%; }
h1 { font-size: 1.5rem; font-weight: 600; color: #58a6ff; margin-bottom: 0.25rem; }
h2 { font-size: 1.05rem; font-weight: 600; color: #e6edf3; margin: 2rem 0 0.75rem; }
.subtitle { color: #8b949e; font-size: 0.9rem; margin-bottom: 1.5rem; line-height: 1.6; }
.notice {
border: 1px solid #30363d; border-left: 3px solid #d29922; border-radius: 8px;
background: #161b22; padding: 0.9rem 1rem; font-size: 0.85rem; color: #8b949e; line-height: 1.7;
}
.toolbar { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.5rem; }
label { color: #8b949e; font-size: 0.85rem; }
select {
background: #161b22; color: #e6edf3; border: 1px solid #30363d; border-radius: 6px;
padding: 0.45rem 0.6rem; font: inherit;
}
.updated { color: #6e7681; font-size: 0.8rem; margin-left: auto; }
.table-wrap { overflow-x: auto; margin-top: 0.75rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid #21262d; }
th { color: #8b949e; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #161b22; }
.rank { width: 3rem; color: #8b949e; }
.login { color: #e6edf3; font-weight: 600; }
.points { color: #3fb950; font-weight: 600; }
.state { color: #8b949e; font-size: 0.9rem; padding: 1.25rem 0; }
.state.error { color: #f85149; }
a { color: #58a6ff; }
footer { margin-top: 2.5rem; font-size: 0.8rem; color: #6e7681; line-height: 1.8; }
@media (max-width: 520px) {
body { padding: 1.25rem 0.75rem; }
.toolbar { align-items: flex-start; flex-wrap: wrap; }
.updated { width: 100%; margin-left: 0; }
th, td { padding: 0.55rem 0.45rem; }
}
</style>
</head>
<body>
<div class="container">
<h1>🏆 Contributor Reputation</h1>
<p class="subtitle">
The top MisakaNet contributors by the project's internal reputation points.
Choose a time window to see recent activity without losing the all-time ledger.
</p>
<div class="notice">
<strong>Important:</strong> reputation points are non-transferable recognition only.
They have no cash value, are not tokens, and cannot be exchanged.
</div>
<div class="toolbar">
<label for="period">Time window</label>
<select id="period">
<option value="all-time">All-time</option>
<option value="monthly">Last 30 days</option>
<option value="weekly">Last 7 days</option>
</select>
<span class="updated" id="updated">Loading…</span>
</div>
<h2>Top contributors</h2>
<div class="table-wrap">
<table id="leaderboard" hidden>
<thead><tr><th>Rank</th><th>Contributor</th><th class="num">Window points</th><th class="num">All-time</th><th class="num">Activity</th></tr></thead>
<tbody></tbody>
</table>
</div>
<div class="state" id="state">Loading…</div>
<footer>
Source: <code>GET /api/insights/reputation-leaderboard</code> ·
<a href="https://github.com/Ikalus1988/MisakaNet/issues/908">issue #908</a> ·
<a href="../reputation.md">scoring and anti-gaming rules</a>
</footer>
</div>
<script>
const API = window.location.origin + '/api/insights/reputation-leaderboard';
const period = document.getElementById('period');
function escapeHTML(value) {
return String(value).replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
}
function formatPoints(value) {
return Number(value || 0).toLocaleString(undefined, { maximumFractionDigits: 2 });
}
function render(data) {
const table = document.getElementById('leaderboard');
const state = document.getElementById('state');
const rows = data.leaderboard || [];
document.getElementById('updated').textContent = data.updatedAt
? 'Ledger updated ' + new Date(data.updatedAt).toLocaleString()
: 'Ledger update unavailable';
if (!rows.length) {
state.textContent = 'No reputation activity is available for this window.';
table.hidden = true;
return;
}
table.querySelector('tbody').innerHTML = rows.map(row =>
'<tr>' +
'<td class="rank">#' + escapeHTML(row.rank) + '</td>' +
'<td class="login">' + escapeHTML(row.login) + '</td>' +
'<td class="num points">' + formatPoints(row.points) + '</td>' +
'<td class="num">' + formatPoints(row.totalPoints) + '</td>' +
'<td class="num">' + escapeHTML(row.activityCount) + '</td>' +
'</tr>'
).join('');
table.hidden = false;
state.hidden = true;
}
async function load() {
const state = document.getElementById('state');
state.hidden = false;
state.className = 'state';
state.textContent = 'Loading…';
try {
const response = await fetch(API + '?period=' + encodeURIComponent(period.value), { cache: 'no-store' });
const data = await response.json();
if (!response.ok || !data.success) throw new Error(data.error || 'request failed');
render(data);
} catch (error) {
state.textContent = 'Could not load the leaderboard. Try again later.';
state.className = 'state error';
}
}
period.addEventListener('change', load);
load();
</script>
</body>
</html>