source: Klonkt/src/views/partials/view-switcher.ejs@ 2c22bb5

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

feat(cirkel): rebuild the Cirkel feed on ActivityPub (featured/auto-boosted artists)

Phase 2 of the Cirkels-on-AP rework. /cirkel now shows posts from the accounts a
site auto-boosts ("feature an artist"), sourced from ap_timeline ⋈ ap_following
(auto_boost=1); cards link to the source post. The Solo|Cirkel switcher shows
whenever the site has a cirkel (new hasCirkel local) instead of only on
circle-tenancy. Legacy circle-tenancy remote_posts are merged in until the old
pull-protocol is removed (Phase 4). New: autoBoostCount / getCirkelPosts /
getCirkelMembers.

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

  • Property mode set to 100644
File size: 4.1 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%>
13<div class="view-switcher-wrap">
14 <div class="container">
15 <% if (typeof premiumUnlocked !== 'undefined' && premiumUnlocked && typeof agendaEnabled !== 'undefined' && agendaEnabled) {
16 var _sbA = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
17 %>
18 <div class="agenda-pill">
19 <a class="vs-agenda<%= _onShows ? ' is-active' : '' %>" href="<%= _sbA %>/shows" aria-label="Agenda — evenementen">
20 <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>
21 <span><%= t('switch.agenda') %></span>
22 </a>
23 </div>
24 <% } %>
25 <% if (typeof hasCirkel !== 'undefined' && hasCirkel) {
26 var _onCirkel = (typeof bodyClass === 'string' && bodyClass.indexOf('on-cirkel') >= 0);
27 var _sb = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : '';
28 %>
29 <div class="feed-scope" role="tablist" aria-label="Solo of cirkel">
30 <a class="feed-scope-btn<%= (!_neutral && !_onCirkel) ? ' is-active' : '' %>" href="<%= _sb %>/"
31 role="tab" aria-selected="<%= (!_neutral && !_onCirkel) ? 'true' : 'false' %>"><%= t('switch.solo') %></a>
32 <a class="feed-scope-btn<%= (!_neutral && _onCirkel) ? ' is-active' : '' %>" href="<%= _sb %>/cirkel"
33 role="tab" aria-selected="<%= (!_neutral && _onCirkel) ? 'true' : 'false' %>"><%= t('switch.circle') %></a>
34 </div>
35 <% } %>
36 <div class="view-switcher" role="tablist" aria-label="Weergave">
37 <button type="button" class="view-switch-btn" data-view="timeline" role="tab"
38 aria-selected="<%= (!_neutral && !(typeof site !== 'undefined' && site && site.feed_view_default === 'grid')) ? 'true' : 'false' %>">
39 <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>
40 <span><%= t('switch.timeline') %></span>
41 </button>
42 <button type="button" class="view-switch-btn" data-view="grid" 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"><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>
45 <span><%= t('switch.grid') %></span>
46 </button>
47 </div>
48 <% if (!_neutral) { %>
49 <div class="grid-cols-picker" aria-label="Aantal kolommen">
50 <button type="button" class="grid-cols-btn" data-cols="2" title="2 kolommen">2</button>
51 <button type="button" class="grid-cols-btn" data-cols="3" title="3 kolommen">3</button>
52 <button type="button" class="grid-cols-btn" data-cols="4" title="4 kolommen">4</button>
53 </div>
54 <% } %>
55 </div>
56</div>
Note: See TracBrowser for help on using the repository browser.