Files
navidrome/ui/src/playlist/PlaylistShow.js
Samarjeet ea65da484b Make spotify-ish more spotify-ish (#914)
* [Theme] Allow customising album and player parts

* [Theme] Allow customizing song lists view

* Make spotify-ish more spotify-ish

* Fix responsive issues in spotify-ish

* Spotify-ish login page

* Add back the previous "Spotify-ish" theme as "Green"

Co-authored-by: Deluan <deluan@navidrome.org>
2021-03-31 16:58:47 -04:00

72 lines
1.7 KiB
JavaScript

import React from 'react'
import {
ReferenceManyField,
ShowContextProvider,
useShowContext,
useShowController,
} from 'react-admin'
import { makeStyles } from '@material-ui/core/styles'
import PlaylistDetails from './PlaylistDetails'
import PlaylistSongs from './PlaylistSongs'
import PlaylistActions from './PlaylistActions'
import { Title, isReadOnly } from '../common'
const useStyles = makeStyles(
(theme) => ({
playlistActions: {},
}),
{
name: 'NDPlaylistShow',
}
)
const PlaylistShowLayout = (props) => {
const { loading, ...context } = useShowContext(props)
const { record } = context
const classes = useStyles()
return (
<>
{record && <PlaylistDetails {...context} />}
{record && (
<ReferenceManyField
{...context}
addLabel={false}
reference="playlistTrack"
target="playlist_id"
sort={{ field: 'id', order: 'ASC' }}
perPage={0}
filter={{ playlist_id: props.id }}
>
<PlaylistSongs
{...props}
readOnly={isReadOnly(record.owner)}
title={<Title subTitle={record.name} />}
actions={
<PlaylistActions
className={classes.playlistActions}
record={record}
/>
}
resource={'playlistTrack'}
exporter={false}
perPage={0}
pagination={null}
/>
</ReferenceManyField>
)}
</>
)
}
const PlaylistShow = (props) => {
const controllerProps = useShowController(props)
return (
<ShowContextProvider value={controllerProps}>
<PlaylistShowLayout {...props} {...controllerProps} />
</ShowContextProvider>
)
}
export default PlaylistShow