mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
handle default behavior
This commit is contained in:
parent
969a3e164e
commit
618e3c88e1
@ -22,6 +22,15 @@ export default (props) => {
|
||||
const isCurrent = currentManifest?._id === props.track._id
|
||||
const isPlaying = isCurrent && playbackStatus === "playing"
|
||||
|
||||
const handleClickPlayBtn = React.useCallback(() => {
|
||||
if (typeof props.onClickPlayBtn === "function") {
|
||||
props.onClick(props.track)
|
||||
} else {
|
||||
console.warn("Searcher: onClick is not a function, using default action...")
|
||||
app.cores.player.start(props.track)
|
||||
}
|
||||
})
|
||||
|
||||
return <div
|
||||
id={props.track._id}
|
||||
className={classnames(
|
||||
@ -48,7 +57,7 @@ export default (props) => {
|
||||
type="primary"
|
||||
shape="circle"
|
||||
icon={isPlaying ? <Icons.MdPause /> : <Icons.MdPlayArrow />}
|
||||
onClick={props.onClick}
|
||||
onClick={handleClickPlayBtn}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user