mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-25 11:04:00 +00:00
Play track now on click
This commit is contained in:
parent
ed864fab1f
commit
6fc70315e6
3 changed files with 7 additions and 2 deletions
|
|
@ -58,6 +58,7 @@ export {
|
|||
seekBackward,
|
||||
setVolume,
|
||||
playTrack,
|
||||
playTrackNow,
|
||||
adjustVolume,
|
||||
scrollVolume,
|
||||
setBalance,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ export function playTrack(id: number): Thunk {
|
|||
};
|
||||
}
|
||||
|
||||
export function playTrackNow(id: number): Action {
|
||||
return { type: PLAY_TRACK, id };
|
||||
}
|
||||
|
||||
export function play(): Thunk {
|
||||
return (dispatch: Dispatch, getState: GetState) => {
|
||||
const state = getState();
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ function TrackCell({ children, handleMoveClick, index, id }: Props) {
|
|||
const current = currentTrackId === id;
|
||||
|
||||
const dispatch = useTypedDispatch();
|
||||
const playTrack = useActionCreator(Actions.playTrack);
|
||||
const playTrackNow = useActionCreator(Actions.playTrackNow);
|
||||
|
||||
const onMouseDown = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
|
|
@ -62,7 +62,7 @@ function TrackCell({ children, handleMoveClick, index, id }: Props) {
|
|||
onClick={(e) => e.stopPropagation()}
|
||||
onMouseDown={onMouseDown}
|
||||
onContextMenu={(e) => e.preventDefault()}
|
||||
onDoubleClick={() => playTrack(id)}
|
||||
onDoubleClick={() => playTrackNow(id)}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue