openvibers/openvibe.network Commits

/my: a long name shrinks to fit its line instead of breaking mid-word (#639)

OP OpenVibers committed 6 days ago · deba7e0268 · 2 files, +7 −3

Changes

ddiff --git a/public/css/my.css b/public/css/my.css
iindex 4d951edb..efee9458 100644
---- a/public/css/my.css
++++ b/public/css/my.css
@@@ -532,10 +532,11 @@ button.td-stat:hover span { color: var(--accent-light); }
.me-who { display: flex; align-items: center; gap: 20px; min-width: 0; flex: 1 1 320px; }
.me-face { flex: none; padding: 4px; border-radius: 50%; background: conic-gradient(from 210deg, var(--me), color-mix(in srgb, var(--me) 30%, var(--accent)), var(--me)); box-shadow: 0 10px 30px color-mix(in srgb, var(--me) 35%, transparent); }
.me-face .avatar { display: block; width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 4px solid var(--bg-card); background: var(--bg-card); }
--.me .info { min-width: 0; }
++.me .info { min-width: 0; flex: 1 1 auto; container-type: inline-size; }
.me .greeting { font-size: 13px; font-weight: 700; letter-spacing: .04em; color: color-mix(in srgb, var(--me) 55%, var(--text-secondary)); margin-bottom: 2px; }
.me .greeting:empty, .me .badges:empty { display: none; }
--.me h1 { margin: 0; font-size: clamp(28px, 4.2vw, 42px); line-height: 1.08; font-weight: 850; letter-spacing: -.025em; overflow-wrap: anywhere; }
++/* A long name shrinks to fit its line (down to 20 px) before it breaks mid-word; --me-len is its longest word (profile.js). */
++.me h1 { margin: 0; font-size: max(20px, min(clamp(28px, 4.2vw, 42px), calc(100cqi / (var(--me-len, 9) * .58)))); line-height: 1.08; font-weight: 850; letter-spacing: -.025em; overflow-wrap: anywhere; }
.me .subtitle { margin-top: 4px; font-size: 14px; color: var(--text-secondary); }
.me .badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.me-money { display: grid; gap: 8px; padding: 14px 18px; border-radius: 20px; min-width: 250px; flex: 0 1 auto;
ddiff --git a/public/js/my/profile.js b/public/js/my/profile.js
iindex 47684695..d4ea6323 100644
---- a/public/js/my/profile.js
++++ b/public/js/my/profile.js
@@@ -136,7 +136,10 @@ function renderHeader(user) {
const fallback = avatarPlaceholder(user, 96);
avatar.src = avatarSrc(user, 96);
avatar.onerror = () => { avatar.src = fallback; };
-- document.getElementById('user-name').textContent = user.display_name || user.username;
++ const nameEl = document.getElementById('user-name');
++ nameEl.textContent = user.display_name || user.username;
++ // The longest word, so a long name shrinks to fit its line instead of breaking mid-word (my.css).
++ nameEl.style.setProperty('--me-len', String(Math.max(1, ...String(nameEl.textContent).split(/\s+/).map((w) => w.length))));
document.getElementById('user-subtitle').textContent = user.is_anon
? `Anonymous identity${user.anon_number ? ' · #' + user.anon_number : ''}`
: '@' + user.username; // never the email: this page may be on a stream (it is in Profile below)