feat(library): surface metadata enrichment status, errors and covers
The mapper dropped metadata_status and hardcoded availability, so enrichment state was invisible and a just-uploaded track never appeared to change. Map metadata_status/metadata_error/has_cover onto Track; add MetadataStatusBadge (pending spinner / enriched / failed-with-reason / manual) shown in TrackRow, and serve token-bearing track covers via getTrackCoverUrl. UploadPage now polls each uploaded track (stops once enrichment settles) so the resolved title/artist — or a failure reason — appears live. i18n in en + ru. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -17,3 +17,18 @@ export function getCoverUrl(artUrl: string | undefined): string | undefined {
|
||||
const base = getApiBaseUrl();
|
||||
return `${base}${artUrl}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cover image URL for a track, served by `GET /tracks/{id}/cover`. Like the
|
||||
* audio stream, an `<img>` can't send an `Authorization` header, so the access
|
||||
* token rides as `?token=`. Returns undefined when the track has no cover.
|
||||
*/
|
||||
export function getTrackCoverUrl(
|
||||
trackId: string,
|
||||
token: string,
|
||||
hasCover: boolean,
|
||||
): string | undefined {
|
||||
if (!hasCover) return undefined;
|
||||
const base = getApiBaseUrl();
|
||||
return `${base}/tracks/${trackId}/cover?token=${encodeURIComponent(token)}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user