feat: Integrate forum layout support across various components and enhance room handling logic
This commit is contained in:
@@ -11,14 +11,15 @@ export const useFileDropHandler = (onDrop: (file: File[]) => void): DragEventHan
|
||||
);
|
||||
|
||||
export const useFileDropZone = (
|
||||
zoneRef: RefObject<HTMLElement>,
|
||||
zoneRef: RefObject<HTMLElement> | undefined,
|
||||
onDrop: (file: File[]) => void
|
||||
): boolean => {
|
||||
const dragStateRef = useRef<'start' | 'leave' | 'over'>();
|
||||
const [active, setActive] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const target = zoneRef.current;
|
||||
const target = zoneRef?.current;
|
||||
if (!target) return undefined;
|
||||
const handleDrop = (evt: DragEvent) => {
|
||||
evt.preventDefault();
|
||||
dragStateRef.current = undefined;
|
||||
@@ -35,7 +36,9 @@ export const useFileDropZone = (
|
||||
}, [zoneRef, onDrop]);
|
||||
|
||||
useEffect(() => {
|
||||
const target = zoneRef.current;
|
||||
const target = zoneRef?.current;
|
||||
if (!target) return undefined;
|
||||
|
||||
const handleDragEnter = (evt: DragEvent) => {
|
||||
if (evt.dataTransfer?.types.includes('Files')) {
|
||||
dragStateRef.current = 'start';
|
||||
|
||||
Reference in New Issue
Block a user