From 14240caba22f4562151f1e9db2790eadea2eaf13 Mon Sep 17 00:00:00 2001 From: jeffvli Date: Mon, 17 Jan 2022 02:16:53 -0800 Subject: [PATCH] Adjust playerbar current song info - Increase dynamic width for better fit - Clicking song name now links to /nowplaying - Added album name which links to album page --- src/components/player/PlayerBar.tsx | 126 +++++++++++++++++++--------- src/components/player/styled.tsx | 7 +- 2 files changed, 90 insertions(+), 43 deletions(-) diff --git a/src/components/player/PlayerBar.tsx b/src/components/player/PlayerBar.tsx index 98c1e42..fe5a6aa 100644 --- a/src/components/player/PlayerBar.tsx +++ b/src/components/player/PlayerBar.tsx @@ -42,7 +42,7 @@ import { isCached, writeOBSFiles, } from '../../shared/utils'; -import { StyledPopover } from '../shared/styled'; +import { LinkWrapper, SecondaryTextWrapper, StyledPopover } from '../shared/styled'; import { apiController } from '../../api/controller'; import { Artist, Server } from '../../types'; import logo from '../../../assets/icon.png'; @@ -542,15 +542,15 @@ const PlayerBar = () => { - + - + { - + { t('Unknown Title') } > - { - if (playQueue[currentEntryList][playQueue.currentIndex]?.albumId) { - history.push( - `/library/album/${ - playQueue[currentEntryList][playQueue.currentIndex]?.albumId - }` - ); - } - }} - > + history.push(`/nowplaying`)}> {playQueue[currentEntryList][playQueue.currentIndex]?.title || t('Unknown Title')} @@ -651,9 +639,9 @@ const PlayerBar = () => { { overflow: 'hidden', }} > - { - if ( - playQueue[currentEntryList][playQueue.currentIndex]?.albumArtist - ) { - history.push( - `/library/artist/${ - playQueue[currentEntryList][playQueue.currentIndex] - ?.albumArtistId - }` - ); - } - }} - > - {playQueue[currentEntryList][playQueue.currentIndex]?.albumArtist || - t('Unknown Artist')} - + {playQueue[currentEntryList][playQueue.currentIndex]?.albumArtistId ? ( + { + if ( + playQueue[currentEntryList][playQueue.currentIndex]?.albumArtistId + ) { + history.push( + `/library/artist/${ + playQueue[currentEntryList][playQueue.currentIndex] + ?.albumArtistId + }` + ); + } + }} + > + {playQueue[currentEntryList][playQueue.currentIndex]?.albumArtist || + t('Unknown Artist')} + + ) : ( + { + if ( + playQueue[currentEntryList][playQueue.currentIndex]?.albumArtistId + ) { + history.push( + `/library/artist/${ + playQueue[currentEntryList][playQueue.currentIndex] + ?.albumArtistId + }` + ); + } + }} + > + + {playQueue[currentEntryList][playQueue.currentIndex]?.albumArtist || + t('Unknown Artist')} + + + )} + + + { + if (playQueue[currentEntryList][playQueue.currentIndex]?.albumId) { + history.push( + `/library/album/${ + playQueue[currentEntryList][playQueue.currentIndex]?.albumId + }` + ); + } + }} + > + {playQueue[currentEntryList][playQueue.currentIndex]?.album || + t('Unknown Album')} + + + diff --git a/src/components/player/styled.tsx b/src/components/player/styled.tsx index 800728c..24b5595 100644 --- a/src/components/player/styled.tsx +++ b/src/components/player/styled.tsx @@ -17,6 +17,7 @@ export const PlayerColumn = styled.div<{ right?: boolean; height: string; }>` + user-select: none; height: ${(props) => props.height}; display: flex; align-items: center; @@ -47,7 +48,6 @@ export const PlayerControlIcon = styled(Icon)` `; export const LinkButton = styled(Button)<{ subtitle?: string }>` - user-select: text; border-radius: 0px; background: transparent; max-width: 100%; @@ -62,12 +62,15 @@ export const LinkButton = styled(Button)<{ subtitle?: string }>` ? props.theme.colors.layout.playerBar.colorSecondary : props.theme.colors.layout.playerBar.color} !important; + &:hover { + text-decoration: underline; + } + &:hover, &:active, &:focus { background: transparent !important; color: ${(props) => props.theme.colors.layout.playerBar.color}; - text-decoration: underline; cursor: pointer; }