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

main
Last change on this file since 9a00f28 was 9a00f28, checked in by Robin <roboburr@…>, 7 weeks ago

Fix: test feedback round, cirkels tagline + report details + full i18n

Three findings from Bart's test pass, tied together by the new i18n keys:

  1. The admin tagline said "Solo mode" even with Cirkels (federation) on. Solo-tenancy now distinguishes: apEnabled -> "Cirkels-modus: jouw site, verbonden met de fediverse", else the solo line. New key in nl/en/de.
  1. Reports only showed who reported; now they show the reason and WHICH post. getNotifications resolves the stored objects URIs of a report: our own /ap/notes/<id> become "Over de post: <title>" links under the description; an empty reason renders "Geen reden opgegeven". Other URIs (the actor itself) are skipped, the row already names the account.
  1. Notificaties and Betaalde posts were hardcoded Dutch on an English-configured Klonkt. Everything now goes through t(): the two admin pages (including their client-side status strings, passed via the JSON data block), the admin menu buttons, and the visitor-facing paid pages (gate, passkey, result). Server-side push payloads translate too, using the SITE's content language (fallback KLONKT_DEFAULT_LANG), and the test ping uses the request language. Full nl/en/de dictionaries.

Changed files:
src/services/i18n.js

  • admin.tagline_cirkels, admin.b_paid/b_push/back, notif.report_about/ report_noreason, and the push.*, apaid.*, pgate.*, ppk.*, pres.* blocks in nl/en/de

src/routes/admin.js, src/views/pages/admin.ejs

  • circlesOn (apEnabled) -> cirkels tagline; menu buttons via t()

src/services/ActivityPubService.js

  • report objects resolved to post links; push payloads via i18nT with pushLang(slug) (site language)

src/views/pages/fedi-notifications.ejs

  • report reason fallback + "Over de post" links (+ styles)

src/routes/admin-push.js, src/views/pages/admin-push.ejs

  • pageTitleKey push.t; all copy + JS status strings via t()

src/routes/admin-paid.js, src/views/pages/admin-paid.ejs

  • pageTitleKey apaid.t; all copy via t(), copy-button label via data-attr

src/routes/paid.js

  • pageTitleKey pres.t / ppk.t

src/views/pages/paid-gate.ejs, paid-passkey.ejs, paid-result.ejs

  • visitor copy + JS strings via t()

src/routes/push.js

  • test notification via resolveLang(req)

-robo
Co-Authored-By: Claude Opus 4.8 <noreply@…>

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