source: Klonkt/src/views/pages/admin.ejs@ d54dade

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

feat: posts/drafts list on the dashboard — drafts findable again

Drafts (status!=published) were nowhere to be found: the timeline only shows
published posts and the dashboard had no posts list. Now a Posts block on the
god/solo and artist dashboard with DRAFTS ON TOP, a draft badge, and
mode-aware Edit/View links.

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

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