|
@ -29,6 +29,7 @@ import { |
|
|
setStar, |
|
|
setStar, |
|
|
} from '../../redux/playQueueSlice'; |
|
|
} from '../../redux/playQueueSlice'; |
|
|
import { |
|
|
import { |
|
|
|
|
|
moveToIndex as plMoveToIndex, |
|
|
moveToBottom as plMoveToBottom, |
|
|
moveToBottom as plMoveToBottom, |
|
|
moveToTop as plMoveToTop, |
|
|
moveToTop as plMoveToTop, |
|
|
moveUp as plMoveUp, |
|
|
moveUp as plMoveUp, |
|
@ -88,6 +89,7 @@ export const GlobalContextMenu = () => { |
|
|
const history = useHistory(); |
|
|
const history = useHistory(); |
|
|
const dispatch = useAppDispatch(); |
|
|
const dispatch = useAppDispatch(); |
|
|
const queryClient = useQueryClient(); |
|
|
const queryClient = useQueryClient(); |
|
|
|
|
|
const playlist = useAppSelector((state) => state.playlist); |
|
|
const playQueue = useAppSelector((state) => state.playQueue); |
|
|
const playQueue = useAppSelector((state) => state.playQueue); |
|
|
const misc = useAppSelector((state) => state.misc); |
|
|
const misc = useAppSelector((state) => state.misc); |
|
|
const multiSelect = useAppSelector((state) => state.multiSelect); |
|
|
const multiSelect = useAppSelector((state) => state.multiSelect); |
|
@ -242,10 +244,21 @@ export const GlobalContextMenu = () => { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const handleMoveSelectedToIndex = () => { |
|
|
const handleMoveSelectedToIndex = () => { |
|
|
|
|
|
if (misc.contextMenu.type === 'nowPlaying') { |
|
|
const currentEntryList = getCurrentEntryList(playQueue); |
|
|
const currentEntryList = getCurrentEntryList(playQueue); |
|
|
const uniqueIdOfIndexToMoveTo = playQueue[currentEntryList][indexToMoveTo].uniqueId; |
|
|
const uniqueIdOfIndexToMoveTo = playQueue[currentEntryList][indexToMoveTo].uniqueId; |
|
|
|
|
|
dispatch( |
|
|
dispatch(moveToIndex({ entries: multiSelect.selected, moveBeforeId: uniqueIdOfIndexToMoveTo })); |
|
|
moveToIndex({ entries: multiSelect.selected, moveBeforeId: uniqueIdOfIndexToMoveTo }) |
|
|
|
|
|
); |
|
|
|
|
|
} else { |
|
|
|
|
|
const uniqueIdOfIndexToMoveTo = playlist.entry[indexToMoveTo].uniqueId; |
|
|
|
|
|
dispatch( |
|
|
|
|
|
plMoveToIndex({ |
|
|
|
|
|
selectedEntries: multiSelect.selected, |
|
|
|
|
|
moveBeforeId: uniqueIdOfIndexToMoveTo, |
|
|
|
|
|
}) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const handleMoveToTop = () => { |
|
|
const handleMoveToTop = () => { |
|
@ -417,7 +430,11 @@ export const GlobalContextMenu = () => { |
|
|
<StyledInputNumber |
|
|
<StyledInputNumber |
|
|
defaultValue={0} |
|
|
defaultValue={0} |
|
|
min={0} |
|
|
min={0} |
|
|
max={playQueue[getCurrentEntryList(playQueue)].length} |
|
|
max={ |
|
|
|
|
|
misc.contextMenu.type === 'nowPlaying' |
|
|
|
|
|
? playQueue[getCurrentEntryList(playQueue)].length |
|
|
|
|
|
: playlist.entry.length |
|
|
|
|
|
} |
|
|
value={indexToMoveTo} |
|
|
value={indexToMoveTo} |
|
|
onChange={(e: number) => setIndexToMoveTo(e)} |
|
|
onChange={(e: number) => setIndexToMoveTo(e)} |
|
|
/> |
|
|
/> |
|
@ -425,8 +442,9 @@ export const GlobalContextMenu = () => { |
|
|
type="submit" |
|
|
type="submit" |
|
|
onClick={handleMoveSelectedToIndex} |
|
|
onClick={handleMoveSelectedToIndex} |
|
|
disabled={ |
|
|
disabled={ |
|
|
indexToMoveTo > playQueue[getCurrentEntryList(playQueue)].length || |
|
|
(misc.contextMenu.type === 'nowPlaying' |
|
|
indexToMoveTo < 0 |
|
|
? indexToMoveTo > playQueue[getCurrentEntryList(playQueue)].length |
|
|
|
|
|
: indexToMoveTo > playlist.entry.length) || indexToMoveTo < 0 |
|
|
} |
|
|
} |
|
|
> |
|
|
> |
|
|
Go |
|
|
Go |
|
|