- Remove BMAD framework, IDE configs, dev screenshots, test files, internal docs, and backup files - Rename keep-notes/ to memento-note/ - Update all references from keep-notes to memento-note - Add Apache 2.0 license with Commons Clause (non-commercial restriction) - Add clean .gitignore and .env.docker.example
37 lines
851 B
TypeScript
37 lines
851 B
TypeScript
'use client'
|
|
|
|
import { useState, useCallback } from 'react'
|
|
|
|
export type DragState = 'idle' | 'dragging' | 'drag-over'
|
|
|
|
export function useNoteDrag() {
|
|
const [draggedNoteId, setDraggedNoteId] = useState<string | null>(null)
|
|
const [dragOverNotebookId, setDragOverNotebookId] = useState<string | null>(null)
|
|
|
|
const startDrag = useCallback((noteId: string) => {
|
|
setDraggedNoteId(noteId)
|
|
}, [])
|
|
|
|
const endDrag = useCallback(() => {
|
|
setDraggedNoteId(null)
|
|
setDragOverNotebookId(null)
|
|
}, [])
|
|
|
|
const dragOver = useCallback((notebookId: string | null) => {
|
|
setDragOverNotebookId(notebookId)
|
|
}, [])
|
|
|
|
const isDragging = draggedNoteId !== null
|
|
const isDragOver = dragOverNotebookId !== null
|
|
|
|
return {
|
|
draggedNoteId,
|
|
dragOverNotebookId,
|
|
startDrag,
|
|
endDrag,
|
|
dragOver,
|
|
isDragging,
|
|
isDragOver,
|
|
}
|
|
}
|