import { create } from 'zustand' export interface DragState { draggedPath: string | null draggedType: 'file' | 'dir' | null dropTargetPath: string | null } interface DragStore { state: DragState setState: (state: DragState) => void isDraggedInsidePath: (checkPath: string) => boolean } const initialState: DragState = { draggedPath: null, draggedType: null, dropTargetPath: null } export const useDragStore = create((set, get) => ({ state: initialState, setState: (state) => set({ state }), isDraggedInsidePath: (checkPath) => { const { state } = get() if (!state.draggedPath) return false if (state.draggedType === 'dir') { return checkPath.startsWith(`${state.draggedPath}/`) } return false } }))