From 64aec78a439a9649fc9fe72ab59f2eaef57afd1f Mon Sep 17 00:00:00 2001 From: Honey Date: Sun, 7 Jun 2026 21:31:54 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20artist=20hero=20redesign=20=E2=80=94=20?= =?UTF-8?q?album=20art=20banner=20+=20circular=20pfp=20on=20left?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- index.html | 2 +- src/views/detail.js | 33 +++++++++++++++++++++------------ styles.css | 20 +++++++++++--------- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/index.html b/index.html index ca29a87..6773f6f 100644 --- a/index.html +++ b/index.html @@ -153,7 +153,7 @@
-
+
diff --git a/src/views/detail.js b/src/views/detail.js index a0ab650..1a35850 100644 --- a/src/views/detail.js +++ b/src/views/detail.js @@ -71,7 +71,11 @@ export async function loadArtistDetail(artist) { const albEl = document.getElementById('artist-albums-section'); hero.style.background = 'linear-gradient(135deg, var(--surface2), var(--surface))'; hero.querySelector('.artist-hero-img')?.remove(); - hero.querySelector('.artist-hero-bg')?.remove(); + const heroBgEl = document.getElementById('artist-hero-bg'); + if(heroBgEl) heroBgEl.style.backgroundImage = ''; + document.getElementById('artist-hero-pfp-wrap')?.querySelector('.artist-hero-pfp')?.remove(); + const pfpInitial = document.getElementById('artist-hero-pfp-initial'); + if(pfpInitial) pfpInitial.textContent = artist.name?.[0]?.toUpperCase() || '?'; const overlay = hero.querySelector('.artist-hero-overlay'); if(overlay) overlay.style.background = ''; [bioEl, simEl, tsEl, albEl].forEach(el => { if(el) el.innerHTML = ''; }); @@ -109,18 +113,23 @@ export async function loadArtistDetail(artist) { // ── Hero ── const img = imgRes.status === 'fulfilled' ? imgRes.value : null; - if(img) { + const _firstAlbums = albumRes.status === 'fulfilled' ? (albumRes.value?.artist?.album || []) : []; + const _bgCover = _firstAlbums[0] ? coverUrl(_firstAlbums[0].coverArt, 512) : null; + if(_bgCover || img) { hero.style.background = ''; - const bgEl = document.createElement('div'); - bgEl.className = 'artist-hero-bg'; - bgEl.style.backgroundImage = `url('${img}')`; - hero.insertBefore(bgEl, overlay); - const heroImg = document.createElement('img'); - heroImg.className = 'artist-hero-img'; - heroImg.alt = ''; - heroImg.src = img; - hero.insertBefore(heroImg, overlay); - if(overlay) overlay.style.background = 'linear-gradient(to right,rgba(7,7,15,.95) 0%,rgba(7,7,15,.35) 55%,rgba(7,7,15,.75) 100%)'; + const bgEl = document.getElementById('artist-hero-bg'); + if(bgEl) bgEl.style.backgroundImage = `url('${_bgCover || img}')`; + if(overlay) overlay.style.background = 'linear-gradient(to top,rgba(7,7,15,.92) 0%,rgba(7,7,15,.35) 100%)'; + } + if(img) { + const pfpWrap = document.getElementById('artist-hero-pfp-wrap'); + if(pfpWrap) { + const pfpImg = document.createElement('img'); + pfpImg.className = 'artist-hero-pfp'; + pfpImg.alt = ''; + pfpImg.src = img; + pfpWrap.prepend(pfpImg); + } } // ── Bio ── diff --git a/styles.css b/styles.css index 7b15ce8..db86f42 100644 --- a/styles.css +++ b/styles.css @@ -822,17 +822,19 @@ button:focus{outline:none} .artist-action-btn{display:flex;align-items:center;gap:6px;padding:9px 18px;border-radius:20px;border:1px solid var(--border2);background:var(--surface);color:var(--text);font-family:var(--font);font-size:13px;font-weight:600;cursor:pointer;transition:background .15s,border-color .15s} .artist-action-btn:hover{background:var(--surface2);border-color:var(--accent);color:var(--accent)} .artist-hero{height:220px;border-radius:14px;overflow:hidden;position:relative;margin-bottom:24px;background:linear-gradient(135deg,var(--surface2),var(--surface))} -.artist-hero-overlay{position:absolute;inset:0;background:linear-gradient(to right,rgba(7,7,15,.85) 0%,transparent 100%);display:flex;align-items:flex-end;padding:20px 28px} -.artist-hero-name{font-size:32px;font-weight:800;letter-spacing:-1px} -.artist-hero-bg{display:none} -.artist-hero-img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:center center;display:block} +.artist-hero-bg{position:absolute;inset:0;background-size:cover;background-position:center;filter:blur(26px) brightness(0.22) saturate(0.5);transform:scale(1.1)} +.artist-hero-overlay{position:absolute;inset:0;display:flex;align-items:flex-end;padding:20px 22px;gap:14px} +.artist-hero-pfp-wrap{width:72px;height:72px;border-radius:50%;overflow:hidden;flex-shrink:0;border:2px solid rgba(255,255,255,.15);background:linear-gradient(135deg,var(--surface2),var(--surface3,var(--surface)));display:flex;align-items:center;justify-content:center;position:relative} +.artist-hero-pfp{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;border-radius:50%;display:block} +.artist-hero-pfp-initial{font-size:26px;font-weight:700;color:var(--text2);line-height:1;pointer-events:none} +.artist-hero-info{min-width:0;flex:1;padding-bottom:2px} +.artist-hero-name{font-size:26px;font-weight:800;letter-spacing:-0.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} @media(min-width:769px){ .artist-hero{height:320px;border-radius:16px} - .artist-hero-overlay{padding:28px 36px} - .artist-hero-name{font-size:46px;letter-spacing:-2px} - /* Desktop: blurred backdrop fills width, sharp portrait sits at natural proportions on the right */ - .artist-hero-bg{display:block;position:absolute;inset:0;background-size:cover;background-position:center;filter:blur(28px) brightness(0.3) saturate(0.7);transform:scale(1.08)} - .artist-hero-img{top:0;right:0;bottom:0;left:auto;width:auto;height:100%;object-fit:unset} + .artist-hero-overlay{padding:32px 36px;gap:22px} + .artist-hero-pfp-wrap{width:108px;height:108px} + .artist-hero-pfp-initial{font-size:42px} + .artist-hero-name{font-size:44px;letter-spacing:-2px} } /* ── MISC ── */