- Updated `TODO.md` to reflect new testing tasks and final structure expectations. - Simplified TypeScript path mappings in `tsconfig.json` for better clarity. - Revised business logic separation rules in `.cursor/rules` to align with new directory structure. - Deleted unused client components and services to streamline the codebase. - Adjusted import paths in scripts to match the new structure.
29 lines
642 B
TypeScript
29 lines
642 B
TypeScript
import { useState, useEffect } from 'react';
|
|
import { useSensors, useSensor, PointerSensor } from '@dnd-kit/core';
|
|
|
|
/**
|
|
* Hook pour gérer le drag & drop de manière safe avec SSR
|
|
* Désactive le DnD jusqu'à l'hydratation pour éviter les erreurs d'hydratation
|
|
*/
|
|
export function useDragAndDrop() {
|
|
const [isMounted, setIsMounted] = useState(false);
|
|
|
|
useEffect(() => {
|
|
// Activer le drag & drop après l'hydratation
|
|
setIsMounted(true);
|
|
}, []);
|
|
|
|
const sensors = useSensors(
|
|
useSensor(PointerSensor, {
|
|
activationConstraint: {
|
|
distance: 8,
|
|
},
|
|
})
|
|
);
|
|
|
|
return {
|
|
isMounted,
|
|
sensors
|
|
};
|
|
}
|