Changeset 441f5d6 in Klonkt


Ignore:
Timestamp:
06/17/2026 04:02:46 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
c50f22e
Parents:
125e0e1
Message:

Login navigation via htmx (audio no longer jumps when opening login)

Navigating TO the login page now goes via htmx instead of a full load → the
audio player stays alive (no jump). The login itself (form submit) deliberately
remains a full load (choice: only the navigate-to-login is smooth).

For this to work, on-auth also needed to work via htmx:

  • pcmsNav now applies ALL page-classes sent along (not just the first one), and on-auth is in PAGE_CLASSES → the login focus screen gets its styling via htmx.
  • body.on-auth .bottom-tab { display:none } → hide the tab from the previous page (which stays alive under htmx nav), just as clean as a full-load login.
  • Login links (bottom-tab + topnav) get hx-get.

CSS cache-buster v9.

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

Location:
src
Files:
4 edited

Legend:

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

    r125e0e1 r441f5d6  
    265265}
    266266::-webkit-scrollbar-corner { background: transparent; }
     267
     268/* Login/auth = focus-scherm. Bij htmx-navigatie naar login blijft de bottom-tab
     269   uit de vorige pagina in de DOM staan → hier verbergen zodat het login-scherm
     270   net zo "kaal" is als bij een full-load (waar de tab niet eens gerenderd wordt). */
     271body.on-auth .bottom-tab { display: none; }
    267272body:not(.admin) {
    268273    min-height: 100dvh;
  • src/views/partials/bottom-tab.ejs

    r125e0e1 r441f5d6  
    111111    <a class="bottom-tab-item<%= _active === 'login' ? ' is-active' : '' %>"
    112112       href="/auth/login"
     113       hx-get="/auth/login?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
     114       hx-push-url="/auth/login" hx-indicator="#pcms-loading"
    113115       aria-label="Inloggen">
    114116      <svg class="bottom-tab-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
  • src/views/partials/topnav.ejs

    r125e0e1 r441f5d6  
    147147        </details>
    148148      <% } else { %>
    149         <a class="nav-link" href="/auth/login">
     149        <a class="nav-link" href="/auth/login"
     150           hx-get="/auth/login?partial=1" hx-target="#pcms-main" hx-swap="innerHTML"
     151           hx-push-url="/auth/login" hx-indicator="#pcms-loading">
    150152          <span class="nav-label">Inloggen</span>
    151153        </a>
  • src/views/shell.ejs

    r125e0e1 r441f5d6  
    163163
    164164<!-- v9 stylesheet (full palette system) -->
    165 <link rel="stylesheet" href="/assets/css/style.css?v=8">
     165<link rel="stylesheet" href="/assets/css/style.css?v=9">
    166166
    167167<!-- Audio player styles: loaded on every page so the mini-player works
     
    325325<script>
    326326(function() {
    327   // The set of mutually-exclusive page-context body classes. When pcmsNav
    328   // fires we strip ALL of these and apply just the one the server told us.
    329   var PAGE_CLASSES = ['on-home','on-post','on-special','on-archive','on-search','on-admin'];
     327  // De page-context body-classes. Bij pcmsNav strippen we ze allemaal en zetten
     328  // we opnieuw wat de server stuurde. 'on-auth' staat erbij zodat het login-
     329  // focusscherm óók via htmx z'n styling krijgt (geen chrome, geen tab, audio op 0).
     330  var PAGE_CLASSES = ['on-home','on-post','on-special','on-archive','on-search','on-admin','on-auth'];
    330331
    331332  document.body.addEventListener('pcmsNav', function(ev) {
     
    348349    var next = d.bodyClass;
    349350    if (!next) return;
    350     // Server may send a multi-class string ("on-post extra"). Only the first
    351     // page-class is what we care about — strip and replace.
    352     var firstClass = String(next).split(/\s+/).find(function(c) {
     351    // De server kan meerdere page-classes sturen ("on-special on-auth"). Strip
     352    // alle bekende en zet ALLE meegestuurde page-classes terug (niet alleen de
     353    // eerste) — anders mist 'on-auth' bij htmx-nav en blijft het login-scherm
     354    // de chrome/tab van de vorige pagina houden.
     355    var matched = String(next).split(/\s+/).filter(function(c) {
    353356      return PAGE_CLASSES.indexOf(c) >= 0;
    354357    });
    355     if (!firstClass) return;
     358    if (!matched.length) return;
    356359    PAGE_CLASSES.forEach(function(c) { document.body.classList.remove(c); });
    357     document.body.classList.add(firstClass);
     360    matched.forEach(function(c) { document.body.classList.add(c); });
    358361  });
    359362})();
Note: See TracChangeset for help on using the changeset viewer.