source: Klonkt/src/views/pages/timeline.ejs@ 484adf8

main
Last change on this file since 484adf8 was 46f3dd6, checked in by Robin Genis <roboburr@…>, 3 months ago

feat(fediverse): split Tijdlijn (feed) from Volgend (following) + put Timeline in the menu

Phase 3 of the Cirkels-on-AP rework. /tijdlijn is now just the reading feed;
following management (follow box, follow list, auto-boost toggles) moves to a new
/volgend page. A shared tab nav switches between them. Timeline gets a top-bar
button next to the bell on desktop and a Tijdlijn entry in the mobile profile
sheet (both admin-only via canManageFedi). follow/unfollow/autoboost now redirect
to /volgend. nl/en/de.

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

  • Property mode set to 100644
File size: 8.1 KB
RevLine 
[914eb9f]1<div class="tl-wrap">
2 <h1 class="tl-title"><%= t('tl.title') %></h1>
3 <p class="tl-lead"><%= t('tl.lead') %></p>
[46f3dd6]4 <%- include('../partials/tl-tabs', { active: 'feed' }) %>
[914eb9f]5 <% if (typeof success !== 'undefined' && success) { %><div class="alert alert-success"><%= success %></div><% } %>
6 <% if (typeof error !== 'undefined' && error) { %><div class="alert alert-error"><%= error %></div><% } %>
7
8 <% if (!timeline || !timeline.length) { %>
9 <p class="tl-empty"><%= t('tl.empty') %></p>
10 <% } else { %>
11 <ol class="tl-feed">
12 <% timeline.forEach(function(p){ %>
13 <li class="tl-item">
14 <span class="tl-avatar"><% if (p.author_icon) { %><img src="<%= p.author_icon %>" alt="" loading="lazy"><% } else { %><%= (p.author_name || '?').charAt(0).toUpperCase() %><% } %></span>
15 <div class="tl-itembody">
16 <div class="tl-meta">
17 <a class="tl-author" href="<%= p.author_url || p.author_uri %>" target="_blank" rel="nofollow noopener"><%= p.author_name %></a>
18 <span class="tl-handle"><%= p.author_handle %></span>
19 <% if (p.published || p.created_at) { %><span class="tl-time"><%= formatDateTime(p.published || p.created_at) %></span><% } %>
20 </div>
21 <div class="tl-content"><%- p.content %></div>
22 <% var media = []; try { media = JSON.parse(p.media_json || '[]'); } catch (e) { media = []; } %>
23 <% media.filter(function(m){ return !m.type || /^image\//.test(m.type); }).forEach(function(m){ %><img class="tl-media" src="<%= m.url %>" alt="" loading="lazy"><% }); %>
24 <% if (p.url) { %><p class="tl-orig"><a href="<%= p.url %>" target="_blank" rel="nofollow noopener"><%= t('tl.view_original') %></a></p><% } %>
[d988fa0]25 <div class="tl-actions">
26 <form method="post" action="/tijdlijn/like" class="tl-act-form"><input type="hidden" name="note" value="<%= p.id %>"><input type="hidden" name="author" value="<%= p.author_uri %>"><button type="submit" class="tl-act" title="<%= t('fedi.likes') %>">⭐</button></form>
27 <form method="post" action="/tijdlijn/boost" class="tl-act-form"><input type="hidden" name="note" value="<%= p.id %>"><input type="hidden" name="author" value="<%= p.author_uri %>"><button type="submit" class="tl-act" title="<%= t('fedi.boosts') %>">🔁</button></form>
28 <button type="button" class="tl-act fedi-remote-reply-btn" data-fedi-uri="<%= p.id %>" data-fedi-ph="<%= t('fedi.remote_ph') %>" title="<%= t('fedi.remote_reply') %>">↩</button>
[f5c3870]29 <form method="post" action="/blokkeren/add" class="tl-act-form" onsubmit="return confirm('<%= t('tl.block') %>?');"><input type="hidden" name="target" value="<%= p.author_uri %>"><button type="submit" class="tl-act" title="<%= t('tl.block') %>">🚫</button></form>
[d988fa0]30 </div>
[914eb9f]31 </div>
32 </li>
33 <% }); %>
34 </ol>
35 <% } %>
36</div>
37
38<style>
39 .tl-wrap { max-width: 640px; margin: 2rem auto; padding: 0 1rem; }
40 .tl-title { margin: 0 0 .25rem; }
41 .tl-lead { color: var(--ink-soft, #888); margin: 0 0 1.25rem; }
42 .tl-sub { font-size: 1.1rem; margin: 1.75rem 0 .75rem; }
43 .tl-follow { display: flex; gap: .5rem; margin: 0 0 1rem; flex-wrap: wrap; }
44 .tl-follow input { flex: 1; min-width: 200px; height: 2.4rem; padding: 0 .9rem; border-radius: 999px; font: inherit;
45 border: 1px solid color-mix(in srgb, var(--ink, #000) 18%, transparent); background: color-mix(in srgb, var(--ink, #000) 4%, transparent); color: var(--ink, #000); }
46 .tl-foll-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
47 .tl-foll { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: 12px; background: color-mix(in srgb, var(--ink, #000) 4%, transparent); }
48 .tl-foll-av, .tl-avatar { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; background: color-mix(in srgb, var(--accent, #888) 20%, transparent); color: var(--accent, #555); }
49 .tl-foll-av img, .tl-avatar img { width: 100%; height: 100%; object-fit: cover; }
50 .tl-foll-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
51 .tl-foll-handle, .tl-handle { color: var(--ink-soft, #888); font-size: .82rem; }
52 .tl-pending { font-size: .72rem; color: var(--ink-soft, #999); }
53 .tl-unfollow { background: none; border: 1px solid color-mix(in srgb, var(--ink, #000) 18%, transparent); border-radius: 8px; padding: .25rem .6rem; font-size: .8rem; color: var(--ink-soft, #888); cursor: pointer; }
54 .tl-unfollow:hover { color: var(--ink, #000); }
55 .tl-empty { color: var(--ink-soft, #888); }
56 .tl-feed { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .9rem; }
57 .tl-item { display: flex; gap: .75rem; padding: .9rem 1rem; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--ink, #000) 9%, transparent); background: color-mix(in srgb, var(--ink, #000) 3%, transparent); }
58 .tl-itembody { flex: 1; min-width: 0; }
59 .tl-meta { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; }
60 .tl-author { font-weight: 600; color: var(--ink, inherit); text-decoration: none; }
61 .tl-author:hover { text-decoration: underline; }
62 .tl-time { color: var(--ink-soft, #999); font-size: .8rem; margin-left: auto; }
63 .tl-content { margin: .3rem 0 0; line-height: 1.5; overflow-wrap: anywhere; }
64 .tl-content p { margin: .25rem 0; } .tl-content p:first-child { margin-top: 0; }
65 .tl-media { max-width: 100%; height: auto; border-radius: 10px; margin: .5rem 0 0; display: block; }
66 .tl-orig { margin: .5rem 0 0; font-size: .82rem; }
67 .tl-orig a { color: var(--accent, #06c); }
[d988fa0]68 .tl-actions { display: flex; gap: .35rem; margin-top: .55rem; }
69 .tl-act-form { margin: 0; }
70 .tl-act { background: none; border: 1px solid color-mix(in srgb, var(--ink, #000) 14%, transparent); border-radius: 999px; padding: .2rem .6rem; cursor: pointer; font-size: .9rem; color: var(--ink-soft, #888); }
71 .tl-act:hover { color: var(--ink, #000); border-color: color-mix(in srgb, var(--accent, #888) 50%, transparent); }
[914eb9f]72</style>
[d988fa0]73
74<script>
75(function(){
76 if (window.__fediRemoteWired) return; window.__fediRemoteWired = true;
77 var current = null, currentBtn = null;
78 function close(){ if (current) { current.remove(); current = null; currentBtn = null; } }
79 function go(raw, uri){ var d=(raw||'').trim().replace(/^@?[^@\s]*@/,'').replace(/^https?:\/\//i,'').replace(/\/.*$/,'').trim(); if(d) location.href='https://'+d+'/authorize_interaction?uri='+encodeURIComponent(uri||''); }
80 function place(f, b){ var r=b.getBoundingClientRect(); f.style.top=(r.bottom+window.scrollY+6)+'px'; f.style.left=Math.max(8, Math.min(r.left+window.scrollX, window.scrollX+window.innerWidth-340))+'px'; }
81 document.addEventListener('click', function(e){
82 if (e.target.closest && e.target.closest('.fedi-remote-cancel')) { close(); return; }
83 if (current && e.target.closest && e.target.closest('.fedi-remote-form')) return;
84 var b = e.target.closest && e.target.closest('.fedi-remote-reply-btn');
85 if (b) {
86 e.preventDefault();
87 if (currentBtn === b) { close(); return; }
88 close();
89 var f = document.createElement('form'); f.className='fedi-remote-form'; f.dataset.uri = b.getAttribute('data-fedi-uri')||'';
90 f.innerHTML = '<input type="text" autocomplete="off" spellcheck="false"><button type="submit" class="btn btn-primary fedi-remote-go" aria-label="ok">&rarr;</button><button type="button" class="fedi-remote-cancel" aria-label="x">&times;</button>';
[f6c414e]91 f.querySelector('input').placeholder = b.getAttribute('data-fedi-ph') || 'mastodon.social';
[d988fa0]92 document.body.appendChild(f); place(f, b); current=f; currentBtn=b; f.querySelector('input').focus();
93 return;
94 }
95 if (current) close();
96 });
97 document.addEventListener('submit', function(e){ var f=e.target.closest && e.target.closest('.fedi-remote-form'); if(!f) return; e.preventDefault(); go(f.querySelector('input').value, f.dataset.uri); });
98 document.addEventListener('keydown', function(e){ if (e.key === 'Escape') close(); });
99 window.addEventListener('scroll', close, true);
100})();
101</script>
Note: See TracBrowser for help on using the repository browser.