mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
fix drag styles on playlist reorder
This commit is contained in:
+3
@@ -0,0 +1,3 @@
|
||||
.group {
|
||||
justify-content: center;
|
||||
}
|
||||
+21
-3
@@ -2,7 +2,10 @@ import { useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useParams } from 'react-router';
|
||||
|
||||
import styles from './playlist-reorder-column.module.css';
|
||||
|
||||
import { getDraggedItems } from '/@/renderer/components/item-list/helpers/get-dragged-items';
|
||||
import { useItemDraggingState } from '/@/renderer/components/item-list/helpers/item-list-state';
|
||||
import {
|
||||
ItemTableListInnerColumn,
|
||||
TableColumnContainer,
|
||||
@@ -25,7 +28,11 @@ export const PlaylistReorderColumn = (props: ItemTableListInnerColumn) => {
|
||||
|
||||
const isPlaylistSong = props.itemType === LibraryItem.PLAYLIST_SONG;
|
||||
|
||||
const { isDraggedOver, ref: dragRef } = useDragDrop<HTMLButtonElement>({
|
||||
const {
|
||||
isDraggedOver,
|
||||
isDragging: isDraggingLocal,
|
||||
ref: dragRef,
|
||||
} = useDragDrop<HTMLButtonElement>({
|
||||
drag: {
|
||||
getId: () => {
|
||||
if (!item || !isDataRow || !isPlaylistSong) {
|
||||
@@ -134,6 +141,17 @@ export const PlaylistReorderColumn = (props: ItemTableListInnerColumn) => {
|
||||
const draggedOverEdge: 'bottom' | 'top' | null =
|
||||
isDraggedOver === 'top' || isDraggedOver === 'bottom' ? isDraggedOver : null;
|
||||
|
||||
const itemRowId =
|
||||
item && typeof item === 'object' && 'id' in item && props.internalState
|
||||
? props.internalState.extractRowId(item)
|
||||
: undefined;
|
||||
const isDraggingState = useItemDraggingState(
|
||||
props.internalState,
|
||||
itemRowId ||
|
||||
(item && typeof item === 'object' && 'id' in item ? (item as any).id : undefined),
|
||||
);
|
||||
const isDragging = props.internalState ? isDraggingState : isDraggingLocal;
|
||||
|
||||
const getValidDataItems = useCallback(() => {
|
||||
return props.data.filter((d) => d !== null && (d as any).id);
|
||||
}, [props.data]);
|
||||
@@ -281,8 +299,8 @@ export const PlaylistReorderColumn = (props: ItemTableListInnerColumn) => {
|
||||
});
|
||||
|
||||
return (
|
||||
<TableColumnContainer {...props} isDraggedOver={draggedOverEdge}>
|
||||
<ActionIconGroup w="100%">
|
||||
<TableColumnContainer {...props} isDraggedOver={draggedOverEdge} isDragging={isDragging}>
|
||||
<ActionIconGroup className={styles.group} w="100%">
|
||||
<ActionIcon
|
||||
{...upButtonHandlers}
|
||||
icon="arrowUp"
|
||||
|
||||
Reference in New Issue
Block a user