From 3b65384b9438f38f612b92ed1276eb6bb0899f50 Mon Sep 17 00:00:00 2001 From: Nico Date: Wed, 9 Nov 2022 17:36:20 +0100 Subject: fix(spotifyControls): add album/cover null checks (local files) (#198) Co-authored-by: Ven --- src/plugins/spotifyControls/PlayerComponent.tsx | 48 ++++++++++++++----------- 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'src/plugins/spotifyControls') 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 = ( - Album Image setCoverExpanded(!coverExpanded)} - onContextMenu={e => { - ContextMenu.open(e, () => ); - }} - /> + <> + {img && ( + Album Image setCoverExpanded(!coverExpanded)} + onContextMenu={e => { + ContextMenu.open(e, () => ); + }} + /> + )} + ); - if (coverExpanded) return ( + if (coverExpanded && img) return (
{i}
@@ -280,18 +284,20 @@ function Info({ track }: { track: Track; }) { ))} - + {track.album.name && ( + on  - - {track.album.name} - - + + {track.album.name} + + + )} ); -- cgit