source: Klonkt/src/views/pages/fedi-notifications.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: 6.9 KB
Line 
1<div class="nt-wrap">
2 <%- include('../partials/fedi-tabs', { active: 'meldingen' }) %>
3 <h1 class="nt-title"><%= t('notif.title') %></h1>
4 <% if (!items || !items.length) { %>
5 <p class="nt-empty"><%= t('notif.empty') %></p>
6 <% } else { %>
7 <ul class="nt-list">
8 <% items.forEach(function(n){
9 var _ic = n.type === 'follow' ? 'follow' : (n.type === 'like' ? 'like' : (n.type === 'announce' ? 'boost' : (n.type === 'report' ? 'report' : (n.type === 'mention' ? 'mention' : 'reply'))));
10 %>
11 <li class="nt-item nt-<%= _ic %>">
12 <span class="nt-icon" aria-hidden="true">
13 <% if (_ic === 'like') { %><svg viewBox="0 0 24 24" fill="currentColor"><path d="M12 2.6l2.9 5.88 6.49.95-4.7 4.58 1.11 6.46L12 17.96l-5.8 3.06 1.1-6.46-4.69-4.58 6.49-.95z"/></svg>
14 <% } else if (_ic === 'boost') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="17 1 21 5 17 9"/><path d="M3 11V9a4 4 0 0 1 4-4h14"/><polyline points="7 23 3 19 7 15"/><path d="M21 13v2a4 4 0 0 1-4 4H3"/></svg>
15 <% } else if (_ic === 'follow') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><line x1="19" y1="8" x2="19" y2="14"/><line x1="22" y1="11" x2="16" y2="11"/></svg>
16 <% } else if (_ic === 'report') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"/><line x1="4" y1="22" x2="4" y2="15"/></svg>
17 <% } else if (_ic === 'mention') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"/><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-3.92 7.94"/></svg>
18 <% } else { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg><% } %>
19 </span>
20 <div class="nt-body">
21 <div class="nt-line">
22 <a class="nt-who" href="<%= n.url %>" target="_blank" rel="nofollow noopener"><%= n.name || n.handle %></a>
23 <% if (n.handle && n.name) { %><span class="nt-handle"><%= n.handle %></span><% } %>
24 <% if (n.created_at) { %><span class="nt-time"><%= formatDateTime(n.created_at) %></span><% } %>
25 </div>
26 <div class="nt-what">
27 <% if (n.type === 'follow') { %><%= t('notif.followed') %>
28 <% } else if (n.type === 'like') { %><%= t('notif.liked') %>
29 <% } else if (n.type === 'announce') { %><%= t('notif.boosted') %>
30 <% } else if (n.type === 'report') { %><%= t('notif.reported') %>
31 <% } else if (n.type === 'mention') { %><%= t('notif.mentioned') %>
32 <% } else { %><%= t('notif.replied') %><% } %>
33 <% if (n.post_slug) { %><a class="nt-post" href="/<%= n.post_slug %>"><%= n.post_title || n.post_slug %></a><% } %>
34 <% if (n.type === 'mention' && n.note_url) { %><a class="nt-post" href="<%= n.note_url %>" target="_blank" rel="nofollow noopener"><%= t('tl.view_original') %></a><% } %>
35 </div>
36 <% if (n.type === 'report') { %>
37 <% if (n.content) { %><div class="nt-content"><%= n.content %></div><% } else { %><div class="nt-content nt-noreason"><%= t('notif.report_noreason') %></div><% } %>
38 <% if (n.objects && n.objects.length) { %>
39 <div class="nt-report-about">
40 <% n.objects.forEach(function (o) { %>
41 <a class="nt-post" href="/<%= o.slug %>"><%= t('notif.report_about') %>: <%= o.title %></a>
42 <% }); %>
43 </div>
44 <% } %>
45 <% } else if ((n.type === 'reply' || n.type === 'mention') && n.content) { %><div class="nt-content"><%- n.content %></div><% } %>
46 </div>
47 </li>
48 <% }); %>
49 </ul>
50 <% } %>
51</div>
52
53<style>
54 .nt-wrap { max-width: 640px; margin: 1rem auto; padding: 0 1rem; }
55 .fedi-back { margin: 0 0 1.25rem; }
56 .nt-title { margin: 0 0 1.25rem; }
57 .nt-empty { color: var(--ink-soft, #888); }
58 .nt-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
59 .nt-item { display: flex; gap: .85rem; padding: .9rem 1rem; border-radius: 14px; align-items: flex-start;
60 background: color-mix(in srgb, var(--ink, #000) 3.5%, transparent);
61 border: 1px solid color-mix(in srgb, var(--ink, #000) 9%, transparent);
62 transition: border-color .15s ease, box-shadow .15s ease; }
63 .nt-item:hover { border-color: color-mix(in srgb, var(--accent, #888) 30%, transparent);
64 box-shadow: 0 2px 12px color-mix(in srgb, var(--ink, #000) 6%, transparent); }
65 .nt-icon { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%;
66 display: inline-flex; align-items: center; justify-content: center; }
67 .nt-icon svg { width: 18px; height: 18px; }
68 .nt-report-about { margin-top: .35rem; display: flex; flex-direction: column; gap: .15rem; }
69 .nt-noreason { font-style: italic; opacity: .7; }
70 .nt-like .nt-icon { background: color-mix(in srgb, #e8b04b 16%, transparent); color: #e8b04b; }
71 .nt-boost .nt-icon { background: color-mix(in srgb, #2fa85a 16%, transparent); color: #2fa85a; }
72 .nt-follow .nt-icon, .nt-reply .nt-icon { background: color-mix(in srgb, var(--accent, #888) 16%, transparent); color: var(--accent, #06c); }
73 .nt-report .nt-icon { background: color-mix(in srgb, #c0392b 16%, transparent); color: #c0392b; }
74 .nt-mention .nt-icon { background: color-mix(in srgb, #8e6cf0 16%, transparent); color: #8e6cf0; }
75 .nt-body { flex: 1; min-width: 0; }
76 .nt-line { display: flex; align-items: baseline; gap: .4rem; }
77 .nt-who { font-weight: 700; color: var(--ink, inherit); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
78 .nt-who:hover { text-decoration: underline; }
79 .nt-handle { color: var(--ink-soft, #888); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
80 .nt-time { color: var(--ink-soft, #999); font-size: .76rem; margin-left: auto; flex: 0 0 auto; white-space: nowrap; }
81 .nt-what { color: var(--ink-soft, #aaa); margin-top: .12rem; line-height: 1.4; }
82 .nt-post { color: var(--accent, #06c); font-weight: 600; }
83 .nt-content { margin: .45rem 0 0; padding: .55rem .75rem; border-radius: 10px; line-height: 1.5;
84 background: color-mix(in srgb, var(--ink, #000) 4%, transparent); color: var(--ink, inherit); overflow-wrap: anywhere; }
85 .nt-content p { margin: .2rem 0; } .nt-content p:first-child { margin-top: 0; } .nt-content p:last-child { margin-bottom: 0; }
86</style>
Note: See TracBrowser for help on using the repository browser.