diff --git a/ui/src/album/AlbumDetails.js b/ui/src/album/AlbumDetails.js index d0ad6a80..9ab489dd 100644 --- a/ui/src/album/AlbumDetails.js +++ b/ui/src/album/AlbumDetails.js @@ -6,7 +6,6 @@ import 'react-image-lightbox/style.css' import subsonic from '../subsonic' import { DurationField, formatRange, StarButton, SizeField } from '../common' import { ArtistLinkField } from '../common' -import { PlayButton } from '../common' const AlbumDetails = ({ classes, record }) => { const [isLightboxOpen, setLightboxOpen] = React.useState(false) @@ -37,13 +36,7 @@ const AlbumDetails = ({ classes, record }) => { image={imageUrl} className={classes.albumCover} onClick={handleOpenLightbox} - > - - + > {record.name} @@ -54,8 +47,8 @@ const AlbumDetails = ({ classes, record }) => { {genreYear(record)} {record.songCount}{' '} - {translate('resources.song.name', { smart_count: record.songCount })}{' '} - · ·{' '} + {translate('resources.song.name', { smart_count: record.songCount })} + {' · '} {' · '} diff --git a/ui/src/album/AlbumGridView.js b/ui/src/album/AlbumGridView.js index 3d25bf5e..07a6e337 100644 --- a/ui/src/album/AlbumGridView.js +++ b/ui/src/album/AlbumGridView.js @@ -2,6 +2,7 @@ import React from 'react' import { GridList, GridListTile, + Typography, GridListTileBar, useMediaQuery, } from '@material-ui/core' @@ -11,7 +12,12 @@ import { Link } from 'react-router-dom' import { linkToRecord, Loading } from 'react-admin' import { withContentRect } from 'react-measure' import subsonic from '../subsonic' -import { AlbumContextMenu, PlayButton } from '../common' +import { + AlbumContextMenu, + PlayButton, + ArtistLinkField, + RangeField, +} from '../common' const useStyles = makeStyles((theme) => ({ root: { @@ -38,19 +44,16 @@ const useStyles = makeStyles((theme) => ({ textAlign: 'left', fontSize: '1em', }, - artistLink: { - color: theme.palette.primary.light, - }, - albumArtist: { - fontSize: '12px', - color: '#c5c5c5', + albumName: { + fontSize: '14px', + color: theme.palette.type === 'dark' ? '#eee' : 'black', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', }, - albumName: { - fontSize: '14px', - color: '#eee', + albumSubtitle: { + fontSize: '12px', + color: theme.palette.type === 'dark' ? '#c5c5c5' : '#696969', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', @@ -63,7 +66,7 @@ const useStyles = makeStyles((theme) => ({ opacity: 1, }, }, - albumLlink: { + albumLink: { position: 'relative', display: 'block', textDecoration: 'none', @@ -118,22 +121,26 @@ const AlbumGridTile = ({ showArtist, record, basePath }) => { - } + subtitle={} actionIcon={} /> -
{record.name}
-
{record.albumArtist}
+ {record.name} + {showArtist ? ( + + ) : ( + + )} ) diff --git a/ui/src/album/styles.js b/ui/src/album/styles.js index 70dcaf1c..0db2ca9f 100644 --- a/ui/src/album/styles.js +++ b/ui/src/album/styles.js @@ -11,10 +11,6 @@ export const useStyles = makeStyles((theme) => ({ minWidth: '32em', }, }, - playButton: { - opacity: 0, - transition: 'all 150ms ease-out', - }, albumCover: { display: 'inline-flex', justifyContent: 'center', diff --git a/ui/src/common/PlayButton.js b/ui/src/common/PlayButton.js index 67fef8ca..b45bc9d9 100644 --- a/ui/src/common/PlayButton.js +++ b/ui/src/common/PlayButton.js @@ -5,8 +5,16 @@ import { IconButton } from '@material-ui/core' import { useDispatch } from 'react-redux' import { useDataProvider } from 'react-admin' import { playTracks } from '../audioplayer' +import { makeStyles } from '@material-ui/core/styles' -const PlayButton = ({ record, size = 'small', ...rest }) => { +const useStyles = makeStyles({ + icon: { + color: (props) => props.color, + }, +}) + +const PlayButton = ({ record, color, size, ...rest }) => { + const classes = useStyles({ color }) let extractSongsData = function (response) { const data = response.data.reduce( (acc, cur) => ({ ...acc, [cur.id]: cur }), @@ -37,6 +45,8 @@ const PlayButton = ({ record, size = 'small', ...rest }) => { e.preventDefault() playAlbum(record) }} + aria-label="play" + className={classes.icon} {...rest} size={size} > @@ -46,7 +56,12 @@ const PlayButton = ({ record, size = 'small', ...rest }) => { } PlayButton.propTypes = { - icon: PropTypes.element, record: PropTypes.object, + color: PropTypes.string, + size: PropTypes.string, +} + +PlayButton.defaultProps = { + size: 'small', } export default PlayButton diff --git a/ui/src/common/RangeField.js b/ui/src/common/RangeField.js index f0213208..2991a771 100644 --- a/ui/src/common/RangeField.js +++ b/ui/src/common/RangeField.js @@ -15,8 +15,8 @@ const formatRange = (record, source) => { return range.join('-') } -const RangeField = ({ record = {}, source }) => { - return {formatRange(record, source)} +const RangeField = ({ className, record = {}, source }) => { + return {formatRange(record, source)} } RangeField.propTypes = {