Changeset 1b99225 in Klonkt for src/views/partials/profile-header.ejs
- Timestamp:
- 06/27/2026 12:57:02 AM (2 months ago)
- Branches:
- main
- Children:
- e390844
- Parents:
- 16e99e5
- File:
-
- 1 edited
-
src/views/partials/profile-header.ejs (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/views/partials/profile-header.ejs
r16e99e5 r1b99225 26 26 try { _profileLinks = JSON.parse(site.profile_links) || []; } catch (e) { _profileLinks = []; } 27 27 } 28 29 // Profile-summary (lightbox) helpers — used by the avatar + the summary modal. 30 const _base = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : ''; 31 const _avatarUrl = (site && site.profile_photo) || ((typeof siteOwnerAvatar !== 'undefined' && siteOwnerAvatar) || ''); 32 const _platforms = (typeof platforms_catalog !== 'undefined' && platforms_catalog) || {}; 33 const _linkHref = function (p, u) { u = String(u || '').trim(); if (p === 'email' && u && u.indexOf('mailto:') !== 0) return 'mailto:' + u; if (p === 'phone' && u && !/^tel:/i.test(u)) return 'tel:' + u.replace(/[^\d+]/g, ''); return u; }; 34 const _linkVal = function (u) { return String(u || '').replace(/^(mailto:|tel:|https?:\/\/)/i, '').replace(/\/$/, ''); }; 35 const _isPrem = (typeof isPremium !== 'undefined' && isPremium); 36 let _sinceStr = ''; try { if (site && site.created_at) _sinceStr = new Date(site.created_at).toLocaleDateString('nl-NL', { day: '2-digit', month: 'short', year: 'numeric' }); } catch (e) {} 28 37 %> 29 38 … … 32 41 <div class="container profile-header-inner"> 33 42 34 <% var _base = (typeof siteUrlBase !== 'undefined' && siteUrlBase) ? siteUrlBase : ''; %>35 <% var _avatarUrl = site.profile_photo || ((typeof siteOwnerAvatar !== 'undefined' && siteOwnerAvatar) || ''); %>36 43 <% if (_avatarUrl) { %> 37 <%# With a real photo: clicking opens a lightbox (enlarged view) instead of going home. %>38 <button type="button" class="profile-photo" data- lightbox="<%= _avatarUrl %>" aria-label="<%= _displayName || 'Profile photo' %>">44 <%# With a real photo: clicking opens the profile-summary modal (photo + details). %> 45 <button type="button" class="profile-photo" data-pf-summary aria-label="<%= _displayName || 'Profile' %>"> 39 46 <img src="<%= _avatarUrl %>" alt=""> 40 47 </button> … … 104 111 </div> 105 112 </aside> 113 114 <%# Profile-summary modal — opened by clicking the avatar. Shows photo + title + subtitle 115 + contact details + start date + premium status. %> 116 <% if (_avatarUrl) { %> 117 <div class="pf-summary"> 118 <div class="pf-summary-card" role="dialog" aria-label="<%= _displayName %>"> 119 <button type="button" class="pf-summary-close" aria-label="Sluiten">×</button> 120 <img class="pf-summary-photo" src="<%= _avatarUrl %>" alt=""> 121 <h3 class="pf-summary-name"><%= _displayName %></h3> 122 <span class="pf-summary-prem<%= _isPrem ? ' is-prem' : '' %>"><%= _isPrem ? '★ Premium' : t('profile.free') %></span> 123 <% if (_bioText) { %><p class="pf-summary-bio"><%= _bioText %></p><% } %> 124 <% if (_profileLinks.length) { %> 125 <ul class="pf-summary-links"> 126 <% _profileLinks.forEach(function (l) { var meta = _platforms[l.platform]; if (!meta) return; var href = _linkHref(l.platform, l.url); var ext = (l.platform !== 'email' && l.platform !== 'phone'); %> 127 <li> 128 <a href="<%= href %>" <% if (ext) { %>target="_blank" rel="noopener noreferrer"<% } %> style="--brand: <%= meta.brand %>"> 129 <span class="pf-summary-ico" aria-hidden="true"><%- meta.svg %></span> 130 <span class="pf-summary-rowtext"><span class="pf-summary-lbl"><%= meta.label %></span><span class="pf-summary-val"><%= _linkVal(l.url) %></span></span> 131 </a> 132 </li> 133 <% }); %> 134 </ul> 135 <% } %> 136 <% if (_sinceStr) { %><p class="pf-summary-since"><%= t('profile.since') %> <%= _sinceStr %></p><% } %> 137 </div> 138 </div> 139 <% } %> 106 140 <script> 107 141 (function () { … … 121 155 })(); 122 156 123 /* Lightbox: click the profile photo to see it enlarged. */157 /* Profile summary: click the avatar to open a modal with photo + details. */ 124 158 (function () { 125 159 if (window.__pcmsLightboxWired) return; window.__pcmsLightboxWired = true; 126 var lb = null; 127 function close(){ if (lb) lb.classList.remove('is-open'); } 160 function close() { var m = document.querySelector('.pf-summary.is-open'); if (m) m.classList.remove('is-open'); } 128 161 document.addEventListener('click', function (e) { 129 var t = e.target.closest && e.target.closest('.profile-photo[data-lightbox]'); 162 if (e.target.closest && e.target.closest('.pf-summary-close')) { e.preventDefault(); close(); return; } 163 var open = document.querySelector('.pf-summary.is-open'); 164 if (open && e.target === open) { close(); return; } /* click on backdrop */ 165 var t = e.target.closest && e.target.closest('.profile-photo[data-pf-summary]'); 130 166 if (!t) return; 131 167 e.preventDefault(); 132 var url = t.getAttribute('data-lightbox'); if (!url) return; 133 if (!lb) { 134 lb = document.createElement('div'); lb.className = 'pcms-lightbox'; 135 lb.innerHTML = '<img alt=""><button type="button" class="pcms-lightbox-close" aria-label="Sluiten">×</button>'; 136 document.body.appendChild(lb); 137 lb.addEventListener('click', function (ev) { if (ev.target === lb || (ev.target.closest && ev.target.closest('.pcms-lightbox-close'))) close(); }); 138 } 139 lb.querySelector('img').src = url; 140 lb.classList.add('is-open'); 168 var root = (t.closest && t.closest('#pcms-chrome')) || document; 169 var modal = root.querySelector('.pf-summary') || document.querySelector('.pf-summary'); 170 if (modal) modal.classList.add('is-open'); 141 171 }); 142 172 document.addEventListener('keydown', function (e) { if (e.key === 'Escape') close(); }); … … 313 343 .profile-fedi-link svg { width: 22px; height: 22px; } 314 344 315 /* Profile-photo lightbox overlay */ 316 .pcms-lightbox { position: fixed; inset: 0; z-index: 2147483600; display: none; 345 /* Profile-summary modal (click the avatar) */ 346 .profile-photo[data-pf-summary] { cursor: zoom-in; } 347 .pf-summary { position: fixed; inset: 0; z-index: 2147483600; display: none; 317 348 align-items: center; justify-content: center; padding: 4vmin; 318 background: rgba(0,0,0,.86); cursor: zoom-out; } 319 .pcms-lightbox.is-open { display: flex; } 320 .pcms-lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 12px; 321 box-shadow: 0 10px 50px rgba(0,0,0,.55); cursor: default; } 322 .pcms-lightbox-close { position: fixed; top: 1rem; right: 1.1rem; width: 44px; height: 44px; 323 border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; 324 font-size: 1.9rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; } 325 .pcms-lightbox-close:hover { background: rgba(255,255,255,.26); } 349 background: rgba(0,0,0,.7); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); } 350 .pf-summary.is-open { display: flex; } 351 .pf-summary-card { position: relative; width: 100%; max-width: 380px; max-height: 90vh; overflow-y: auto; 352 background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: 20px; 353 padding: 1.75rem 1.5rem; box-shadow: 0 20px 60px rgba(0,0,0,.4); text-align: center; } 354 .pf-summary-close { position: absolute; top: .6rem; right: .7rem; width: 36px; height: 36px; border: 0; 355 border-radius: 50%; background: var(--paper-2); color: var(--ink-soft); font-size: 1.5rem; line-height: 1; 356 cursor: pointer; display: flex; align-items: center; justify-content: center; } 357 .pf-summary-close:hover { color: var(--ink); } 358 .pf-summary-photo { width: 110px; height: 110px; border-radius: 50%; object-fit: cover; margin: 0 auto .9rem; 359 display: block; border: 3px solid var(--paper-2); background: #fff; } 360 .pf-summary-name { font-family: var(--font-display, serif); font-size: 1.4rem; margin: 0 0 .35rem; } 361 .pf-summary-prem { display: inline-block; margin: 0 0 .7rem; padding: .15rem .6rem; border-radius: 999px; 362 font-size: .75rem; font-weight: 600; background: var(--paper-2); color: var(--ink-soft); } 363 .pf-summary-prem.is-prem { background: color-mix(in srgb, #e8b04b 22%, transparent); color: #b8860b; } 364 .pf-summary-bio { color: var(--ink-soft); font-size: .92rem; line-height: 1.5; margin: 0 0 1rem; } 365 .pf-summary-links { list-style: none; padding: 0; margin: .25rem 0 1rem; display: flex; flex-direction: column; gap: .4rem; text-align: left; } 366 .pf-summary-links a { display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem; border-radius: 12px; 367 text-decoration: none; color: var(--ink); background: var(--paper-2); transition: background .12s; } 368 .pf-summary-links a:hover { background: color-mix(in srgb, var(--brand, var(--accent)) 16%, var(--paper-2)); } 369 .pf-summary-ico { flex: 0 0 22px; width: 22px; height: 22px; color: var(--brand, var(--ink-soft)); display: inline-flex; } 370 .pf-summary-ico svg { width: 22px; height: 22px; } 371 .pf-summary-rowtext { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; } 372 .pf-summary-lbl { font-size: .72rem; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; } 373 .pf-summary-val { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } 374 .pf-summary-since { color: var(--ink-soft); font-size: .8rem; margin: 0; } 326 375 </style>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)