source: Klonkt/src/views/partials/msg-item.ejs@ a78a0ef

main
Last change on this file since a78a0ef was a78a0ef, checked in by Claude (agent) <aiclaude@…>, 5 weeks ago

Draadkop: de tegenpartij in een kleine uitsparing

De naam van de tegenpartij stond als vette regel boven het gesprek en at daarmee
ruimte op die aan de inhoud toekomt. Het is een label bij de draad, geen kop
erboven, dus het gedraagt zich nu ook zo: een kleine verzonken uitsparing,
kleiner lettertype, gedempte kleur.

Het aantal berichten zit in diezelfde uitsparing in plaats van als tweede pil
ernaast, gescheiden door een dun lijntje. Scheelt een element en een gat.

Verder is de kop lager (marge .5 -> .35rem, tussenruimte .5 -> .4rem) en kapt
een lange deelnemerslijst af op 60% breedte, zodat de post-link rechts altijd
past.

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

  • Property mode set to 100644
File size: 12.3 KB
Line 
1<% if (n.type === 'thread') { %>
2<%
3 var _tseen = (typeof seen !== 'undefined' && seen) ? seen : 0;
4 // Een draad is nieuw zodra EEN bericht erin nieuw is.
5 var _tnew = !!_tseen && (n.messages || []).some(function (m) {
6 return m.created_at && Date.parse(m.created_at) > _tseen;
7 });
8 var _tpeople = (n.people || []).map(function (p) { return p.name || p.handle || '?'; });
9 // Alleen jij aan het woord: dan is de tegenpartij het adres waaraan
10 // je schreef, niet een lege naam.
11 var _tto = ((n.messages || []).find(function (m) { return m.to_handle; }) || {}).to_handle;
12 var _tlabel = _tpeople.length ? _tpeople.join(', ') : (_tto || t('msg.you'));
13 %>
14 <li class="msg-item msg-thread<%= _tnew ? ' is-new' : '' %>" data-kind="conv" data-who="<%= (_tpeople.join(' ') + ' ' + (_tto || '')).toLowerCase() %>">
15 <div class="msg-thread-head">
16 <%# Tegenpartij en aantal in EEN uitsparing: het is een label bij het
17 gesprek, geen kop erboven. Zo houdt de inhoud de ruimte. %>
18 <span class="msg-thread-who"><%= _tlabel %><% if (n.count > 1) { %><span class="msg-thread-count"><%= n.count %></span><% } %></span>
19 <% if (_tnew) { %><span class="msg-new" title="<%= t('msg.new') %>"></span><% } %>
20 <%# De context bij de draad: waar gaat dit gesprek over? Zonder deze
21 link is een antwoord in een lijst niet te plaatsen. %>
22 <% if (n.post) { %>
23 <a class="msg-thread-post" href="/<%= n.post.slug %>">
24 <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/></svg>
25 <%= n.post.title || n.post.slug %>
26 </a>
27 <% } %>
28 </div>
29 <ul class="msg-thread-msgs">
30 <% (n.messages || []).forEach(function (m) { %><%- include('msg-item', { n: m, seen: _tseen, inThread: true }) %><% }); %>
31 </ul>
32 </li>
33<% } else { %>
34<%
35 var _seen = (typeof seen !== 'undefined' && seen) ? seen : 0;
36 var _t = n.type === 'announce' ? 'boost' : n.type; // reply|mention|report|like|boost|follow|sent
37 var _new = _seen && n.created_at ? (Date.parse(n.created_at) > _seen) : false;
38 var _who = n.name || n.handle || '';
39 var _priv0 = (n.visibility === 'followers' || n.visibility === 'direct');
40 // Emmers: Activiteit = likes/boosts/follows/polls, Moderatie =
41 // reports, en al het overige is gesprek. De oude emmers 'msgs' en
42 // 'sent' bestaan niet meer sinds Berichten, Gesprekken en Verzonden
43 // samenvielen -- en dat is geen cosmetische hernoeming: een
44 // gespreksregel die om wat voor reden dan ook geen draad werd (geen
45 // post, geen herkenbare tegenpartij) hield anders een data-kind
46 // waarvoor geen chip meer bestond, en was daarmee onder ELKE chip
47 // behalve Alles onzichtbaar.
48 var _kind = (_t === 'like' || _t === 'boost' || _t === 'follow' || _t === 'poll_done') ? 'act'
49 : _t === 'report' ? 'mod'
50 : 'conv';
51 // Binnen een draad is dit geen zelfstandige regel: de chip filtert op
52 // de draad, niet op de losse zinnen erin.
53 var _sub = (typeof inThread !== 'undefined' && inThread);
54 var _init = String(_who || '?').replace(/^@/, '').charAt(0).toUpperCase();
55 var _priv = (n.visibility === 'followers' || n.visibility === 'direct');
56 %>
57 <li class="<%= _sub ? 'msg-sub' : 'msg-item' %> msg-<%= _t %><%= _new ? ' is-new' : '' %>"<% if (!_sub) { %> data-kind="<%= _kind %>"<% } %> data-who="<%= String(_who).toLowerCase() %>">
58 <span class="msg-av<%= _t === 'sent' ? ' msg-av-sent' : '' %>" aria-hidden="true">
59 <% if (_t === 'sent') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>
60 <% } else if (_t === 'poll_done') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="20" x2="18" y2="10"/><line x1="12" y1="20" x2="12" y2="4"/><line x1="6" y1="20" x2="6" y2="14"/></svg>
61 <% } else if (n.icon) { %><img src="<%= avatar(n.icon, 96) %>" alt="" loading="lazy">
62 <% } else { %><%= _init %><% } %>
63 <span class="msg-dot msg-dot-<%= _t %>">
64 <% if (_t === '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>
65 <% } else if (_t === 'boost') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" 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>
66 <% } else if (_t === 'follow') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" 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>
67 <% } else if (_t === 'report') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" 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>
68 <% } else if (_t === 'mention') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" 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>
69 <% } else if (_t === 'sent') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 17 4 12 9 7"/><path d="M20 18v-2a4 4 0 0 0-4-4H4"/></svg>
70 <% } else if (_t === 'poll_done') { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="20" x2="18" y2="10"/><line x1="12" y1="20" x2="12" y2="4"/><line x1="6" y1="20" x2="6" y2="14"/></svg>
71 <% } else { %><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" 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><% } %>
72 </span>
73 </span>
74
75 <div class="msg-body">
76 <div class="msg-line">
77 <% if (_t === 'sent') { %>
78 <span class="msg-who"><%= t('msg.you') %></span>
79 <% if (n.to_handle) { %><span class="msg-handle">→ <%= n.to_handle %></span><% } %>
80 <% } else { %>
81 <a class="msg-who" href="<%= n.url %>" target="_blank" rel="nofollow noopener"><%- emojiName(_who, n.actor_emoji_json) %></a>
82 <% if (n.handle && n.name) { %><span class="msg-handle"><%= n.handle %></span><% } %>
83 <% } %>
84 <% if (_new) { %><span class="msg-new" title="<%= t('msg.new') %>"></span><% } %>
85 <% /* When the post was written, like de Krant and de Guardian PWA
86 show it. created_at (when it reached us) stays the sort key
87 and drives the "new since your last visit" dot above. */ %>
88 <% if (n.published || n.created_at) { %><span class="msg-time"><%= formatDateTime(n.published || n.created_at) %></span><% } %>
89 </div>
90
91 <div class="msg-what">
92 <% if (n.count && n.count > 1) { %>
93 <strong><%= t('msg.and_more', { n: n.count - 1 }) %></strong>
94 <%= _t === 'like' ? t('msg.liked_many') : t('msg.boosted_many') %>
95 <% } else if (_t === 'follow') { %><%= t('notif.followed') %>
96 <% } else if (_t === 'like') { %><%= t('notif.liked') %>
97 <% } else if (_t === 'boost') { %><%= t('notif.boosted') %>
98 <% } else if (_t === 'report') { %><%= t('notif.reported') %>
99 <% } else if (_t === 'mention' && n.help_request) { %>🛟 <%= t('msg.help_request') %>
100 <% } else if (_t === 'mention' && n.wave) { %>👋 <%= t('msg.waved_at_you') %>
101 <% } else if (_t === 'mention') { %><%= t('notif.mentioned') %>
102 <% } else if (_t === 'sent') { %><%= t('msg.sent_reply') %>
103 <% } else if (_t === 'poll_done') { %><strong><%= t('msg.poll_done') %></strong>
104 <% } else { %><%= t('notif.replied') %><% } %>
105 <% if (_priv) { %><span class="msg-priv" title="<%= t('msg.private_hint') %>">🔒 <%= t('msg.private') %></span><% } %>
106 <% if (n.post_slug && !_sub) { %><a class="msg-post" href="/<%= n.post_slug %>"><%= n.post_title || n.post_slug %></a><% } %>
107 <% if (_t === 'mention' && n.note_url) { %><a class="msg-post" href="<%= n.note_url %>" target="_blank" rel="nofollow noopener"><%= t('tl.view_original') %></a><% } %>
108 <% if (_t === 'sent' && n.in_reply_to) { %><a class="msg-post" href="<%= n.in_reply_to %>" target="_blank" rel="nofollow noopener"><%= t('tl.view_original') %></a><% } %>
109 </div>
110
111 <% if (_t === 'report' && n.content) { %><div class="msg-content"><%= n.content %></div>
112 <% } else if ((_t === 'reply' || _t === 'mention' || _t === 'sent') && n.content) { %><div class="msg-content msg-note"><%- include('../partials/note-body', { nb: n }) %></div>
113 <% if (_t === 'mention' && n.wave && n.actorUri && canMutate) { %>
114 <form class="msg-quickreply" method="post" action="<%= (typeof siteUrlBase !== 'undefined' ? siteUrlBase : '') %>/messages/quick-reply" style="display:flex;gap:6px;flex-wrap:wrap;margin-top:6px">
115 <input type="hidden" name="to" value="<%= n.actorUri %>">
116 <button class="btn small" name="text" value="<%= t('msg.wave_r1') %>"><%= t('msg.wave_r1') %></button>
117 <button class="btn small" name="text" value="<%= t('msg.wave_r2') %>"><%= t('msg.wave_r2') %></button>
118 <button class="btn small" name="text" value="👋"><%= t('msg.wave_back') %></button>
119 </form>
120 <% } %>
121 <% } else if (_t === 'poll_done' && n.poll) { %>
122 <div class="msg-poll" role="group">
123 <% n.poll.options.forEach(function (o) { %>
124 <div class="msg-poll-opt">
125 <div class="msg-poll-top"><span class="msg-poll-name"><%= o.name %></span><span class="msg-poll-pct"><%= o.pct %>%</span></div>
126 <div class="msg-poll-bar"><span style="width:<%= o.pct %>%"></span></div>
127 </div>
128 <% }); %>
129 <div class="msg-poll-total"><%= t('msg.poll_total', { n: n.poll.voters }) %></div>
130 </div>
131 <% } %>
132
133 <% if (_t === 'sent' && n.outboxId) { %>
134 <div class="msg-actions">
135 <details class="msg-edit">
136 <summary><%= t('fedi.edit') %></summary>
137 <div class="msg-edit-form">
138 <%- include('../partials/reply-editor', {
139 action: '/fediverse/' + n.outboxId + '/edit',
140 placeholder: t('fedi.reply_ph'),
141 submitLabel: t('fedi.save_edit'),
142 rows: 2,
143 initialHtml: n.content,
144 initialText: n.editable,
145 defaultLang: n.language,
146 noAttach: true,
147 }) %>
148 </div>
149 </details>
150 <form method="post" action="/fediverse/<%= n.outboxId %>/delete" data-confirm="<%= t('fedi.delete_confirm') %>">
151 <button type="submit" class="msg-del"><%= t('comments.delete') %></button>
152 </form>
153 </div>
154 <% } %>
155 </div>
156 </li>
157<% } %>
Note: See TracBrowser for help on using the repository browser.