source: Klonkt/src/views/pages/admin.ejs@ 535f955

main
Last change on this file since 535f955 was 8d32dcf, checked in by roboburr <roboburr@…>, 3 months ago

Show agenda + notify-me (premium feature #8) — last of the 8

  • DB: shows (site_id, date, time, city, venue, country, ticket_url, notes).
  • routes/shows.js (public, premium-gated): GET /shows (upcoming shows + notify form), POST /shows/notify (subscribers source 'notify', double opt-in if SMTP; confirm/unsub via the generic /nieuwsbrief links).
  • routes/admin-shows.js (site admin + premium): GET /admin/shows (list + add form + subscriber count), POST / (add; optional notify email to 'notify' subscribers if SMTP is available), POST /:id/delete.
  • SubscriberService.confirmedFor(siteId, source?) — optional source filter ('notify').
  • views: pages/shows.ejs + pages/admin-shows.ejs. Dashboard 📅 Agenda link.

Notify email requires SMTP (like #1/#2 sending); without SMTP the show is saved
and sign-ups still work. node --check passed.

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

  • Property mode set to 100644
File size: 9.1 KB
Line 
1<div class="container admin-page">
2 <h1>Beheer</h1>
3 <% if (tenancy === 'hub') { %>
4 <p class="admin-tagline">Hub-modus — bedrijfssite met gebruikers, elk hun eigen Klonkt Hub.</p>
5 <% } else { %>
6 <p class="admin-tagline">Solo-modus — jouw site.</p>
7 <% } %>
8
9 <nav class="admin-quick-links" aria-label="Beheer-snelkoppelingen">
10 <% if (tenancy === 'hub') { %>
11 <a href="/admin/sites" class="btn">🌐 Sites</a>
12 <a href="/admin/users" class="btn">👥 Gebruikers</a>
13 <a href="/admin/audio" class="btn">🎵 Audio</a>
14 <a href="/admin/playlists" class="btn">📃 Playlists</a>
15 <a href="/admin/comments" class="btn">💬 Reacties</a>
16 <% if (primarySite) { %><a href="/admin/seo" class="btn">🔎 SEO</a><% } %>
17 <a href="/admin/settings" class="btn">⚙️ Instellingen</a>
18 <% } else { %>
19 <a href="/posts/new" class="btn">✍️ Nieuwe post</a>
20 <a href="/admin/audio" class="btn">🎵 Audio</a>
21 <a href="/admin/comments" class="btn">💬 Reacties</a>
22 <% if (primarySite) { %>
23 <a href="/admin/sites/<%= primarySite.slug %>/edit" class="btn">🎨 Uiterlijk</a>
24 <% } else { %>
25 <a href="/admin/sites/new" class="btn">🎨 Maak je site aan</a>
26 <% } %>
27 <% if (tenancy === 'circle') { %>
28 <a href="/admin/circle" class="btn">🔗 Cirkel</a>
29 <% } %>
30 <% if (primarySite) { %><a href="/admin/seo" class="btn">🔎 SEO</a><% } %>
31 <a href="/admin/settings" class="btn">⚙️ Instellingen</a>
32 <% } %>
33 <% if (typeof premiumUnlocked === 'undefined' || premiumUnlocked) { %>
34 <a href="/admin/stats" class="btn">📊 Statistieken</a>
35 <a href="/admin/newsletter" class="btn">✉️ Nieuwsbrief</a>
36 <% if (tenancy !== 'hub' && primarySite) { %><a href="/pers" class="btn" target="_blank">📰 Perskit</a><% } %>
37 <% if (tenancy !== 'hub' && primarySite) { %><a href="/downloads" class="btn" target="_blank">⬇ Downloads</a><% } %>
38 <% if (tenancy !== 'hub' && primarySite) { %><a href="/links" class="btn" target="_blank">🔗 Link-in-bio</a><% } %>
39 <a href="/admin/shows" class="btn">📅 Agenda</a>
40 <% } %>
41 <a href="/admin/updates" class="btn">🔄 Updates</a>
42 </nav>
43
44 <div class="admin-stats">
45 <% if (tenancy === 'hub') { %>
46 <div class="stat-card"><div class="stat-num"><%= stats.users %></div><div class="stat-label">Gebruikers</div></div>
47 <div class="stat-card"><div class="stat-num"><%= stats.sites %></div><div class="stat-label">Sites</div></div>
48 <% } %>
49 <div class="stat-card"><div class="stat-num"><%= stats.posts %></div><div class="stat-label">Posts</div></div>
50 <div class="stat-card"><div class="stat-num"><%= stats.published %></div><div class="stat-label">Gepubliceerd</div></div>
51 </div>
52
53 <% if (typeof posts !== 'undefined' && posts && posts.length) { %>
54 <% var _drafts = posts.filter(function(p){ return p.isDraft; }).length; %>
55 <h2>Posts<% if (_drafts) { %> <span class="pl-draftcount"><%= _drafts %> concept<%= _drafts === 1 ? '' : 'en' %></span><% } %></h2>
56 <ul class="post-admin-list">
57 <% posts.forEach(function(p) { %>
58 <li class="pal-row<%= p.isDraft ? ' is-draft' : '' %>">
59 <a class="pal-title" href="<%= p.editUrl %>">
60 <% if (p.isDraft) { %><span class="pal-badge">Concept</span><% } %>
61 <span class="pal-name"><%= p.title || '(zonder titel)' %></span>
62 </a>
63 <span class="pal-actions">
64 <a class="pal-link" href="<%= p.editUrl %>">Bewerken</a>
65 <% if (!p.isDraft) { %><a class="pal-link" href="<%= p.viewUrl %>">Bekijk</a><% } %>
66 </span>
67 </li>
68 <% }); %>
69 </ul>
70 <% } %>
71
72 <% if (sites && sites.length) { %>
73 <h2>Sites</h2>
74 <table class="admin-table">
75 <thead>
76 <tr><th>Slug</th><th>Title</th><th>Owner</th><th>Created</th></tr>
77 </thead>
78 <tbody>
79 <% sites.forEach(function(s) { %>
80 <tr>
81 <td><code><%= s.slug %></code></td>
82 <td><%= s.title %></td>
83 <td><%= s.owner_username || '—' %></td>
84 <td><%= formatDate(s.created_at) %></td>
85 </tr>
86 <% }); %>
87 </tbody>
88 </table>
89 <% } %>
90
91 <% if (users && users.length) { %>
92 <h2>Users</h2>
93 <table class="admin-table">
94 <thead>
95 <tr><th>Username</th><th>Email</th><th>Role</th><th>Joined</th></tr>
96 </thead>
97 <tbody>
98 <% users.forEach(function(u) { %>
99 <tr>
100 <td><%= u.username %></td>
101 <td><%= u.email %></td>
102 <td><span class="role-pill role-<%= u.role %>"><%= u.role %></span></td>
103 <td><%= formatDate(u.created_at) %></td>
104 </tr>
105 <% }); %>
106 </tbody>
107 </table>
108 <% } %>
109
110</div>
111
112<style>
113.admin-page { max-width: 1000px; margin: 3rem auto; padding: 0 1rem; }
114.admin-page h1 { font-family: var(--font-display, serif); font-size: 2rem; margin: 0 0 0.25rem; }
115.admin-page h2 { font-family: var(--font-display, serif); font-size: 1.4rem; margin: 2rem 0 0.75rem; }
116.admin-tagline { color: var(--ink-muted); margin: 0 0 2rem; }
117.admin-tagline em { font-style: normal; opacity: 0.7; }
118
119/* Posts/concepten-lijst */
120.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; }
121.post-admin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
122.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; }
123.pal-row:hover { border-color: var(--accent); }
124.pal-row.is-draft { border-left: 3px solid var(--accent); }
125.pal-title { display: inline-flex; align-items: center; gap: 0.6rem; min-width: 0; color: var(--ink); text-decoration: none; font-weight: 600; }
126.pal-title:hover { color: var(--accent); }
127.pal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
128.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; }
129.pal-actions { display: flex; gap: 0.75rem; flex-shrink: 0; }
130.pal-link { color: var(--ink-muted); font-size: 0.85rem; text-decoration: none; white-space: nowrap; }
131.pal-link:hover { color: var(--accent); text-decoration: underline; }
132
133/* Quick-links grid — mobile-first.
134 auto-fit + minmax means: as many equal columns as fit, each at least 140px.
135 Mobile (~360-440px): 2 per row.
136 Tablet (~480-700px): 3 per row.
137 Desktop (≥ ~720px): all 5 in a single row. */
138.admin-quick-links {
139 display: grid;
140 grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
141 gap: 0.5rem;
142 margin: 0 0 1.5rem;
143 padding: 0;
144}
145.admin-quick-links .btn {
146 justify-content: center;
147 padding: 0.7rem 0.9rem;
148 font-weight: 600;
149 text-align: center;
150}
151.admin-quick-links .btn:hover {
152 background: color-mix(in srgb, var(--accent) 8%, var(--paper-2));
153 border-color: var(--accent);
154}
155
156.admin-stats {
157 display: grid;
158 grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
159 gap: 0.75rem;
160 margin-bottom: 1rem;
161}
162.stat-card {
163 background: var(--paper-2);
164 border: 1px solid var(--rule);
165 border-radius: 8px;
166 padding: 1rem 1.25rem;
167 text-align: center;
168}
169.stat-num {
170 font-size: 2rem;
171 font-weight: 700;
172 color: var(--accent);
173 line-height: 1;
174 font-family: var(--font-display, serif);
175}
176.stat-label {
177 color: var(--ink-muted);
178 font-size: 0.85rem;
179 text-transform: uppercase;
180 letter-spacing: 0.05em;
181 margin-top: 0.25rem;
182}
183
184.admin-table {
185 width: 100%;
186 border-collapse: collapse;
187 background: var(--paper-2);
188 border: 1px solid var(--rule);
189 border-radius: 8px;
190 overflow: hidden;
191}
192.admin-table th, .admin-table td {
193 padding: 0.6rem 0.9rem;
194 text-align: left;
195 border-bottom: 1px solid var(--rule);
196}
197.admin-table th {
198 background: var(--paper);
199 font-weight: 600;
200 font-size: 0.85rem;
201 text-transform: uppercase;
202 letter-spacing: 0.05em;
203 color: var(--ink-muted);
204}
205.admin-table tr:last-child td { border-bottom: 0; }
206.admin-table code { background: var(--paper); padding: 0.1rem 0.4rem; border-radius: 3px; font-size: 0.85rem; }
207
208.role-pill {
209 display: inline-block;
210 padding: 0.1rem 0.5rem;
211 border-radius: 10px;
212 font-size: 0.75rem;
213 text-transform: uppercase;
214 letter-spacing: 0.05em;
215 background: var(--paper);
216 color: var(--ink-muted);
217}
218.role-pill.role-god { background: var(--accent); color: white; }
219.role-pill.role-admin { background: var(--paper); color: var(--accent); border: 1px solid var(--accent); }
220
221.admin-todo {
222 margin: 2rem 0 0;
223 padding: 0.75rem 1rem;
224 background: var(--paper-2);
225 border-left: 3px solid var(--accent);
226 border-radius: 4px;
227 font-size: 0.9rem;
228 color: var(--ink-muted);
229}
230
231@media (max-width: 600px) {
232 .admin-table { font-size: 0.85rem; }
233 .admin-table th, .admin-table td { padding: 0.45rem 0.6rem; }
234}
235</style>
Note: See TracBrowser for help on using the repository browser.