mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-21 23:18:06 -04:00
* Shit UI * refactor a bit * wip * yeet * farming the wry but it's stale * Real-time hover event * Hook with `Platform` + fix broken window-state plugin * `DragAndDropDebug` * Clippy * revert Tauri v2 stuff * minor * probs not gonna work * undo last commit * a * b * c * d * e * f * g * long shot * 1 * no 7 * da hell * large bruh moment * lol * zzzz * SSH into CI * yeet * Tauri mouse position without new Wry * go for gold * Correctly lock `ort` version * minor fixes * debounce hover events * WTF Tauri * Replace DND hooks with goated versions * wip frontend stuff * fix ts * disable library p2p stuff * remove Spacedrop dialog + hook up backend * `useOnDndLeave` working * Close popover when drag outside * Allow `openFilePickerDialog` for Spacedrop * couple of fixes * empty state * smh --------- Co-authored-by: Brendan Allan <brendonovich@outlook.com>
35 lines
953 B
TypeScript
35 lines
953 B
TypeScript
import { useEffect, useRef } from 'react';
|
|
import { usePlatform } from '~/util/Platform';
|
|
|
|
export function DragAndDropDebug() {
|
|
const ref = useRef<HTMLDivElement>(null);
|
|
|
|
const platform = usePlatform();
|
|
useEffect(() => {
|
|
if (!platform.subscribeToDragAndDropEvents) return;
|
|
|
|
let finished = false;
|
|
const unsub = platform.subscribeToDragAndDropEvents((event) => {
|
|
if (finished) return;
|
|
|
|
console.log(JSON.stringify(event));
|
|
if (!ref.current) return;
|
|
|
|
if (event.type === 'Hovered') {
|
|
ref.current.classList.remove('hidden');
|
|
ref.current.style.left = `${event.x}px`;
|
|
ref.current.style.top = `${event.y}px`;
|
|
} else if (event.type === 'Dropped' || event.type === 'Cancelled') {
|
|
ref.current.classList.add('hidden');
|
|
}
|
|
});
|
|
|
|
return () => {
|
|
finished = true;
|
|
void unsub.then((unsub) => unsub());
|
|
};
|
|
}, [platform, ref]);
|
|
|
|
return <div ref={ref} className="absolute z-[500] hidden h-10 w-10 bg-red-500"></div>;
|
|
}
|