mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
refactor(kanban-card): switch from useSortable to useDraggable
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import React, { memo, useLayoutEffect, useState } from 'react';
|
import React, { memo, useLayoutEffect, useState } from 'react';
|
||||||
import { useSortable } from '@dnd-kit/sortable';
|
import { useDraggable } from '@dnd-kit/core';
|
||||||
import { CSS } from '@dnd-kit/utilities';
|
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { Card, CardContent } from '@/components/ui/card';
|
import { Card, CardContent } from '@/components/ui/card';
|
||||||
import { Feature, useAppStore } from '@/store/app-store';
|
import { Feature, useAppStore } from '@/store/app-store';
|
||||||
@@ -100,14 +99,12 @@ export const KanbanCard = memo(function KanbanCard({
|
|||||||
feature.status === 'waiting_approval' ||
|
feature.status === 'waiting_approval' ||
|
||||||
feature.status === 'verified' ||
|
feature.status === 'verified' ||
|
||||||
(feature.status === 'in_progress' && !isCurrentAutoTask);
|
(feature.status === 'in_progress' && !isCurrentAutoTask);
|
||||||
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
|
const { attributes, listeners, setNodeRef, isDragging } = useDraggable({
|
||||||
id: feature.id,
|
id: feature.id,
|
||||||
disabled: !isDraggable || isOverlay,
|
disabled: !isDraggable || isOverlay,
|
||||||
});
|
});
|
||||||
|
|
||||||
const dndStyle = {
|
const dndStyle = {
|
||||||
transform: CSS.Transform.toString(transform),
|
|
||||||
transition,
|
|
||||||
opacity: isDragging ? 0.5 : undefined,
|
opacity: isDragging ? 0.5 : undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user