diff --git a/src/components/main.tsx b/src/components/main.tsx index d3f675b..0e89460 100644 --- a/src/components/main.tsx +++ b/src/components/main.tsx @@ -43,6 +43,7 @@ import PlayArrowIcon from '@material-ui/icons/PlayArrow'; import PauseIcon from '@material-ui/icons/Pause'; import FolderIcon from '@material-ui/icons/Folder'; import CreateNewFolderIcon from '@material-ui/icons/CreateNewFolder'; +import DragIndicator from '@material-ui/icons/DragIndicator'; import Table from '@material-ui/core/Table'; import TableBody from '@material-ui/core/TableBody'; @@ -226,6 +227,14 @@ const useStyles = makeStyles(theme => ({ height: '16px', width: '16px', }, + dragHandle: { + width: 20, + padding: `${theme.spacing(0.5)}px 0 0 0`, + }, + dragHandleEmpty: { + width: 20, + padding: `${theme.spacing(0.5)}px 0 0 0`, + }, })); export const Main = (props: {}) => { @@ -352,7 +361,7 @@ export const Main = (props: {}) => { }; const handleRenameActionClick = (event: React.MouseEvent) => { - if(event.detail !== 1) return; //Event retriggering when hitting enter in the dialog + if (event.detail !== 1) return; //Event retriggering when hitting enter in the dialog handleRenameDoubleClick(event, selected[0]); }; @@ -425,16 +434,20 @@ export const Main = (props: {}) => { return ; } - const getTrackRow = (track: Track, inGroup: boolean, additional: {}) => { + const getTrackRow = (track: Track, inGroup: boolean, draggableProvided: DraggableProvided) => { const child = ( handleRenameDoubleClick(event, track.index)} onClick={event => handleSelectClick(event, track.index)} className={clsx(classes.trackRow, { [classes.inGroupTrackRow]: inGroup })} > + event.stopPropagation()}> + + {track.index === deviceStatus?.track && ['playing', 'paused'].includes(deviceStatus?.state) ? ( @@ -574,6 +587,7 @@ export const Main = (props: {}) => { + # Title Duration @@ -583,7 +597,7 @@ export const Main = (props: {}) => { {groupedTracks.map((group, index) => ( - +
{(provided: DroppableProvided, snapshot: DroppableStateSnapshot) => ( @@ -601,6 +615,7 @@ export const Main = (props: {}) => { handleRenameDoubleClick(event, group.tracks[0].index, true) } > + { key={`${n.index - group.tracks[0].index}`} index={n.index - group.tracks[0].index} > - {(providedInGroup: DraggableProvided) => - getTrackRow(n, group.title !== null, { - ref: providedInGroup.innerRef, - ...providedInGroup.draggableProps, - ...providedInGroup.dragHandleProps, - }) + {(provided: DraggableProvided) => + getTrackRow(n, group.title !== null, provided) } ))}