chore(collections/board): fix dragging notes not working

This commit is contained in:
Elian Doran
2025-09-12 15:08:00 +03:00
parent 2972a23f19
commit 95a392ccfa
3 changed files with 10 additions and 7 deletions

View File

@@ -13,7 +13,6 @@ export default function Card({
branch, branch,
column, column,
index, index,
setDraggedCard,
isDragging isDragging
}: { }: {
api: BoardApi, api: BoardApi,
@@ -21,10 +20,9 @@ export default function Card({
branch: FBranch, branch: FBranch,
column: string, column: string,
index: number, index: number,
setDraggedCard: (card: { noteId: string, branchId: string, fromColumn: string, index: number } | null) => void,
isDragging: boolean isDragging: boolean
}) { }) {
const { branchIdToEdit, setBranchIdToEdit } = useContext(BoardViewContext); const { branchIdToEdit, setBranchIdToEdit, setDraggedCard } = useContext(BoardViewContext);
const isEditing = branch.branchId === branchIdToEdit; const isEditing = branch.branchId === branchIdToEdit;
const colorClass = note.getColorClass() || ''; const colorClass = note.getColorClass() || '';
const editorRef = useRef<HTMLInputElement>(null); const editorRef = useRef<HTMLInputElement>(null);

View File

@@ -27,11 +27,11 @@ export default function Column({
isDraggingColumn: boolean, isDraggingColumn: boolean,
api: BoardApi api: BoardApi
} & DragContext) { } & DragContext) {
const { columnNameToEdit, setColumnNameToEdit, dropTarget, draggedCard, dropPosition, setDraggedCard} = useContext(BoardViewContext); const { columnNameToEdit, setColumnNameToEdit, dropTarget, draggedCard, dropPosition } = useContext(BoardViewContext);
const isEditing = (columnNameToEdit === column); const isEditing = (columnNameToEdit === column);
const editorRef = useRef<HTMLInputElement>(null); const editorRef = useRef<HTMLInputElement>(null);
const { handleColumnDragStart, handleColumnDragEnd, handleDragOver, handleDragLeave, handleDrop } = useDragging({ const { handleColumnDragStart, handleColumnDragEnd, handleDragOver, handleDragLeave, handleDrop } = useDragging({
column, columnIndex column, columnIndex, columnItems
}); });
const handleEdit = useCallback(() => { const handleEdit = useCallback(() => {
@@ -95,7 +95,6 @@ export default function Column({
branch={branch} branch={branch}
column={column} column={column}
index={index} index={index}
setDraggedCard={setDraggedCard}
isDragging={draggedCard?.noteId === note.noteId} isDragging={draggedCard?.noteId === note.noteId}
/> />
</> </>

View File

@@ -61,7 +61,13 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC
dropPosition, setDropPosition, dropPosition, setDropPosition,
draggedCard, setDraggedCard, draggedCard, setDraggedCard,
dropTarget, setDropTarget dropTarget, setDropTarget
}), [ branchIdToEdit, columnNameToEdit, setColumnNameToEdit, setBranchIdToEdit ]); }), [ branchIdToEdit, setBranchIdToEdit,
columnNameToEdit, setColumnNameToEdit,
draggedColumn, setDraggedColumn,
dropPosition, setDropPosition,
draggedCard, setDraggedCard,
dropTarget, setDropTarget
]);
function refresh() { function refresh() {
getBoardData(parentNote, statusAttribute, viewConfig ?? {}).then(({ byColumn, newPersistedData }) => { getBoardData(parentNote, statusAttribute, viewConfig ?? {}).then(({ byColumn, newPersistedData }) => {