forked from Keelrleek/SoulStream
overlay + library: the preloader working on glass, album names that land on the right self-titled record, and covers warmed before you scroll to them
This commit is contained in:
1 parent
ad2c912b71
commit
6a7a5c49c0
7 files changed
+534
-39
No files matched your search
@@ -35,6 +35,7 @@
|
||||
getCatalogArtistPage,
|
||||
openCatalogArtist,
|
||||
openCatalogAlbum,
|
||||
openAlbumByName,
|
||||
RECENTS_FLOOR_SECS,
|
||||
recentsStore,
|
||||
importResume,
|
||||
@@ -778,9 +779,19 @@
|
||||
const wanted = album.id;
|
||||
try {
|
||||
const page = await getCatalogArtistPage(anchored.artistId);
|
||||
const match = (page?.albums ?? []).find(
|
||||
// Same-titled records collapse to one normalized key (American
|
||||
// Football × 3, Weezer × 7). The artist page's rows are dated, so
|
||||
// the local folder's year picks the right one; only then does the
|
||||
// first row stand in.
|
||||
const same = (page?.albums ?? []).filter(
|
||||
(r) => normKey(r.title) === normKey(album.title),
|
||||
);
|
||||
const match =
|
||||
(album.year != null
|
||||
&& same.find((r) =>
|
||||
String(r.release_date ?? "").startsWith(String(album.year)),
|
||||
))
|
||||
|| same[0];
|
||||
if (openId === wanted && match) openCatalogId = match.id;
|
||||
} catch { /* no link; the title stays plain */ }
|
||||
}
|
||||
@@ -1610,17 +1621,24 @@
|
||||
{/if}
|
||||
</button>
|
||||
<!-- The name opens the record's own page, as it does
|
||||
on the artist page — but only once the local
|
||||
folder has been joined to a catalogue row. Until
|
||||
then (or for an artist with no anchored id) it
|
||||
stays plain text rather than a link that would
|
||||
have to guess where it goes. -->
|
||||
on the artist page. An anchored (followed)
|
||||
artist's join gives the id up front; otherwise
|
||||
the click resolves through openAlbumByName —
|
||||
the now-playing links' guarded resolver, which
|
||||
verifies artist AND title (never guesses) and
|
||||
stays put on a settled miss. Plain text only
|
||||
when the row has no artist+title to resolve. -->
|
||||
<h3 class="rail-title">
|
||||
{#if openCatalogId != null}
|
||||
{#if openCatalogId != null || (openAlbum?.artist && openAlbum?.title)}
|
||||
<button
|
||||
class="rail-title-link"
|
||||
title="Open album"
|
||||
onclick={() => openCatalogAlbum(openCatalogId)}
|
||||
onclick={() =>
|
||||
openCatalogId != null
|
||||
? openCatalogAlbum(openCatalogId)
|
||||
: openAlbumByName(openAlbum.artist, openAlbum.title, {
|
||||
year: openAlbum.year ?? null,
|
||||
})}
|
||||
>{openAlbum?.title ?? ""}</button>
|
||||
{:else}
|
||||
<span class="rail-title-text">{openAlbum?.title ?? ""}</span>
|
||||
|
||||
Reference in new issue
Block a user