feat(web): add cover URL helper + fallback SVG data URL
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// Fallback cover — an inline SVG data URL showing a music-note glyph on the
|
||||
// surface color. Used by AlbumCard's onerror handler when the real cover
|
||||
// fails (e.g. scanner didn't pick up an embedded image and there's no
|
||||
// sidecar). Data URL avoids an extra HTTP round-trip.
|
||||
export const FALLBACK_COVER =
|
||||
'data:image/svg+xml;utf8,' +
|
||||
encodeURIComponent(
|
||||
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
||||
<rect width="100" height="100" fill="#1f1f23"/>
|
||||
<path d="M40 30v35a7 7 0 1 1-7-7 7 7 0 0 1 3 .7V35h22v8h-18z" fill="#6b6b70"/>
|
||||
</svg>`
|
||||
);
|
||||
|
||||
export function coverUrl(albumId: string): string {
|
||||
return `/api/albums/${albumId}/cover`;
|
||||
}
|
||||
Reference in New Issue
Block a user