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
1 changed files with 27 additions and 21 deletions
|
@ -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 && (
|
||||||
<img
|
<img
|
||||||
id={cl("album-image")}
|
id={cl("album-image")}
|
||||||
src={img?.url}
|
src={img.url}
|
||||||
alt="Album Image"
|
alt="Album Image"
|
||||||
onClick={() => setCoverExpanded(!coverExpanded)}
|
onClick={() => setCoverExpanded(!coverExpanded)}
|
||||||
onContextMenu={e => {
|
onContextMenu={e => {
|
||||||
ContextMenu.open(e, () => <AlbumContextMenu track={track} />);
|
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,6 +284,7 @@ function Info({ track }: { track: Track; }) {
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
</Forms.FormText>
|
</Forms.FormText>
|
||||||
|
{track.album.name && (
|
||||||
<Forms.FormText variant="text-sm/normal" className={cl("ellipoverflow")}>
|
<Forms.FormText variant="text-sm/normal" className={cl("ellipoverflow")}>
|
||||||
on
|
on
|
||||||
<a id={cl("album-title")}
|
<a id={cl("album-title")}
|
||||||
|
@ -292,6 +297,7 @@ function Info({ track }: { track: Track; }) {
|
||||||
{track.album.name}
|
{track.album.name}
|
||||||
</a>
|
</a>
|
||||||
</Forms.FormText>
|
</Forms.FormText>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue