mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
25 lines
786 B
TypeScript
25 lines
786 B
TypeScript
"use client";
|
|
import { IModuleItem } from "@/features/local/modules/IModuleItem";
|
|
import { createContext, useContext, DragEvent } from "react";
|
|
|
|
export interface DraggableItem {
|
|
item: IModuleItem;
|
|
sourceModuleName: string | undefined; // undefined for lectures
|
|
type: "quiz" | "assignment" | "page" | "lecture";
|
|
}
|
|
|
|
export interface DraggingContextInterface {
|
|
itemDropOnDay: (e: DragEvent, droppedOnDay: string) => void;
|
|
itemDropOnModule: (e: DragEvent, moduleName: string) => void;
|
|
}
|
|
const defaultDraggingValue: DraggingContextInterface = {
|
|
itemDropOnDay: () => {},
|
|
itemDropOnModule: () => {},
|
|
};
|
|
export const DraggingContext =
|
|
createContext<DraggingContextInterface>(defaultDraggingValue);
|
|
|
|
export function useDraggingContext() {
|
|
return useContext(DraggingContext);
|
|
}
|