chore: refactor project structure and clean up unused components
- 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.
This commit is contained in:
28
src/hooks/useDragAndDrop.ts
Normal file
28
src/hooks/useDragAndDrop.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user