source: Klonkt/src/views/pages/fedi-notifications.ejs@ 2f42b60

main
Last change on this file since 2f42b60 was 2f42b60, checked in by Robin Genis <roboburr@…>, 2 months ago

style(fedi): nicer card layout for Notifications + My-replies

Notifications: emoji type-icons -> coloured SVG icons in tinted circles (gold like /
green boost / accent follow+reply), two-line hierarchy (who+time, then action+post),
reply preview in a tinted block, hover lift. My-replies: reply-arrow head with
'to @handle' + time, content indented, pill delete button with trash icon, hover lift.

  • Property mode set to 100644
File size: 5.0 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' : '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 { %><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><% } %>
17 </span>
18 <div class="nt-body">
19 <div class="nt-line">
20 <a class="nt-who" href="<%= n.url %>" target="_blank" rel="nofollow noopener"><%= n.name || n.handle %></a>
21 <% if (n.handle && n.name) { %><span class="nt-handle"><%= n.handle %></span><% } %>
22 <% if (n.created_at) { %><span class="nt-time"><%= formatDateTime(n.created_at) %></span><% } %>
23 </div>
24 <div class="nt-what">
25 <% if (n.type === 'follow') { %><%= t('notif.followed') %>
26 <% } else if (n.type === 'like') { %><%= t('notif.liked') %>
27 <% } else if (n.type === 'announce') { %><%= t('notif.boosted') %>
28 <% } else { %><%= t('notif.replied') %><% } %>
29 <% if (n.post_slug) { %><a class="nt-post" href="/<%= n.post_slug %>"><%= n.post_title || n.post_slug %></a><% } %>
30 </div>
31 <% if (n.type === 'reply' && n.content) { %><div class="nt-content"><%- n.content %></div><% } %>
32 </div>
33 </li>
34 <% }); %>
35 </ul>
36 <% } %>
37</div>
38
39<style>
40 .nt-wrap { max-width: 640px; margin: 1rem auto; padding: 0 1rem; }
41 .fedi-back { margin: 0 0 1.25rem; }
42 .nt-title { margin: 0 0 1.25rem; }
43 .nt-empty { color: var(--ink-soft, #888); }
44 .nt-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
45 .nt-item { display: flex; gap: .85rem; padding: .9rem 1rem; border-radius: 14px; align-items: flex-start;
46 background: color-mix(in srgb, var(--ink, #000) 3.5%, transparent);
47 border: 1px solid color-mix(in srgb, var(--ink, #000) 9%, transparent);
48 transition: border-color .15s ease, box-shadow .15s ease; }
49 .nt-item:hover { border-color: color-mix(in srgb, var(--accent, #888) 30%, transparent);
50 box-shadow: 0 2px 12px color-mix(in srgb, var(--ink, #000) 6%, transparent); }
51 .nt-icon { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%;
52 display: inline-flex; align-items: center; justify-content: center; }
53 .nt-icon svg { width: 18px; height: 18px; }
54 .nt-like .nt-icon { background: color-mix(in srgb, #e8b04b 16%, transparent); color: #e8b04b; }
55 .nt-boost .nt-icon { background: color-mix(in srgb, #2fa85a 16%, transparent); color: #2fa85a; }
56 .nt-follow .nt-icon, .nt-reply .nt-icon { background: color-mix(in srgb, var(--accent, #888) 16%, transparent); color: var(--accent, #06c); }
57 .nt-body { flex: 1; min-width: 0; }
58 .nt-line { display: flex; align-items: baseline; gap: .4rem; }
59 .nt-who { font-weight: 700; color: var(--ink, inherit); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
60 .nt-who:hover { text-decoration: underline; }
61 .nt-handle { color: var(--ink-soft, #888); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
62 .nt-time { color: var(--ink-soft, #999); font-size: .76rem; margin-left: auto; flex: 0 0 auto; white-space: nowrap; }
63 .nt-what { color: var(--ink-soft, #aaa); margin-top: .12rem; line-height: 1.4; }
64 .nt-post { color: var(--accent, #06c); font-weight: 600; }
65 .nt-content { margin: .45rem 0 0; padding: .55rem .75rem; border-radius: 10px; line-height: 1.5;
66 background: color-mix(in srgb, var(--ink, #000) 4%, transparent); color: var(--ink, inherit); overflow-wrap: anywhere; }
67 .nt-content p { margin: .2rem 0; } .nt-content p:first-child { margin-top: 0; } .nt-content p:last-child { margin-bottom: 0; }
68</style>
Note: See TracBrowser for help on using the repository browser.