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

main
Last change on this file since ae924a2 was 7bc636b, checked in by Robin <robin@…>, 4 months ago

Initial commit — PrutFolio v1 source (pulled from Hetzner /srv/prutfolio)

  • Property mode set to 100644
File size: 9.3 KB
Line 
1<div class="container ax-page">
2
3 <header class="ax-header">
4 <a href="/admin" class="ax-back" aria-label="Terug naar admin">←</a>
5 <div>
6 <h1>Users</h1>
7 <p class="ax-tagline">Beheer gebruikers, rollen, en verwijderingen.</p>
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>
60 <select name="role" onchange="this.form.submit()" <% if (u.id === user.id) { %>disabled<% } %>>
61 <option value="member" <%= u.role === 'member' ? 'selected' : '' %>>member</option>
62 <option value="admin" <%= u.role === 'admin' ? 'selected' : '' %>>admin</option>
63 <option value="god" <%= u.role === 'god' ? 'selected' : '' %>>god</option>
64 </select>
65 </label>
66 </form>
67
68 <% if (u.id !== user.id && (u.post_count + u.site_count === 0)) { %>
69 <form method="post" action="/admin/users/<%= u.id %>/delete" class="ax-delete-form"
70 onsubmit="return confirm('Verwijder gebruiker <%= u.username %>?')">
71 <button type="submit" class="ax-icon-btn ax-icon-btn-danger" aria-label="Verwijderen" title="Verwijderen">🗑</button>
72 </form>
73 <% } %>
74 </div>
75
76 </li>
77 <% }); %>
78 </ul>
79 <% } %>
80
81</div>
82
83<style>
84.ax-page { max-width: 880px; margin: 1.5rem auto 4rem; padding: 0 1rem; }
85.ax-header { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 1.5rem; }
86.ax-header h1 { font-family: var(--font-display, serif); font-size: 1.75rem; margin: 0 0 0.25rem; }
87.ax-tagline { color: var(--ink-muted, var(--ink-soft)); margin: 0; font-size: 0.9rem; }
88.ax-back {
89 display: inline-flex; align-items: center; justify-content: center;
90 width: 40px; height: 40px;
91 border: 1px solid var(--rule); border-radius: 8px;
92 background: var(--paper); color: var(--ink); text-decoration: none;
93 font-size: 1.1rem; flex-shrink: 0; transition: border-color 120ms;
94}
95.ax-back:hover { border-color: var(--accent); }
96
97.ax-flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
98.ax-flash-ok { background: rgba(40,160,90,.15); color: #2a9d5e; border: 1px solid rgba(40,160,90,.3); }
99.ax-flash-err { background: rgba(200,60,60,.15); color: #c33; border: 1px solid rgba(200,60,60,.3); }
100
101.ax-card {
102 background: var(--paper); border: 1px solid var(--rule);
103 border-radius: 12px; padding: 1.25rem;
104}
105.ax-empty { text-align: center; padding: 2rem 1rem; color: var(--ink-muted); }
106.ax-empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; opacity: 0.5; }
107.ax-empty p { margin: 0; }
108
109/* ─── User cards ───────────────────────────────────────────────── */
110.ax-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
111.ax-user {
112 display: grid;
113 grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto;
114 gap: 1rem;
115 align-items: center;
116 padding: 0.85rem 1rem;
117 background: var(--paper);
118 border: 1px solid var(--rule);
119 border-radius: 12px;
120 transition: border-color 120ms;
121}
122.ax-user:hover { border-color: var(--accent); }
123.ax-user.is-self {
124 background: color-mix(in srgb, var(--accent) 7%, var(--paper));
125 border-color: color-mix(in srgb, var(--accent) 25%, var(--rule));
126}
127
128.ax-user-id { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
129.ax-avatar {
130 width: 44px; height: 44px;
131 border-radius: 50%;
132 object-fit: cover;
133 background: var(--paper-2);
134 color: var(--accent);
135 display: inline-flex; align-items: center; justify-content: center;
136 font-family: var(--font-display, serif);
137 font-weight: 700; font-size: 1.1rem;
138 flex-shrink: 0;
139}
140.ax-avatar-empty { /* span variant uses same styling */ }
141.ax-user-meta { min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
142.ax-user-name {
143 font-weight: 600; font-size: 0.95rem;
144 display: flex; align-items: baseline; gap: 0.4rem; flex-wrap: wrap;
145}
146.ax-user-name a { color: var(--ink); text-decoration: none; }
147.ax-user-name a:hover { color: var(--accent); }
148.ax-user-email {
149 font-size: 0.82rem;
150 color: var(--ink-muted, var(--ink-soft));
151 overflow: hidden;
152 text-overflow: ellipsis;
153 white-space: nowrap;
154}
155.ax-pill {
156 font-size: 0.7rem; font-weight: 500;
157 color: var(--ink-soft);
158 background: var(--paper-2);
159 padding: 0.15em 0.55em; border-radius: 999px;
160}
161
162/* ─── Stats (3 mini-columns) ──────────────────────────────────── */
163.ax-user-stats {
164 display: flex; gap: 1.25rem;
165 align-items: center;
166}
167.ax-stat {
168 display: flex; flex-direction: column;
169 font-size: 0.8rem;
170 text-align: center;
171 min-width: 0;
172}
173.ax-stat-num {
174 font-family: var(--font-display, serif);
175 font-weight: 600; font-size: 1.05rem;
176 color: var(--ink);
177 font-variant-numeric: tabular-nums;
178}
179.ax-stat-date {
180 font-family: var(--font-ui, system-ui);
181 font-size: 0.75rem;
182 font-weight: 500;
183 white-space: nowrap;
184}
185.ax-stat-label {
186 color: var(--ink-muted, var(--ink-soft));
187 text-transform: uppercase;
188 letter-spacing: 0.04em;
189 font-size: 0.7rem;
190}
191
192/* ─── Role select + delete ────────────────────────────────────── */
193.ax-user-controls {
194 display: flex; gap: 0.5rem; align-items: center;
195 flex-shrink: 0;
196}
197.ax-role-form { margin: 0; }
198.ax-role {
199 display: flex; flex-direction: column; gap: 0.2rem;
200 font-size: 0.7rem;
201}
202.ax-role > span {
203 color: var(--ink-muted);
204 text-transform: uppercase;
205 letter-spacing: 0.04em;
206 font-weight: 600;
207 font-size: 0.7rem;
208}
209.ax-role select {
210 padding: 0.4rem 1.75rem 0.4rem 0.6rem;
211 border: 1px solid var(--rule);
212 border-radius: 6px;
213 background: var(--paper-2);
214 color: var(--ink);
215 font-family: var(--font-ui, system-ui), sans-serif;
216 font-size: 0.85rem;
217 -webkit-appearance: none; appearance: none;
218 cursor: pointer;
219 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>");
220 background-repeat: no-repeat;
221 background-position: right 0.5rem center;
222}
223.ax-role select:disabled { cursor: not-allowed; opacity: 0.5; }
224.ax-delete-form { margin: 0; }
225.ax-icon-btn {
226 display: inline-flex; align-items: center; justify-content: center;
227 width: 40px; height: 40px;
228 border: 1px solid var(--rule); border-radius: 8px;
229 background: var(--paper-2); color: var(--ink);
230 cursor: pointer; font-size: 1rem;
231 transition: background 120ms, border-color 120ms, color 120ms;
232}
233.ax-icon-btn:hover { border-color: var(--accent); }
234.ax-icon-btn-danger:hover { color: #dc2626; border-color: #dc2626; }
235
236/* ─── Mobile: stack everything vertically ─────────────────────── */
237@media (max-width: 720px) {
238 .ax-user {
239 grid-template-columns: 1fr;
240 grid-template-areas: "id" "stats" "controls";
241 gap: 0.75rem;
242 }
243 .ax-user-id { grid-area: id; }
244 .ax-user-stats { grid-area: stats; justify-content: flex-start; gap: 1.5rem; padding-top: 0.5rem; border-top: 1px solid var(--rule); }
245 .ax-user-controls { grid-area: controls; justify-content: space-between; align-items: flex-end; }
246 .ax-role { flex: 1; max-width: 200px; }
247}
248</style>
Note: See TracBrowser for help on using the repository browser.