feat(home): Because you listened recommendation rail (#489)

* feat(home): "Because you listened" recommendation rail

New Home rail (under Recently Added, default on, toggleable in Settings →
Personalisation → Home Page) that surfaces 3 albums from artists similar
to one of your top-played artists. Anchor rotates per Home mount so a
different top-artist seeds the recommendations each visit; within each
anchor, both the similar-artist subset and the chosen album per artist
are randomised, so the same anchor returns different picks on subsequent
visits.

Card layout matches the regular Album cards' surface (--bg-card with
accent-tinted border + 1px inset top highlight) and gets the same
Play / Enqueue hover overlay buttons. Cover and meta scale via CSS only
— no infinite animations, no filter/blur/transform, no compositing
layers. Grid wraps below 3-up at <400px card width instead of shrinking.

API budget: one getArtistInfo2 + 6 parallel getArtist calls per Home
mount, both reusing the existing mostPlayed payload to derive the anchor
pool (no extra API call to find top artists). All 8 locales seeded.

* fix(home): ru plurals + per-server anchor + narrower card grid

- ru: add _few / _many for becauseYouLikeTracks (CLDR Russian needs
  4 forms — 3 треков was wrong, now 3 трека).
- Anchor rotation memory is now per-server. The localStorage key
  becomes psysonic_because_anchor:<serverId>; switching servers no
  longer aliases server A's rotation onto server B's pool.
- because-card grid minmax(400px, 1fr) -> minmax(340px, 1fr) so two
  cards fit side by side at typical sidebar-expanded widths instead
  of collapsing to a single card per row.

* docs: CHANGELOG + Contributors entry for Because-you-listened rail (PR #489)

* style(home): blurred cover backdrop + centred layout for Because-cards

- Each Because-card renders the album cover as a blurred, low-opacity
  full-bleed background layer behind the existing cover thumb and text.
  Resolved through useCachedUrl so the cache layer feeds it (same key
  as the thumbnail) instead of a fresh salted URL on every render.
- Card content (cover thumb + text block) now centred horizontally and
  vertically within the card; the meta line lives in a small pill that
  sits centred under the artist row.
- Text contrast halo and meta-pill background are theme-aware via
  color-mix on var(--bg-card) / var(--text-primary), so the same rules
  read on dark and light themes (was hard-coded rgba black before and
  smudged the type on Latte / Nord Snowstorm).
This commit is contained in:
Frank Stellmacher
2026-05-07 02:28:58 +02:00
committed by GitHub
parent 5b37ab70f1
commit d1ff2fab51
14 changed files with 492 additions and 8 deletions
+157
View File
@@ -13902,3 +13902,160 @@ html[data-perf-disable-home-artwork-clip="true"] .home-lite-artwork .song-card-c
color: var(--text-muted, #888);
letter-spacing: 0.02em;
}
/* Because-you-like rail performance-conscious by design.
No filter/blur/transform animations (WebKitGTK / software-compositing friendly). */
.because-card-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
gap: 1rem;
}
.because-card {
position: relative;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
gap: 1.25rem;
padding: 1rem;
background: var(--bg-card);
border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border-subtle));
border-radius: 10px;
text-align: left;
cursor: pointer;
color: inherit;
font: inherit;
min-height: 220px;
box-shadow: 0 1px 0 0 color-mix(in srgb, var(--accent) 25%, transparent) inset;
transition: background-color 160ms ease, border-color 160ms ease;
}
.because-card-bg {
position: absolute;
inset: 0;
background-size: cover;
background-position: center;
filter: blur(28px);
opacity: 0.22;
transform: scale(1.2);
z-index: 0;
pointer-events: none;
}
.because-card > :not(.because-card-bg) {
position: relative;
z-index: 1;
}
.because-card-text {
/* Theme-aware contrast halo — dark glow on dark themes, light on light. */
text-shadow:
0 0 2px color-mix(in srgb, var(--bg-card) 90%, transparent),
0 0 4px color-mix(in srgb, var(--bg-card) 70%, transparent),
0 1px 4px color-mix(in srgb, var(--bg-card) 55%, transparent);
}
.because-card:hover {
background: var(--bg-hover, var(--bg-card));
border-color: var(--accent, var(--border-subtle));
}
.because-card:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.because-card-cover-wrap {
position: relative;
flex: 0 0 auto;
width: 200px;
height: 200px;
border-radius: 6px;
overflow: hidden;
background: var(--bg-input, rgba(0, 0, 0, 0.15));
}
.because-card-cover {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.because-card-cover-placeholder {
display: block;
}
.because-card:hover .album-card-play-overlay {
opacity: 1;
}
.because-card-text {
flex: 1 1 auto;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
gap: 0.5rem;
min-width: 0;
padding: 0.25rem 0;
}
.because-card-top {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
gap: 0.35rem;
min-width: 0;
}
.because-card-similar {
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--accent, var(--text-muted, #888));
font-weight: 700;
}
.because-card-title {
font-size: 20px;
font-weight: 700;
line-height: 1.2;
color: var(--text-primary, inherit);
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
.because-card-artist {
font-size: 15px;
color: var(--text-secondary, inherit);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.because-card-pills {
display: flex;
flex-wrap: wrap;
gap: 0.4rem;
}
.because-card-pill {
padding: 2px 10px;
border: 1px solid var(--border-subtle);
border-radius: 999px;
font-size: 11px;
color: var(--text-secondary, inherit);
white-space: nowrap;
}
.because-card-pill-type {
border-color: color-mix(in srgb, var(--accent, currentColor) 50%, transparent);
color: var(--accent, var(--text-secondary, inherit));
}
.because-card-meta {
align-self: center;
justify-content: center;
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
font-size: 12px;
color: var(--text-primary, var(--text-secondary, inherit));
background: color-mix(in srgb, var(--text-primary) 14%, transparent);
padding: 3px 10px;
border-radius: 999px;
text-shadow: none;
}
.because-card-meta > span:not(:last-child)::after {
content: '·';
margin-left: 0.75rem;
opacity: 0.5;
}