feat: implement drag-and-drop reordering for daily checkboxes
- Added DnD functionality to `DailySection` for reordering checkboxes using `@dnd-kit/core` and `@dnd-kit/sortable`. - Introduced `onReorderCheckboxes` prop to handle server updates after reordering. - Updated `useDaily` hook to streamline error handling during reordering. - Cleaned up `Header` component by removing unnecessary syncing text. - Adjusted `DailyPageClient` to pass reorder function to `DailySection`.
This commit is contained in:
@@ -329,10 +329,7 @@ export function useDaily(initialDate?: Date, initialDailyView?: DailyView): UseD
|
||||
const dailyId = data.date.toISOString().split('T')[0];
|
||||
const result = await reorderCheckboxesAction(dailyId, data.checkboxIds);
|
||||
|
||||
if (result.success) {
|
||||
// Rafraîchir pour obtenir l'ordre correct
|
||||
await refreshDaily();
|
||||
} else {
|
||||
if (!result.success) {
|
||||
setError(result.error || 'Erreur lors du réordonnancement');
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -341,7 +338,7 @@ export function useDaily(initialDate?: Date, initialDailyView?: DailyView): UseD
|
||||
} finally {
|
||||
setSaving(false);
|
||||
}
|
||||
}, [refreshDaily]);
|
||||
}, []);
|
||||
|
||||
const goToPreviousDay = useCallback(async (): Promise<void> => {
|
||||
const previousDay = new Date(currentDate);
|
||||
|
||||
Reference in New Issue
Block a user