Changeset 3cd1aaa in Klonkt


Ignore:
Timestamp:
06/17/2026 12:03:39 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
44cf44d
Parents:
108fd5f
Message:

Hub: chrome in #pcms-chrome slot + out-of-band swap on htmx → header always correct, audio never jumps

The site chrome (topnav/profile header/view-switcher) now lives in a fixed
slot #pcms-chrome. On every htmx partial, render.js renders that chrome
out-of-band (chrome.ejs with oob=true) so htmx replaces it with the chrome
of the NEW page/artist — while the audio player (separate in document.body)
stays alive. Result: hub-home has no header (hero=header, empty slot), each
artist gets its own header (no stale "Studio Noord on Luna"), and music
never jumps on navigation. Solo/circle: chrome refreshes identically (no-op
in terms of content).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@…>

Location:
src
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/assets/css/style.css

    r108fd5f r3cd1aaa  
    20282028    margin-bottom: 1.5rem;
    20292029}
    2030 /* Hub-landing (body.on-hub): verberg de site-chrome. In hub-modus staan masthead
    2031    + view-switcher altijd in de DOM (zodat htmx tussen hub-home en artiest-sites
    2032    kan schakelen zonder full-reload); hier toggelen we hun zichtbaarheid. De
    2033    hub-home heeft z'n eigen kop/nav in de content. */
    2034 body.on-hub .masthead,
    2035 body.on-hub .view-switcher-wrap { display: none !important; }
    20362030.view-switcher {
    20372031    display: flex;
  • src/middleware/render.js

    r108fd5f r3cd1aaa  
    122122      }).replace(/[€-￿]/g, (ch) => '\\u' + ch.charCodeAt(0).toString(16).padStart(4, '0'));
    123123      res.setHeader('HX-Trigger-After-Settle', triggerJson);
    124       return res.send(pageContent);
     124      // Site-chrome out-of-band mee-renderen, zodat de kop (topnav/profielkop/
     125      // view-switcher) bij navigatie ALTIJD bij de nieuwe pagina/artiest hoort —
     126      // terwijl de audioplayer (los in document.body) blijft leven (geen
     127      // verspringen). htmx vervangt #pcms-chrome via hx-swap-oob. Niet kritisch:
     128      // faalt 't, dan blijft de oude chrome staan (geen crash).
     129      let oobChrome = '';
     130      try {
     131        oobChrome = await ejs.renderFile(
     132          path.join(VIEWS_DIR, 'partials', 'chrome.ejs'),
     133          { ...locals, oob: true },
     134          { async: false },
     135        );
     136      } catch (e) { /* chrome-OOB overslaan */ }
     137      return res.send(pageContent + oobChrome);
    125138    }
    126139
  • src/views/shell.ejs

    r108fd5f r3cd1aaa  
    263263<% } %>
    264264
    265 <%# Geen shell-chrome (masthead/profile-header/view-switcher/bottom-tab) op:
    266     - de hub-overview (on-hub): standalone landing, begint met de hero;
    267     - auth-pagina's (on-auth): focus-schermen voor in-/uitloggen.
    268     Die chrome hoort bij een Klonkt-site en verschijnt dus op /user/-pagina's. %>
    269 <% var _isHub  = (typeof tenancy !== 'undefined' && tenancy === 'hub'); %>
    270 <% var _onAuth = (typeof bodyClass === 'string' && bodyClass.indexOf('on-auth') >= 0); %>
    271 <% var bareChrome = (typeof bodyClass === 'string' && (bodyClass.indexOf('on-hub') >= 0 || bodyClass.indexOf('on-auth') >= 0))
    272      || (_isHub && !siteUrlBase && !isAdminPage); %>
    273 <%# In HUB-modus de chrome ALTIJD renderen (CSS verbergt 'm op de hub-landing via
    274     body.on-hub) zodat htmx tussen hub-home en artiest-sites kan schakelen zónder
    275     full-reload → de audioplayer blijft leven, geen verspringen. profile-header
    276     self-hidet als er geen site is. Solo/circle: ongewijzigd (!bareChrome). %>
    277 <% var renderChrome = _isHub ? !_onAuth : !bareChrome; %>
    278 
    279 <% if (renderChrome) { %>
    280   <%- include('partials/topnav') %>
    281   <%- include('partials/profile-header') %>
    282 <% } %>
    283 
    284 <%# View switcher — visible on every non-admin page. On feed pages
    285     (home, archive, tag, type, user) it toggles the visual layout;
    286     on non-feed pages (post, account, search, auth) it navigates to /
    287     in the chosen view. Click logic is in shell.ejs at the bottom. %>
    288 <% if (!isAdminPage && renderChrome) { %>
    289   <%- include('partials/view-switcher') %>
    290 <% } %>
     265<%# Site-chrome (topnav + profielkop + view-switcher) in één vaste slot #pcms-chrome.
     266    Bij htmx-navigatie wordt dit slot out-of-band ververst (zie chrome.ejs +
     267    render.js), zodat de kop ALTIJD bij de nieuwe pagina/artiest hoort terwijl de
     268    audioplayer (los in document.body) blijft leven → geen verspringen. Op de
     269    hub-landing is het slot leeg: de hero is daar de header. %>
     270<%- include('partials/chrome') %>
    291271
    292272<%# hx-history-elt scopes HTMX history snapshots to #pcms-main only, so
     
    360340    PAGE_CLASSES.forEach(function(c) { document.body.classList.remove(c); });
    361341    document.body.classList.add(firstClass);
    362     // 'on-hub' is een modifier náást de page-class: apart toggelen zodat de
    363     // hub-chrome (topnav/view-switcher) via CSS mee-schakelt bij htmx-navigatie
    364     // tussen hub-home (on-hub) en artiest-sites (geen on-hub).
    365     document.body.classList.toggle('on-hub', /(^|\s)on-hub(\s|$)/.test(String(next)));
    366342  });
    367343})();
Note: See TracChangeset for help on using the changeset viewer.