Hide BulkActionsToolbar after removing songs from playlist (#898)

This commit is contained in:
Ritik Pandey
2021-03-26 07:10:31 +05:30
committed by GitHub
parent 210f34bbbe
commit 5abc215270
2 changed files with 16 additions and 4 deletions
+11 -2
View File
@@ -7,7 +7,12 @@ import {
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
// Replace original resource with "fake" one for removing tracks from playlist // Replace original resource with "fake" one for removing tracks from playlist
const PlaylistSongBulkActions = ({ playlistId, resource, ...rest }) => { const PlaylistSongBulkActions = ({
playlistId,
resource,
onUnselectItems,
...rest
}) => {
const unselectAll = useUnselectAll() const unselectAll = useUnselectAll()
useEffect(() => { useEffect(() => {
unselectAll('playlistTrack') unselectAll('playlistTrack')
@@ -18,7 +23,11 @@ const PlaylistSongBulkActions = ({ playlistId, resource, ...rest }) => {
return ( return (
<ResourceContextProvider value={mappedResource}> <ResourceContextProvider value={mappedResource}>
<Fragment> <Fragment>
<BulkDeleteButton {...rest} resource={mappedResource} /> <BulkDeleteButton
{...rest}
resource={mappedResource}
onClick={onUnselectItems}
/>
</Fragment> </Fragment>
</ResourceContextProvider> </ResourceContextProvider>
) )
+5 -2
View File
@@ -77,7 +77,7 @@ const ReorderableList = ({ readOnly, children, ...rest }) => {
} }
const PlaylistSongs = ({ playlistId, readOnly, ...props }) => { const PlaylistSongs = ({ playlistId, readOnly, ...props }) => {
const { data, ids } = props const { data, ids, onUnselectItems } = props
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs')) const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs'))
const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md')) const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md'))
const classes = useStyles({ isDesktop }) const classes = useStyles({ isDesktop })
@@ -139,7 +139,10 @@ const PlaylistSongs = ({ playlistId, readOnly, ...props }) => {
key={version} key={version}
> >
<BulkActionsToolbar {...props}> <BulkActionsToolbar {...props}>
<PlaylistSongBulkActions playlistId={playlistId} /> <PlaylistSongBulkActions
playlistId={playlistId}
onUnselectItems={onUnselectItems}
/>
</BulkActionsToolbar> </BulkActionsToolbar>
<ReorderableList <ReorderableList
readOnly={readOnly} readOnly={readOnly}