chore(react/collections/board): improve note dragging experience

This commit is contained in:
Elian Doran 2025-09-13 10:13:37 +03:00
parent 7edfaad04e
commit 8bde2092c6
No known key found for this signature in database

View File

@ -36,6 +36,7 @@ export default function Card({
const colorClass = note.getColorClass() || '';
const editorRef = useRef<HTMLInputElement>(null);
const isArchived = note.isArchived;
const [ isVisible, setVisible ] = useState(true);
const [ title, setTitle ] = useState(note.title);
const handleDragStart = useCallback((e: DragEvent) => {
@ -70,6 +71,10 @@ export default function Card({
setTitle(note.title);
}, [ note ]);
useEffect(() => {
setVisible(!isDragging);
}, [ isDragging ]);
return (
<div
className={`board-note ${colorClass} ${isDragging ? 'dragging' : ''} ${isEditing ? "editing" : ""} ${isArchived ? "archived" : ""}`}
@ -78,6 +83,9 @@ export default function Card({
onDragEnd={handleDragEnd}
onContextMenu={handleContextMenu}
onClick={!isEditing ? handleOpen : undefined}
style={{
display: !isVisible ? "none" : undefined
}}
>
{!isEditing ? (
<>