Files
spacedrive/interface/app/$libraryId/Explorer/View/Grid/context.tsx
nikec caf4fc5cde [ENG-1353] explorer dnd (#1737)
* locations dnd

* fix icon

* reduce navigate timeout

* fix types

* another

* fix drag overlay count

* Update pnpm-lock.yaml

* merge

* ephemeral support and other improvements

* merge

* Tag dnd

* merge

* type

* merge

* remove offset

* update dnd logic to not depend on drag source

* handle allowed types if parent isn't available

* saved searches dnd navigation

* well

* rendering

* Update pnpm-lock.yaml

* types

* remove width

* Temporary solution

* merge

* @dnd-kit/utilities

* Update pnpm-lock.yaml

* explorer path dnd

* remove unused drag hook

* fix dnd on LayeredFileIcon

---------

Co-authored-by: Brendan Allan <brendonovich@outlook.com>
2023-12-13 11:59:27 +00:00

19 lines
505 B
TypeScript

import { createContext, useContext } from 'react';
import Selecto from 'react-selecto';
interface GridContext {
selecto?: React.RefObject<Selecto>;
selectoUnselected: React.MutableRefObject<Set<string>>;
getElementById: (id: string) => Element | null | undefined;
}
export const GridContext = createContext<GridContext | null>(null);
export const useGridContext = () => {
const ctx = useContext(GridContext);
if (ctx === null) throw new Error('GridContext.Provider not found!');
return ctx;
};