Add animation to reveal album cover

master
Araozu 2024-05-29 18:16:06 -05:00
parent 34e024979f
commit f453ff1a16
2 changed files with 2 additions and 3 deletions

View File

@ -95,7 +95,6 @@ func loadAlbumCover(albumId string) {
imgBytes := response.Body() imgBytes := response.Body()
// Write the image to cache // Write the image to cache
log.Printf("write %s: %+v", albumId, imgBytes[:10])
err = os.WriteFile(albumCacheFile, imgBytes, 0644) err = os.WriteFile(albumCacheFile, imgBytes, 0644)
if err != nil { if err != nil {
coverInfo.Error = errors.New("error writing album cover to disk") coverInfo.Error = errors.New("error writing album cover to disk")
@ -130,6 +129,5 @@ func (a *App) GetAlbumCover(albumId string) ([]byte, error) {
return nil, errors.New("error reading cover file") return nil, errors.New("error reading cover file")
} }
log.Printf("%s : %+v", albumId, bytes[:10])
return bytes, nil return bytes, nil
} }

View File

@ -37,10 +37,11 @@ function Album(props: { album: main.Album }) {
return ( return (
<div class="inline-block mx-2 p-1 w-32 rounded bg-zinc-900"> <div class="inline-block mx-2 p-1 w-32 rounded bg-zinc-900">
<img <img
class="inline-block rounded w-30 h-30 min-w-30 min-h-30" class={`inline-block rounded w-30 h-30 min-w-30 min-h-30 transition-opacity ${coverBytes.state === "ready" ? "opacity-100" : "opacity-0"}`}
src={base64Image()} src={base64Image()}
alt="" alt=""
/> />
<br /> <br />
<div class="text-sm overflow-hidden overflow-ellipsis pt-1"> <div class="text-sm overflow-hidden overflow-ellipsis pt-1">
{props.album.name} {props.album.name}