aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorNico <nico@d3sox.me>2022-11-09 17:36:20 +0100
committerGitHub <noreply@github.com>2022-11-09 17:36:20 +0100
commit3b65384b9438f38f612b92ed1276eb6bb0899f50 (patch)
tree3baf53d86337ed8d8a7c6538560b0a714934e60c /src/plugins
parente0450531efa84c42e4857b78176f5e80de2ab12e (diff)
downloadVencord-3b65384b9438f38f612b92ed1276eb6bb0899f50.tar.gz
Vencord-3b65384b9438f38f612b92ed1276eb6bb0899f50.tar.bz2
Vencord-3b65384b9438f38f612b92ed1276eb6bb0899f50.zip
fix(spotifyControls): add album/cover null checks (local files) (#198)
Co-authored-by: Ven <vendicated@riseup.net>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/spotifyControls/PlayerComponent.tsx48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/plugins/spotifyControls/PlayerComponent.tsx b/src/plugins/spotifyControls/PlayerComponent.tsx
index 7972835..b5cc26a 100644
--- a/src/plugins/spotifyControls/PlayerComponent.tsx
+++ b/src/plugins/spotifyControls/PlayerComponent.tsx
@@ -233,18 +233,22 @@ function Info({ track }: { track: Track; }) {
const [coverExpanded, setCoverExpanded] = React.useState(false);
const i = (
- <img
- id={cl("album-image")}
- src={img?.url}
- alt="Album Image"
- onClick={() => setCoverExpanded(!coverExpanded)}
- onContextMenu={e => {
- ContextMenu.open(e, () => <AlbumContextMenu track={track} />);
- }}
- />
+ <>
+ {img && (
+ <img
+ id={cl("album-image")}
+ src={img.url}
+ alt="Album Image"
+ onClick={() => setCoverExpanded(!coverExpanded)}
+ onContextMenu={e => {
+ ContextMenu.open(e, () => <AlbumContextMenu track={track} />);
+ }}
+ />
+ )}
+ </>
);
- if (coverExpanded) return (
+ if (coverExpanded && img) return (
<div id={cl("album-expanded-wrapper")}>
{i}
</div>
@@ -280,18 +284,20 @@ function Info({ track }: { track: Track; }) {
</React.Fragment>
))}
</Forms.FormText>
- <Forms.FormText variant="text-sm/normal" className={cl("ellipoverflow")}>
+ {track.album.name && (
+ <Forms.FormText variant="text-sm/normal" className={cl("ellipoverflow")}>
on&nbsp;
- <a id={cl("album-title")}
- href={`https://open.spotify.com/album/${track.album.id}`}
- target="_blank"
- className={cl("album")}
- style={{ fontSize: "inherit" }}
- title={track.album.name}
- >
- {track.album.name}
- </a>
- </Forms.FormText>
+ <a id={cl("album-title")}
+ href={`https://open.spotify.com/album/${track.album.id}`}
+ target="_blank"
+ className={cl("album")}
+ style={{ fontSize: "inherit" }}
+ title={track.album.name}
+ >
+ {track.album.name}
+ </a>
+ </Forms.FormText>
+ )}
</div>
</div>
);