mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
add drop operations for all item types
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { ItemListAction, ItemListState, ItemListStateItemWithRequiredProperties } from './item-list-state';
|
||||
import {
|
||||
ItemListAction,
|
||||
ItemListState,
|
||||
ItemListStateItemWithRequiredProperties,
|
||||
} from './item-list-state';
|
||||
|
||||
/**
|
||||
* Action creators for item grid state management
|
||||
|
||||
@@ -35,7 +35,7 @@ import { useDragDrop } from '/@/renderer/hooks/use-drag-drop';
|
||||
import { Icon } from '/@/shared/components/icon/icon';
|
||||
import { Skeleton } from '/@/shared/components/skeleton/skeleton';
|
||||
import { Text } from '/@/shared/components/text/text';
|
||||
import { LibraryItem } from '/@/shared/types/domain-types';
|
||||
import { LibraryItem, QueueSong, Song } from '/@/shared/types/domain-types';
|
||||
import { DragOperation, DragTarget, DragTargetMap } from '/@/shared/types/drag-and-drop';
|
||||
import { TableColumn } from '/@/shared/types/types';
|
||||
|
||||
@@ -81,8 +81,6 @@ export const ItemTableListColumn = (props: ItemTableListColumn) => {
|
||||
|
||||
const draggedItems = getDraggedItems(item as any, props.internalState);
|
||||
|
||||
console.log('getItem', draggedItems);
|
||||
|
||||
return draggedItems;
|
||||
},
|
||||
itemType: props.itemType,
|
||||
@@ -151,24 +149,64 @@ export const ItemTableListColumn = (props: ItemTableListColumn) => {
|
||||
break;
|
||||
}
|
||||
case DragTarget.ALBUM_ARTIST: {
|
||||
props.playerContext.addToQueueByFetch(
|
||||
sourceServerId,
|
||||
args.source.id,
|
||||
sourceItemType,
|
||||
{ edge: args.edge, uniqueId: droppedOnUniqueId },
|
||||
);
|
||||
break;
|
||||
}
|
||||
case DragTarget.ARTIST: {
|
||||
props.playerContext.addToQueueByFetch(
|
||||
sourceServerId,
|
||||
args.source.id,
|
||||
sourceItemType,
|
||||
{ edge: args.edge, uniqueId: droppedOnUniqueId },
|
||||
);
|
||||
break;
|
||||
}
|
||||
case DragTarget.GENRE: {
|
||||
props.playerContext.addToQueueByFetch(
|
||||
sourceServerId,
|
||||
args.source.id,
|
||||
sourceItemType,
|
||||
{ edge: args.edge, uniqueId: droppedOnUniqueId },
|
||||
);
|
||||
break;
|
||||
}
|
||||
case DragTarget.PLAYLIST: {
|
||||
props.playerContext.addToQueueByFetch(
|
||||
sourceServerId,
|
||||
args.source.id,
|
||||
sourceItemType,
|
||||
{ edge: args.edge, uniqueId: droppedOnUniqueId },
|
||||
);
|
||||
break;
|
||||
}
|
||||
case DragTarget.QUEUE_SONG: {
|
||||
const sourceItems = (args.source.item || []) as QueueSong[];
|
||||
if (
|
||||
sourceItems.length > 0 &&
|
||||
args.edge &&
|
||||
(args.edge === 'top' || args.edge === 'bottom')
|
||||
) {
|
||||
props.playerContext.moveSelectedTo(
|
||||
sourceItems,
|
||||
args.edge,
|
||||
droppedOnUniqueId,
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DragTarget.SONG: {
|
||||
break;
|
||||
}
|
||||
case DragTarget.TABLE_COLUMN: {
|
||||
const sourceItems = (args.source.item || []) as Song[];
|
||||
if (sourceItems.length > 0) {
|
||||
props.playerContext.addToQueueByData(sourceItems, {
|
||||
edge: args.edge,
|
||||
uniqueId: droppedOnUniqueId,
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@@ -177,6 +215,10 @@ export const ItemTableListColumn = (props: ItemTableListColumn) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (props.internalState) {
|
||||
props.internalState.setDragging([]);
|
||||
}
|
||||
|
||||
return;
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user