android: the whole discography, on a page of its own

The artist page already filed every release the desktop's way, but it only
ever showed one category at a time and it showed all of it: no slice anywhere
in that grid, so an artist with 140 releases drew 140 cards. There is a page
now — All in front of the categories, a sort, a grouping by year, and the
editions opened in place under their own record, which is the part a flat
list loses — and the grid behind it stops at twelve with the way down under
it. It is the same classifier twice over the same cached albums, which the
desktop cannot do because its filing waits on a background description
harvest; the three things its own page has and this one does not — a
tracklist per record, an accent sampled per cover, the scroll-led banner —
are 140 calls and 140 decodes over mobile data for rows that are one tap
away, and ANDROID.md says so rather than leaving them looking forgotten.

The list caps at sixty with the rest a button away, before the grouping, so
the last year on screen can be a part of itself; under a name order By year
is not offered, because the years would repeat out of sequence. The mock
gains a 140-record artist so both caps are walked rather than argued about.
This commit is contained in:
KeelrLeek committed 2026-09-14 03:41:16 -05:00
1 parent 1258b2b78d
commit f2cde4ec7c
9 files changed
+491 -12

No files matched your search

+58
View File
@@ -92,3 +92,61 @@ export const SOCIAL_LABEL = {
youtube: "YouTube", instagram: "Instagram", twitter: "X", x: "X", facebook: "Facebook", tiktok: "TikTok",
spotify: "Spotify", apple: "Apple Music", discogs: "Discogs", lastfm: "Last.fm", musicbrainz: "MusicBrainz",
};
/* ── the whole discography, on a page of its own ─────────────────────────
The artist page's tabs are one lane per category; the discography page is
the same filing seen whole. Both read ONE classifier, and it is this one.
The desktop cannot do that: CatalogDiscography.svelte takes the artist
page's already-computed tab list as the same array object, because the
desktop's filing depends on a background description harvest and on
deferred MusicBrainz type hints that a re-run would not read
(CatalogDiscography.svelte:28-46). `discoTabs` here is pure and reads only
what the catalog page carries, so the phone simply calls it twice over the
same cached albums and the two pages can never disagree. */
/** "All" in front of the categories — built by CONCATENATING the per-category
* families, never by re-folding the whole set. A single that shares an
* album's base title (Pond released "Terrestrials" in 2026 as an album AND
* as a single) would fold into it as a phantom edition, and one of the two
* would vanish from its own tab. */
export function allTabs(tabs) {
const ts = tabs || [];
if (!ts.length) return [];
return [{ key: "all", label: "All", items: ts.flatMap((t) => t.items) }, ...ts];
}
/** The four orders the page offers, and what each is called. The sort sheet
* in HalfSheet.svelte writes the same four out inline — it is edited by
* every other round and a new import there is a collision waiting to
* happen — so if a label changes it changes in both places. */
export const ORDER_LABEL = { new: "Newest first", old: "Oldest first", az: "A–Z", za: "Z–A" };
/** The desktop's sort (CatalogDiscography.svelte:71-78): dates on
* `release_date`, names on the title, either direction. */
export function orderFamilies(items, order) {
const list = [...(items || [])];
const byName = order === "az" || order === "za";
list.sort((a, b) => (byName
? (a.title ?? "").localeCompare(b.title ?? "")
: (a.release_date ?? "").localeCompare(b.release_date ?? "")));
return order === "new" || order === "za" ? list.reverse() : list;
}
/** [{ key: "2001", items }] — the year headers, cut out of the list in the
* order it is already in rather than re-sorted, which is why a name order
* must not be grouped: the years would repeat out of sequence. `on` false
* gives the whole list back under one null key, so the caller renders one
* loop either way. */
export function byYear(items, on) {
const list = items || [];
if (!on) return list.length ? [{ key: null, items: list }] : [];
const out = [];
for (const r of list) {
const y = String(r.release_date || "").slice(0, 4) || "—";
const last = out[out.length - 1];
if (last && last.key === y) last.items.push(r);
else out.push({ key: y, items: [r] });
}
return out;
}