fix(spotifyControls): add album/cover null checks (local files) (#198)
Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
parent
e0450531ef
commit
3b65384b94
|
@ -233,18 +233,22 @@ function Info({ track }: { track: Track; }) {
|
||||||
const [coverExpanded, setCoverExpanded] = React.useState(false);
|
const [coverExpanded, setCoverExpanded] = React.useState(false);
|
||||||
|
|
||||||
const i = (
|
const i = (
|
||||||
<img
|
<>
|
||||||
id={cl("album-image")}
|
{img && (
|
||||||
src={img?.url}
|
<img
|
||||||
alt="Album Image"
|
id={cl("album-image")}
|
||||||
onClick={() => setCoverExpanded(!coverExpanded)}
|
src={img.url}
|
||||||
onContextMenu={e => {
|
alt="Album Image"
|
||||||
ContextMenu.open(e, () => <AlbumContextMenu track={track} />);
|
onClick={() => setCoverExpanded(!coverExpanded)}
|
||||||
}}
|
onContextMenu={e => {
|
||||||
/>
|
ContextMenu.open(e, () => <AlbumContextMenu track={track} />);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
if (coverExpanded) return (
|
if (coverExpanded && img) return (
|
||||||
<div id={cl("album-expanded-wrapper")}>
|
<div id={cl("album-expanded-wrapper")}>
|
||||||
{i}
|
{i}
|
||||||
</div>
|
</div>
|
||||||
|
@ -280,18 +284,20 @@ function Info({ track }: { track: Track; }) {
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
</Forms.FormText>
|
</Forms.FormText>
|
||||||
<Forms.FormText variant="text-sm/normal" className={cl("ellipoverflow")}>
|
{track.album.name && (
|
||||||
|
<Forms.FormText variant="text-sm/normal" className={cl("ellipoverflow")}>
|
||||||
on
|
on
|
||||||
<a id={cl("album-title")}
|
<a id={cl("album-title")}
|
||||||
href={`https://open.spotify.com/album/${track.album.id}`}
|
href={`https://open.spotify.com/album/${track.album.id}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className={cl("album")}
|
className={cl("album")}
|
||||||
style={{ fontSize: "inherit" }}
|
style={{ fontSize: "inherit" }}
|
||||||
title={track.album.name}
|
title={track.album.name}
|
||||||
>
|
>
|
||||||
{track.album.name}
|
{track.album.name}
|
||||||
</a>
|
</a>
|
||||||
</Forms.FormText>
|
</Forms.FormText>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue