Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

974 B
Raw Blame
import { create } from "zustand";

/**
 * Shared "a mission card is being dragged" flag.
 *
 * The drag source (a rail row in the Artifacts section, via `lib/missionDnd`)
 * and the drop surface
 * (`DodaiosDock`, far away in the tree) need to agree that a drag is in flight so
 * the dock can bloom into a big, forgiving target and mount its full-window
 * catch layer. A tiny zustand store is the lightest way to bridge them — same
 * pattern as `useEventStore` / `useI18nStore`.
 *
 * `begin()` is called from the source `onDragStart`; `end()` from its
 * `onDragEnd` and from every drop handler, so the bloom always tears down
 * whether the user drops on target, tosses near it, or cancels with Esc.
 */
interface MissionDragState {
  dragging: boolean;
  begin: () => void;
  end: () => void;
}

export const useMissionDrag = create<MissionDragState>((set) => ({
  dragging: false,
  begin: () => set({ dragging: true }),
  end: () => set({ dragging: false }),
}));