Lumi/src/web/views/leaderboards.ejs
2026-06-17 21:56:20 +02:00

67 lines
2.0 KiB
Plaintext

<%- include("partials/layout-top", { title }) %>
<section class="card">
<%- include("partials/page-header", {
eyebrow: "Community",
pageTitle: "Leaderboards",
description: "Browse activity across core features and installed plugins."
}) %>
</section>
<% if (!sections || !sections.length) { %>
<section class="empty-state">
<p>No activity recorded yet.</p>
</section>
<% } else { %>
<% (sections || []).forEach((section) => { %>
<section class="card">
<h2><%= section.title %></h2>
<% if (!section.boards || !section.boards.length) { %>
<p><%= section.emptyMessage || "No data recorded yet." %></p>
<% } else { %>
<% section.boards.forEach((board) => { %>
<% const rowType = board.rowType || "user"; %>
<h3><%= board.label || board.title || "Leaderboard" %></h3>
<% if (!board.rows || !board.rows.length) { %>
<p><%= board.emptyMessage || "No data recorded yet." %></p>
<% } else { %>
<div class="table-wrap">
<table class="table">
<thead>
<tr>
<th>
<%= rowType === "command" ? "Command" : rowType === "game" ? "Game" : rowType === "text" ? "Item" : "User" %>
</th>
<th><%= board.valueLabel || "Total" %></th>
</tr>
</thead>
<tbody>
<% board.rows.forEach((entry) => { %>
<% const entryLabel = entry.label || entry.username || "Unknown"; %>
<tr>
<td>
<% if (rowType === "user" && entry.username) { %>
<a class="link" href="/stats/<%= encodeURIComponent(entry.username) %>"><%= entry.username %></a>
<% } else if (rowType === "command") { %>
<% if (entry.href) { %>
<a class="link" href="<%= entry.href %>"><code><%= entryLabel %></code></a>
<% } else { %>
<code><%= entryLabel %></code>
<% } %>
<% } else { %>
<%= entryLabel %>
<% } %>
</td>
<td><%= entry.value %></td>
</tr>
<% }) %>
</tbody>
</table>
</div>
<% } %>
<% }) %>
<% } %>
</section>
<% }) %>
<% } %>
<%- include("partials/layout-bottom") %>