Spaces:
Running
Running
Create roster.html
Browse files- roster.html +137 -0
roster.html
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>FriendlyBot — Roster List</title>
|
| 7 |
+
<link rel="icon" href="/logo.png" />
|
| 8 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet" />
|
| 9 |
+
<style>
|
| 10 |
+
:root {
|
| 11 |
+
--bg: #0a0a1a;
|
| 12 |
+
--surface: #12122a;
|
| 13 |
+
--border: rgba(255, 255, 255, 0.06);
|
| 14 |
+
--text: #fff;
|
| 15 |
+
--text-dim: rgba(255, 255, 255, 0.6);
|
| 16 |
+
--accent: #5865F2;
|
| 17 |
+
--radius: 16px;
|
| 18 |
+
}
|
| 19 |
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
| 20 |
+
body {
|
| 21 |
+
font-family: "Inter", sans-serif;
|
| 22 |
+
background: var(--bg);
|
| 23 |
+
color: var(--text);
|
| 24 |
+
min-height: 100vh;
|
| 25 |
+
padding: 40px 20px;
|
| 26 |
+
}
|
| 27 |
+
header {
|
| 28 |
+
max-width: 1000px;
|
| 29 |
+
margin: 0 auto 40px;
|
| 30 |
+
display: flex;
|
| 31 |
+
justify-content: space-between;
|
| 32 |
+
align-items: center;
|
| 33 |
+
}
|
| 34 |
+
h1 { font-size: 28px; font-weight: 700; }
|
| 35 |
+
.btn {
|
| 36 |
+
display: inline-block;
|
| 37 |
+
padding: 10px 20px;
|
| 38 |
+
background: var(--accent);
|
| 39 |
+
color: #fff;
|
| 40 |
+
text-decoration: none;
|
| 41 |
+
border-radius: 8px;
|
| 42 |
+
font-weight: 600;
|
| 43 |
+
font-size: 14px;
|
| 44 |
+
}
|
| 45 |
+
.container { max-width: 1000px; margin: 0 auto; }
|
| 46 |
+
.team-section {
|
| 47 |
+
background: var(--surface);
|
| 48 |
+
border: 1px solid var(--border);
|
| 49 |
+
border-radius: var(--radius);
|
| 50 |
+
padding: 24px;
|
| 51 |
+
margin-bottom: 24px;
|
| 52 |
+
}
|
| 53 |
+
.team-title {
|
| 54 |
+
font-size: 20px;
|
| 55 |
+
font-weight: 700;
|
| 56 |
+
margin-bottom: 16px;
|
| 57 |
+
color: var(--accent);
|
| 58 |
+
}
|
| 59 |
+
table { width: 100%; border-collapse: collapse; }
|
| 60 |
+
th, td {
|
| 61 |
+
text-align: left;
|
| 62 |
+
padding: 12px;
|
| 63 |
+
border-bottom: 1px solid var(--border);
|
| 64 |
+
}
|
| 65 |
+
th {
|
| 66 |
+
color: var(--text-dim);
|
| 67 |
+
font-size: 12px;
|
| 68 |
+
text-transform: uppercase;
|
| 69 |
+
letter-spacing: 1px;
|
| 70 |
+
}
|
| 71 |
+
tr:last-child td { border-bottom: none; }
|
| 72 |
+
.empty {
|
| 73 |
+
text-align: center;
|
| 74 |
+
color: var(--text-dim);
|
| 75 |
+
padding: 40px;
|
| 76 |
+
}
|
| 77 |
+
</style>
|
| 78 |
+
</head>
|
| 79 |
+
<body>
|
| 80 |
+
<header>
|
| 81 |
+
<h1>📋 Roster List</h1>
|
| 82 |
+
<a href="/" class="btn">Back to Dashboard</a>
|
| 83 |
+
</header>
|
| 84 |
+
|
| 85 |
+
<div class="container" id="app">
|
| 86 |
+
<div class="empty">Loading rosters...</div>
|
| 87 |
+
</div>
|
| 88 |
+
|
| 89 |
+
<script>
|
| 90 |
+
async function loadRosters() {
|
| 91 |
+
try {
|
| 92 |
+
const res = await fetch("/api/roster");
|
| 93 |
+
const data = await res.json();
|
| 94 |
+
const app = document.getElementById("app");
|
| 95 |
+
|
| 96 |
+
if (!data || Object.keys(data).length === 0) {
|
| 97 |
+
app.innerHTML = '<div class="empty">No rosters found. Use !roster-add @user Role in Discord to add one.</div>';
|
| 98 |
+
return;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
let html = "";
|
| 102 |
+
Object.entries(data).forEach(([team, members]) => {
|
| 103 |
+
html += `<div class="team-section">
|
| 104 |
+
<div class="team-title">${team}</div>
|
| 105 |
+
<table>
|
| 106 |
+
<thead>
|
| 107 |
+
<tr><th>User</th><th>Role</th><th>Added</th></tr>
|
| 108 |
+
</thead>
|
| 109 |
+
<tbody>
|
| 110 |
+
${members.map(m => `
|
| 111 |
+
<tr>
|
| 112 |
+
<td>${escapeHtml(m.user)}</td>
|
| 113 |
+
<td>${escapeHtml(m.role)}</td>
|
| 114 |
+
<td>${escapeHtml(m.addedAt)}</td>
|
| 115 |
+
</tr>
|
| 116 |
+
`).join("")}
|
| 117 |
+
</tbody>
|
| 118 |
+
</table>
|
| 119 |
+
</div>`;
|
| 120 |
+
});
|
| 121 |
+
app.innerHTML = html;
|
| 122 |
+
} catch (err) {
|
| 123 |
+
document.getElementById("app").innerHTML = '<div class="empty">Failed to load rosters.</div>';
|
| 124 |
+
}
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
function escapeHtml(str) {
|
| 128 |
+
if (!str) return "";
|
| 129 |
+
const d = document.createElement("div");
|
| 130 |
+
d.textContent = str;
|
| 131 |
+
return d.innerHTML;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
loadRosters();
|
| 135 |
+
</script>
|
| 136 |
+
</body>
|
| 137 |
+
</html>
|