mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +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 { useTranslation } from 'react-i18next';
|
||||||
import { useParams } from 'react-router';
|
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 { getDraggedItems } from '/@/renderer/components/item-list/helpers/get-dragged-items';
|
||||||
|
import { useItemDraggingState } from '/@/renderer/components/item-list/helpers/item-list-state';
|
||||||
import {
|
import {
|
||||||
ItemTableListInnerColumn,
|
ItemTableListInnerColumn,
|
||||||
TableColumnContainer,
|
TableColumnContainer,
|
||||||
@@ -25,7 +28,11 @@ export const PlaylistReorderColumn = (props: ItemTableListInnerColumn) => {
|
|||||||
|
|
||||||
const isPlaylistSong = props.itemType === LibraryItem.PLAYLIST_SONG;
|
const isPlaylistSong = props.itemType === LibraryItem.PLAYLIST_SONG;
|
||||||
|
|
||||||
const { isDraggedOver, ref: dragRef } = useDragDrop<HTMLButtonElement>({
|
const {
|
||||||
|
isDraggedOver,
|
||||||
|
isDragging: isDraggingLocal,
|
||||||
|
ref: dragRef,
|
||||||
|
} = useDragDrop<HTMLButtonElement>({
|
||||||
drag: {
|
drag: {
|
||||||
getId: () => {
|
getId: () => {
|
||||||
if (!item || !isDataRow || !isPlaylistSong) {
|
if (!item || !isDataRow || !isPlaylistSong) {
|
||||||
@@ -134,6 +141,17 @@ export const PlaylistReorderColumn = (props: ItemTableListInnerColumn) => {
|
|||||||
const draggedOverEdge: 'bottom' | 'top' | null =
|
const draggedOverEdge: 'bottom' | 'top' | null =
|
||||||
isDraggedOver === 'top' || isDraggedOver === 'bottom' ? isDraggedOver : 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(() => {
|
const getValidDataItems = useCallback(() => {
|
||||||
return props.data.filter((d) => d !== null && (d as any).id);
|
return props.data.filter((d) => d !== null && (d as any).id);
|
||||||
}, [props.data]);
|
}, [props.data]);
|
||||||
@@ -281,8 +299,8 @@ export const PlaylistReorderColumn = (props: ItemTableListInnerColumn) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableColumnContainer {...props} isDraggedOver={draggedOverEdge}>
|
<TableColumnContainer {...props} isDraggedOver={draggedOverEdge} isDragging={isDragging}>
|
||||||
<ActionIconGroup w="100%">
|
<ActionIconGroup className={styles.group} w="100%">
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
{...upButtonHandlers}
|
{...upButtonHandlers}
|
||||||
icon="arrowUp"
|
icon="arrowUp"
|
||||||
|
|||||||
Reference in New Issue
Block a user