feat: custom SimpleList, to allow onClick handle

This commit is contained in:
Deluan
2020-02-07 15:35:05 -05:00
parent f0e7f3ef25
commit a50735a94c
5 changed files with 171 additions and 10 deletions
+6 -4
View File
@@ -1,10 +1,12 @@
import React from 'react'
import { SimpleList, useGetList } from 'react-admin'
import { DurationField, PlayButton } from '../common'
import { addTrack } from '../player'
import { useGetList } from 'react-admin'
import { DurationField, PlayButton, SimpleList } from '../common'
import { addTrack, setTrack } from '../player'
import AddIcon from '@material-ui/icons/Add'
import { useDispatch } from 'react-redux'
const AlbumSongList = (props) => {
const dispatch = useDispatch()
const { record } = props
const { data, total, loading, error } = useGetList(
'song',
@@ -39,7 +41,7 @@ const AlbumSongList = (props) => {
r.albumArtist && r.artist !== r.albumArtist ? r.artist : ''
}
tertiaryText={(r) => <DurationField record={r} source={'duration'} />}
linkType={false}
linkType={(id, basePath, record) => dispatch(setTrack(record))}
/>
)
}