source: Klonkt/src/views/partials/view-switcher.ejs@ 9da8027

main
Last change on this file since 9da8027 was 9da8027, checked in by Bart <bart@…>, 3 weeks ago

Geen Lezen in de cirkel

De cirkel toont berichten van ANDEREN, opgehaald van hun servers; "het hele
stuk" is daar niet iets wat wij in handen hebben, en circle-feed.ejs heeft dan
ook geen leessectie. De knop stond er wel, en deed niets. Weg ermee: een knop
die niets doet is erger dan een knop die er niet is.

Daarbij hoort een terugval, anders ruil je één probleem voor een ander. Wie op
de eigen feed Lezen koos, houdt die voorkeur in localStorage; op de cirkel is er
dan geen knop die bij data-feed-view hoort en stond de hele pil grijs terwijl de
tijdlijn gewoon te zien was -- nergens meer te zien waar je bent. syncAria valt
nu terug op timeline zodra de gekozen weergave op deze pagina niet bestaat. De
VOORKEUR blijft staan: terug op de eigen feed is Lezen weer actief.

Nagelopen door de partial los te renderen (on-home en on-tag krijgen Lezen,
on-cirkel niet) en door in de browser aankomst op de cirkel na te spelen: knop
weg, timeline actief, opgeslagen voorkeur nog 'reader'.

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

  • Property mode set to 100644
File size: 5.2 KB
Line 
1<%# View switcher partial — Tijdlijn / Grid + grid-cols picker.
2 Mounted in shell.ejs once, visible on every non-admin page. Click
3 handlers are wired in shell.ejs via event-delegation on document so
4 HTMX-swapped content keeps working without rebinding. %>
5<%
6 var _bc = (typeof bodyClass === 'string') ? bodyClass : '';
7 var _onShows = _bc.indexOf('on-shows') >= 0;
8 // Pagina's zonder actieve feed-weergave → niets in de pill is 'actief' (Solo/Cirkel
9 // + Tijdlijn/Grid grijs). Alleen Agenda krijgt z'n eigen is-active op de agenda.
10 var _neutral = ['on-shows','on-downloads','on-post','on-epk','on-linkbio','on-newsletter','on-archive']
11 .some(function(c){ return _bc.indexOf(c) >= 0; });
12 // Lezen bestaat alleen waar een leessectie is, en dat is de eigen feed. De
13 // cirkel toont berichten van ANDEREN, opgehaald van hun servers -- daar is
14 // "het hele stuk" niet iets wat wij in handen hebben. Dus daar geen knop:
15 // een knop die niets doet is erger dan een knop die er niet is.
16 var _leesbaar = _bc.indexOf('on-cirkel') < 0;
17%>
18<div class="view-switcher-wrap">
19 <div class="container">
20 <% if (typeof premiumUnlocked !== 'undefined' && premiumUnlocked && typeof agendaEnabled !== 'undefined' && agendaEnabled) {
21 var _sbA = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
22 %>
23 <div class="agenda-pill">
24 <a class="vs-agenda<%= _onShows ? ' is-active' : '' %>" href="<%= _sbA %>/shows" aria-label="Agenda — evenementen">
25 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>
26 <span><%= t('switch.agenda') %></span>
27 </a>
28 </div>
29 <% } %>
30 <% if (typeof hasCirkel !== 'undefined' && hasCirkel) {
31 var _onCirkel = (typeof bodyClass === 'string' && bodyClass.indexOf('on-cirkel') >= 0);
32 var _sb = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
33 %>
34 <div class="feed-scope" role="tablist" aria-label="Solo of cirkel">
35 <a class="feed-scope-btn<%= (!_neutral && !_onCirkel) ? ' is-active' : '' %>" href="<%= _sb %>/"
36 role="tab" aria-selected="<%= (!_neutral && !_onCirkel) ? 'true' : 'false' %>"><%= t('switch.solo') %></a>
37 <a class="feed-scope-btn<%= (!_neutral && _onCirkel) ? ' is-active' : '' %>" href="<%= _sb %>/cirkel"
38 role="tab" aria-selected="<%= (!_neutral && _onCirkel) ? 'true' : 'false' %>"><%= t('switch.circle') %></a>
39 </div>
40 <% } %>
41 <div class="view-switcher" role="tablist" aria-label="Weergave">
42 <button type="button" class="view-switch-btn" data-view="timeline" role="tab"
43 aria-selected="<%= (!_neutral && !(typeof site !== 'undefined' && site && site.feed_view_default === 'grid')) ? 'true' : 'false' %>">
44 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>
45 <span><%= t('switch.timeline') %></span>
46 </button>
47 <button type="button" class="view-switch-btn" data-view="grid" role="tab"
48 aria-selected="<%= (!_neutral && (typeof site !== 'undefined' && site && site.feed_view_default === 'grid')) ? 'true' : 'false' %>">
49 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>
50 <span><%= t('switch.grid') %></span>
51 </button>
52 <% if (_leesbaar) { %>
53 <%# Lezen is een gewone derde weergave: dezelfde berichten, andere vorm.
54 Dus een <button> met data-view, net als de andere twee -- dan doen de
55 gedelegeerde klik, localStorage en syncAria in shell.ejs hun werk al. %>
56 <button type="button" class="view-switch-btn" data-view="reader" role="tab"
57 aria-selected="false">
58 <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/></svg>
59 <span><%= t('switch.reader') %></span>
60 </button>
61 <% } %>
62 </div>
63 <% if (!_neutral) { %>
64 <div class="grid-cols-picker" aria-label="Aantal kolommen">
65 <button type="button" class="grid-cols-btn" data-cols="2" title="2 kolommen">2</button>
66 <button type="button" class="grid-cols-btn" data-cols="3" title="3 kolommen">3</button>
67 <button type="button" class="grid-cols-btn" data-cols="4" title="4 kolommen">4</button>
68 </div>
69 <% } %>
70 </div>
71</div>
Note: See TracBrowser for help on using the repository browser.