source: Klonkt/src/views/pages/admin-users.ejs@ dd80030

main
Last change on this file since dd80030 was 5e95aac, checked in by roboburr <roboburr@…>, 3 months ago

fix: users list alignment + site icon SF -> K (Klonkt)

  • admin-users: role dropdown fixed width (112px) + height (40px) matching the delete button, controls bottom-aligned -> dropdowns and trash buttons are evenly aligned across all rows (were skewed due to auto-width selects + center-alignment on the taller label+select block).
  • favicon (_renderFavicon): 'SF' -> 'K' for Klonkt.

Co-Authored-By: Claude <noreply@…>

  • Property mode set to 100644
File size: 10.2 KB
RevLine 
[7bc636b]1<div class="container ax-page">
2
[8b014ef]3 <p><a href="/admin" class="btn">&larr; Beheer</a></p>
[7bc636b]4 <header class="ax-header">
5 <div>
6 <h1>Users</h1>
[8afbdd6]7 <p class="ax-tagline">Beheer gebruikers, rollen, en verwijderingen. Rol <strong>kijker</strong> = alles bekijken (incl. Beheer), niets wijzigen — handig voor demo's.</p>
[7bc636b]8 </div>
9 </header>
10
11 <% if (success) { %><div class="ax-flash ax-flash-ok"><%= success %></div><% } %>
12 <% if (error) { %><div class="ax-flash ax-flash-err"><%= error %></div><% } %>
13
14 <% if (!users.length) { %>
15 <div class="ax-card">
16 <div class="ax-empty">
17 <div class="ax-empty-icon">👤</div>
18 <p>Geen gebruikers.</p>
19 </div>
20 </div>
21 <% } else { %>
22 <ul class="ax-list">
23 <% users.forEach(function(u) { %>
24 <li class="ax-user<%= u.id === user.id ? ' is-self' : '' %>">
25
26 <div class="ax-user-id">
27 <% if (u.avatar_url) { %>
28 <img class="ax-avatar" src="<%= u.avatar_url %>" alt="">
29 <% } else { %>
30 <span class="ax-avatar ax-avatar-empty"><%= u.username.charAt(0).toUpperCase() %></span>
31 <% } %>
32 <div class="ax-user-meta">
33 <div class="ax-user-name">
34 <a href="/users/<%= encodeURIComponent(u.username) %>"><%= u.username %></a>
35 <% if (u.id === user.id) { %><span class="ax-pill">jij</span><% } %>
36 </div>
37 <div class="ax-user-email"><%= u.email %></div>
38 </div>
39 </div>
40
41 <div class="ax-user-stats">
42 <span class="ax-stat" title="Sites">
43 <span class="ax-stat-num"><%= u.site_count %></span>
44 <span class="ax-stat-label">sites</span>
45 </span>
46 <span class="ax-stat" title="Posts">
47 <span class="ax-stat-num"><%= u.post_count %></span>
48 <span class="ax-stat-label">posts</span>
49 </span>
50 <span class="ax-stat" title="Geregistreerd op">
51 <span class="ax-stat-num ax-stat-date"><%= formatDate(u.created_at) %></span>
52 <span class="ax-stat-label">joined</span>
53 </span>
54 </div>
55
56 <div class="ax-user-controls">
57 <form method="post" action="/admin/users/<%= u.id %>/role" class="ax-role-form">
58 <label class="ax-role">
59 <span>Rol</span>
[8afbdd6]60 <select name="role" onchange="this.form.submit()" <% if (u.id === user.id || !canMutate) { %>disabled<% } %>>
61 <option value="kijker" <%= u.role === 'kijker' ? 'selected' : '' %>>kijker</option>
[7bc636b]62 <option value="member" <%= u.role === 'member' ? 'selected' : '' %>>member</option>
63 <option value="admin" <%= u.role === 'admin' ? 'selected' : '' %>>admin</option>
64 <option value="god" <%= u.role === 'god' ? 'selected' : '' %>>god</option>
65 </select>
66 </label>
67 </form>
68
[8afbdd6]69 <% if (u.id !== user.id && canMutate) { %>
[0c2228a]70 <% var _warn = (u.post_count + u.site_count > 0)
71 ? ('Dit verwijdert ook hun site + ' + u.post_count + ' post(s). ')
72 : ''; %>
[7bc636b]73 <form method="post" action="/admin/users/<%= u.id %>/delete" class="ax-delete-form"
[0c2228a]74 onsubmit="return confirm('Gebruiker <%= u.username %> verwijderen? <%= _warn %>Dit kan niet ongedaan worden.')">
[7bc636b]75 <button type="submit" class="ax-icon-btn ax-icon-btn-danger" aria-label="Verwijderen" title="Verwijderen">🗑</button>
76 </form>
[05a6ca0]77 <% } else { %>
[8afbdd6]78 <%# Lege plek zodat de rol-kolom op elke rij uitlijnt. %>
[05a6ca0]79 <span class="ax-icon-btn-spacer" aria-hidden="true"></span>
[7bc636b]80 <% } %>
81 </div>
82
83 </li>
84 <% }); %>
85 </ul>
86 <% } %>
87
88</div>
89
90<style>
91.ax-page { max-width: 880px; margin: 1.5rem auto 4rem; padding: 0 1rem; }
92.ax-header { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1.5rem; }
93.ax-header h1 { font-family: var(--font-display, serif); font-size: 1.75rem; margin: 0 0 0.25rem; }
94.ax-tagline { color: var(--ink-muted, var(--ink-soft)); margin: 0; font-size: 0.9rem; }
95.ax-back {
96 display: inline-flex; align-items: center; justify-content: center;
97 width: 40px; height: 40px;
98 border: 1px solid var(--rule); border-radius: 8px;
99 background: var(--paper); color: var(--ink); text-decoration: none;
100 font-size: 1.1rem; flex-shrink: 0; transition: border-color 120ms;
101}
102.ax-back:hover { border-color: var(--accent); }
103
104.ax-flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
105.ax-flash-ok { background: rgba(40,160,90,.15); color: #2a9d5e; border: 1px solid rgba(40,160,90,.3); }
106.ax-flash-err { background: rgba(200,60,60,.15); color: #c33; border: 1px solid rgba(200,60,60,.3); }
107
108.ax-card {
109 background: var(--paper); border: 1px solid var(--rule);
110 border-radius: 12px; padding: 1.25rem;
111}
112.ax-empty { text-align: center; padding: 2rem 1rem; color: var(--ink-muted); }
113.ax-empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.5; }
114.ax-empty p { margin: 0; }
115
116/* ─── User cards ───────────────────────────────────────────────── */
117.ax-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
118.ax-user {
119 display: grid;
120 grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto;
121 gap: 1rem;
122 align-items: center;
123 padding: 0.85rem 1rem;
124 background: var(--paper);
125 border: 1px solid var(--rule);
126 border-radius: 12px;
127 transition: border-color 120ms;
128}
129.ax-user:hover { border-color: var(--accent); }
130.ax-user.is-self {
131 background: color-mix(in srgb, var(--accent) 7%, var(--paper));
132 border-color: color-mix(in srgb, var(--accent) 25%, var(--rule));
133}
134
135.ax-user-id { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
136.ax-avatar {
137 width: 44px; height: 44px;
138 border-radius: 50%;
139 object-fit: cover;
140 background: var(--paper-2);
141 color: var(--accent);
142 display: inline-flex; align-items: center; justify-content: center;
143 font-family: var(--font-display, serif);
144 font-weight: 700; font-size: 1.1rem;
145 flex-shrink: 0;
146}
147.ax-avatar-empty { /* span variant uses same styling */ }
148.ax-user-meta { min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
149.ax-user-name {
150 font-weight: 600; font-size: 0.95rem;
151 display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap;
152}
153.ax-user-name a { color: var(--ink); text-decoration: none; }
154.ax-user-name a:hover { color: var(--accent); }
155.ax-user-email {
156 font-size: 0.82rem;
157 color: var(--ink-muted, var(--ink-soft));
158 overflow: hidden;
159 text-overflow: ellipsis;
160 white-space: nowrap;
161}
162.ax-pill {
163 font-size: 0.7rem; font-weight: 500;
164 color: var(--ink-soft);
165 background: var(--paper-2);
166 padding: 0.15em 0.55em; border-radius: 999px;
167}
168
169/* ─── Stats (3 mini-columns) ──────────────────────────────────── */
170.ax-user-stats {
171 display: flex; gap: 1.25rem;
172 align-items: center;
173}
174.ax-stat {
175 display: flex; flex-direction: column;
176 font-size: 0.8rem;
177 text-align: center;
178 min-width: 0;
179}
180.ax-stat-num {
181 font-family: var(--font-display, serif);
182 font-weight: 600; font-size: 1.05rem;
183 color: var(--ink);
184 font-variant-numeric: tabular-nums;
185}
186.ax-stat-date {
187 font-family: var(--font-ui, system-ui);
188 font-size: 0.75rem;
189 font-weight: 500;
190 white-space: nowrap;
191}
192.ax-stat-label {
193 color: var(--ink-muted, var(--ink-soft));
194 text-transform: uppercase;
195 letter-spacing: 0.04em;
196 font-size: 0.7rem;
197}
198
199/* ─── Role select + delete ────────────────────────────────────── */
200.ax-user-controls {
[5e95aac]201 display: flex; gap: 0.5rem; align-items: flex-end;
[7bc636b]202 flex-shrink: 0;
203}
204.ax-role-form { margin: 0; }
205.ax-role {
206 display: flex; flex-direction: column; gap: 0.2rem;
207 font-size: 0.7rem;
208}
209.ax-role > span {
210 color: var(--ink-muted);
211 text-transform: uppercase;
212 letter-spacing: 0.04em;
213 font-weight: 600;
214 font-size: 0.7rem;
215}
216.ax-role select {
[5e95aac]217 width: 112px;
218 height: 40px;
219 box-sizing: border-box;
[7bc636b]220 padding: 0.4rem 1.75rem 0.4rem 0.6rem;
221 border: 1px solid var(--rule);
222 border-radius: 6px;
223 background: var(--paper-2);
224 color: var(--ink);
225 font-family: var(--font-ui, system-ui), sans-serif;
226 font-size: 0.85rem;
227 -webkit-appearance: none; appearance: none;
228 cursor: pointer;
229 background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
230 background-repeat: no-repeat;
231 background-position: right 0.5rem center;
232}
233.ax-role select:disabled { cursor: not-allowed; opacity: 0.5; }
[a64f642]234.ax-ro { align-items: center; }
235.ax-ro input { width: 18px; height: 18px; cursor: pointer; margin-top: 0.15rem; accent-color: var(--accent); }
236.ax-ro input:disabled { cursor: not-allowed; opacity: 0.5; }
[7bc636b]237.ax-delete-form { margin: 0; }
238.ax-icon-btn {
239 display: inline-flex; align-items: center; justify-content: center;
240 width: 40px; height: 40px;
241 border: 1px solid var(--rule); border-radius: 8px;
242 background: var(--paper-2); color: var(--ink);
243 cursor: pointer; font-size: 1rem;
244 transition: background 120ms, border-color 120ms, color 120ms;
245}
246.ax-icon-btn:hover { border-color: var(--accent); }
247.ax-icon-btn-danger:hover { color: #dc2626; border-color: #dc2626; }
[05a6ca0]248.ax-icon-btn-spacer { display: inline-block; width: 40px; height: 40px; flex-shrink: 0; }
[7bc636b]249
250/* ─── Mobile: stack everything vertically ─────────────────────── */
251@media (max-width: 720px) {
252 .ax-user {
253 grid-template-columns: 1fr;
254 grid-template-areas: "id" "stats" "controls";
255 gap: 0.75rem;
256 }
257 .ax-user-id { grid-area: id; }
258 .ax-user-stats { grid-area: stats; justify-content: flex-start; gap: 1.5rem; padding-top: 0.5rem; border-top: 1px solid var(--rule); }
259 .ax-user-controls { grid-area: controls; justify-content: space-between; align-items: flex-end; }
260 .ax-role { flex: 1; max-width: 200px; }
261}
262</style>
Note: See TracBrowser for help on using the repository browser.