source: Klonkt/src/views/pages/admin.ejs@ 9b851e7

main
Last change on this file since 9b851e7 was cb01666, checked in by Robin Genis <roboburr@…>, 3 months ago

feat: lite mode (KLONKT_AUDIO=off) — audio disabled, single codebase

Boot flag that skips the entire audio feature: no audio/playlist/download/
embed routes (no ffmpeg calls), no tracks loaded, own-audio shortcodes
(track/album/playlist) stripped, audio buttons in admin/profile
hidden. Hub and Circles keep working; external embeds (YouTube/SoundCloud/
Spotify) keep working too. Default = on (full version unchanged).
This lets Klonkt run as a lightweight blog/photo/EPK site on an environment
without ffmpeg.

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

  • Property mode set to 100644
File size: 10.0 KB
Line 
1<div class="container admin-page">
2 <h1><%= t('admin.title') %></h1>
3 <% if (tenancy === 'hub') { %>
4 <p class="admin-tagline"><%= t('admin.tagline_hub') %></p>
5 <% } else { %>
6 <p class="admin-tagline"><%= t('admin.tagline_solo') %></p>
7 <% } %>
8
9 <nav class="admin-quick-links" aria-label="Beheer-snelkoppelingen">
10 <% if (tenancy === 'hub') { %>
11 <a href="/admin/sites" class="btn"><%= t('admin.b_sites') %></a>
12 <a href="/admin/users" class="btn"><%= t('admin.b_users') %></a>
13 <% if (typeof audioEnabled === 'undefined' || audioEnabled) { %>
14 <a href="/admin/audio" class="btn"><%= t('admin.b_audio') %></a>
15 <a href="/admin/playlists" class="btn"><%= t('admin.b_playlists') %></a>
16 <% } %>
17 <a href="/admin/comments" class="btn"><%= t('admin.b_comments') %></a>
18 <% if (primarySite) { %><a href="/admin/seo" class="btn"><%= t('admin.b_seo') %></a><% } %>
19 <a href="/admin/settings" class="btn"><%= t('admin.b_settings') %></a>
20 <% } else { %>
21 <a href="/posts/new" class="btn"><%= t('admin.b_newpost') %></a>
22 <% if (typeof audioEnabled === 'undefined' || audioEnabled) { %>
23 <a href="/admin/audio" class="btn"><%= t('admin.b_audio') %></a>
24 <% } %>
25 <a href="/admin/comments" class="btn"><%= t('admin.b_comments') %></a>
26 <% if (primarySite) { %>
27 <a href="/admin/sites/<%= primarySite.slug %>/edit" class="btn"><%= t('admin.b_look') %></a>
28 <% } else { %>
29 <a href="/admin/sites/new" class="btn"><%= t('admin.b_makesite') %></a>
30 <% } %>
31 <% if (tenancy === 'circle') { %>
32 <a href="/admin/circle" class="btn"><%= t('admin.b_circle') %></a>
33 <% } %>
34 <% if (primarySite) { %><a href="/admin/seo" class="btn"><%= t('admin.b_seo') %></a><% } %>
35 <a href="/admin/settings" class="btn"><%= t('admin.b_settings') %></a>
36 <% } %>
37 <% if (typeof premiumUnlocked === 'undefined' || premiumUnlocked) { %>
38 <a href="/admin/stats" class="btn"><%= t('admin.b_stats') %></a>
39 <a href="/admin/newsletter" class="btn"><%= t('admin.b_newsletter') %></a>
40 <% if (tenancy !== 'hub' && primarySite) { %><a href="/pers" class="btn" target="_blank"><%= t('admin.b_perskit') %></a><% } %>
41 <% if (tenancy !== 'hub' && primarySite) { %><a href="/downloads" class="btn" target="_blank"><%= t('admin.b_downloads') %></a><% } %>
42 <% if (tenancy !== 'hub' && primarySite) { %><a href="/links" class="btn" target="_blank"><%= t('admin.b_linkbio') %></a><% } %>
43 <a href="/admin/shows" class="btn"><%= t('admin.b_agenda') %></a>
44 <% } %>
45 <a href="/admin/settings/google" class="btn"><%= t('admin.b_google') %></a>
46 <a href="/admin/updates" class="btn"><%= t('admin.b_updates') %></a>
47 <a href="/admin/handleiding" class="btn"><%= t('admin.b_help') %></a>
48 </nav>
49
50 <div class="admin-stats">
51 <% if (tenancy === 'hub') { %>
52 <div class="stat-card"><div class="stat-num"><%= stats.users %></div><div class="stat-label"><%= t('admin.st_users') %></div></div>
53 <div class="stat-card"><div class="stat-num"><%= stats.sites %></div><div class="stat-label"><%= t('admin.st_sites') %></div></div>
54 <% } %>
55 <div class="stat-card"><div class="stat-num"><%= stats.posts %></div><div class="stat-label"><%= t('admin.st_posts') %></div></div>
56 <div class="stat-card"><div class="stat-num"><%= stats.published %></div><div class="stat-label"><%= t('admin.st_published') %></div></div>
57 </div>
58
59 <% if (typeof posts !== 'undefined' && posts && posts.length) { %>
60 <% var _drafts = posts.filter(function(p){ return p.isDraft; }).length; %>
61 <h2><%= t('admin.sec_posts') %><% if (_drafts) { %> <span class="pl-draftcount"><%= _drafts %> <%= t('admin.draft').toLowerCase() %><%= _drafts === 1 ? '' : 's' %></span><% } %></h2>
62 <ul class="post-admin-list">
63 <% posts.forEach(function(p) { %>
64 <li class="pal-row<%= p.isDraft ? ' is-draft' : '' %>">
65 <a class="pal-title" href="<%= p.editUrl %>">
66 <% if (p.isDraft) { %><span class="pal-badge"><%= t('admin.draft') %></span><% } %>
67 <span class="pal-name"><%= p.title || '(zonder titel)' %></span>
68 </a>
69 <span class="pal-actions">
70 <a class="pal-link" href="<%= p.editUrl %>"><%= t('admin.edit') %></a>
71 <% if (!p.isDraft) { %><a class="pal-link" href="<%= p.viewUrl %>"><%= t('admin.view') %></a><% } %>
72 </span>
73 </li>
74 <% }); %>
75 </ul>
76 <% } %>
77
78 <% if (sites && sites.length) { %>
79 <h2><%= t('admin.sec_sites') %></h2>
80 <table class="admin-table">
81 <thead>
82 <tr><th><%= t('admin.th_slug') %></th><th><%= t('admin.th_title') %></th><th><%= t('admin.th_owner') %></th><th><%= t('admin.th_created') %></th></tr>
83 </thead>
84 <tbody>
85 <% sites.forEach(function(s) { %>
86 <tr>
87 <td><code><%= s.slug %></code></td>
88 <td><%= s.title %></td>
89 <td><%= s.owner_username || '—' %></td>
90 <td><%= formatDate(s.created_at) %></td>
91 </tr>
92 <% }); %>
93 </tbody>
94 </table>
95 <% } %>
96
97 <% if (users && users.length) { %>
98 <h2><%= t('admin.sec_users') %></h2>
99 <table class="admin-table">
100 <thead>
101 <tr><th><%= t('admin.th_username') %></th><th><%= t('admin.th_email') %></th><th><%= t('admin.th_role') %></th><th><%= t('admin.th_joined') %></th></tr>
102 </thead>
103 <tbody>
104 <% users.forEach(function(u) { %>
105 <tr>
106 <td><%= u.username %></td>
107 <td><%= u.email %></td>
108 <td><span class="role-pill role-<%= u.role %>"><%= u.role %></span></td>
109 <td><%= formatDate(u.created_at) %></td>
110 </tr>
111 <% }); %>
112 </tbody>
113 </table>
114 <% } %>
115
116</div>
117
118<style>
119.admin-page { max-width: 1000px; margin: 3rem auto; padding: 0 1rem; }
120.admin-page h1 { font-family: var(--font-display, serif); font-size: 2rem; margin: 0 0 0.25rem; }
121.admin-page h2 { font-family: var(--font-display, serif); font-size: 1.4rem; margin: 2rem 0 0.75rem; }
122.admin-tagline { color: var(--ink-muted); margin: 0 0 2rem; }
123.admin-tagline em { font-style: normal; opacity: 0.7; }
124
125/* Posts/concepten-lijst */
126.pl-draftcount { font-family: var(--font-ui, system-ui); font-size: 0.8rem; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 0.1rem 0.55rem; border-radius: 99px; vertical-align: middle; }
127.post-admin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
128.pal-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 0.9rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper-2); transition: border-color 120ms; }
129.pal-row:hover { border-color: var(--accent); }
130.pal-row.is-draft { border-left: 3px solid var(--accent); }
131.pal-title { display: inline-flex; align-items: center; gap: 0.6rem; min-width: 0; color: var(--ink); text-decoration: none; font-weight: 600; }
132.pal-title:hover { color: var(--accent); }
133.pal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
134.pal-badge { flex-shrink: 0; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 0.1rem 0.5rem; border-radius: 99px; }
135.pal-actions { display: flex; gap: 0.75rem; flex-shrink: 0; }
136.pal-link { color: var(--ink-muted); font-size: 0.85rem; text-decoration: none; white-space: nowrap; }
137.pal-link:hover { color: var(--accent); text-decoration: underline; }
138
139/* Quick-links grid — mobile-first.
140 auto-fit + minmax means: as many equal columns as fit, each at least 140px.
141 Mobile (~360-440px): 2 per row.
142 Tablet (~480-700px): 3 per row.
143 Desktop (≥ ~720px): all 5 in a single row. */
144.admin-quick-links {
145 display: grid;
146 grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
147 gap: 0.5rem;
148 margin: 0 0 1.5rem;
149 padding: 0;
150}
151.admin-quick-links .btn {
152 justify-content: center;
153 padding: 0.7rem 0.9rem;
154 font-weight: 600;
155 text-align: center;
156}
157.admin-quick-links .btn:hover {
158 background: color-mix(in srgb, var(--accent) 8%, var(--paper-2));
159 border-color: var(--accent);
160}
161
162.admin-stats {
163 display: grid;
164 grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
165 gap: 0.75rem;
166 margin-bottom: 1rem;
167}
168.stat-card {
169 background: var(--paper-2);
170 border: 1px solid var(--rule);
171 border-radius: 8px;
172 padding: 1rem 1.25rem;
173 text-align: center;
174}
175.stat-num {
176 font-size: 2rem;
177 font-weight: 700;
178 color: var(--accent);
179 line-height: 1;
180 font-family: var(--font-display, serif);
181}
182.stat-label {
183 color: var(--ink-muted);
184 font-size: 0.85rem;
185 text-transform: uppercase;
186 letter-spacing: 0.05em;
187 margin-top: 0.25rem;
188}
189
190.admin-table {
191 width: 100%;
192 border-collapse: collapse;
193 background: var(--paper-2);
194 border: 1px solid var(--rule);
195 border-radius: 8px;
196 overflow: hidden;
197}
198.admin-table th, .admin-table td {
199 padding: 0.6rem 0.9rem;
200 text-align: left;
201 border-bottom: 1px solid var(--rule);
202}
203.admin-table th {
204 background: var(--paper);
205 font-weight: 600;
206 font-size: 0.85rem;
207 text-transform: uppercase;
208 letter-spacing: 0.05em;
209 color: var(--ink-muted);
210}
211.admin-table tr:last-child td { border-bottom: 0; }
212.admin-table code { background: var(--paper); padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.85rem; }
213
214.role-pill {
215 display: inline-block;
216 padding: 0.1rem 0.5rem;
217 border-radius: 10px;
218 font-size: 0.75rem;
219 text-transform: uppercase;
220 letter-spacing: 0.05em;
221 background: var(--paper);
222 color: var(--ink-muted);
223}
224.role-pill.role-god { background: var(--accent); color: white; }
225.role-pill.role-admin { background: var(--paper); color: var(--accent); border: 1px solid var(--accent); }
226
227.admin-todo {
228 margin: 2rem 0 0;
229 padding: 0.75rem 1rem;
230 background: var(--paper-2);
231 border-left: 3px solid var(--accent);
232 border-radius: 4px;
233 font-size: 0.9rem;
234 color: var(--ink-muted);
235}
236
237@media (max-width: 600px) {
238 .admin-table { font-size: 0.85rem; }
239 .admin-table th, .admin-table td { padding: 0.45rem 0.6rem; }
240}
241</style>
Note: See TracBrowser for help on using the repository browser.