feat(enhanced-kanban): add start and end date updates for tasks in task drawer

- Implemented actions to update task start and end dates within the enhanced Kanban feature, ensuring real-time synchronization when the task drawer is used.
- Enhanced task drawer components to dispatch updates to the enhanced Kanban state based on the current tab, specifically when on the board tab.
- Improved state management for task date properties, allowing for better handling of task updates across different views.
This commit is contained in:
shancds
2025-07-01 11:02:04 +05:30
parent e5ff036d81
commit 165a87ce69
2 changed files with 112 additions and 0 deletions

View File

@@ -14,6 +14,8 @@ import { ITaskViewModel } from '@/types/tasks/task.types';
import { IProjectTask } from '@/types/project/projectTasksViewModel.types';
import { useAppDispatch } from '@/hooks/useAppDispatch';
import { setStartDate, setTaskEndDate } from '@/features/task-drawer/task-drawer.slice';
import { updateEnhancedKanbanTaskStartDate, updateEnhancedKanbanTaskEndDate } from '@/features/enhanced-kanban/enhanced-kanban.slice';
import useTabSearchParam from '@/hooks/useTabSearchParam';
interface TaskDrawerDueDateProps {
task: ITaskViewModel;
t: TFunction;
@@ -24,6 +26,7 @@ const TaskDrawerDueDate = ({ task, t, form }: TaskDrawerDueDateProps) => {
const { socket } = useSocket();
const [isShowStartDate, setIsShowStartDate] = useState(false);
const dispatch = useAppDispatch();
const { tab } = useTabSearchParam();
// Date handling
const startDayjs = task?.start_date ? dayjs(task.start_date) : null;
const dueDayjs = task?.end_date ? dayjs(task.end_date) : null;
@@ -63,6 +66,10 @@ const TaskDrawerDueDate = ({ task, t, form }: TaskDrawerDueDateProps) => {
(data: IProjectTask) => {
dispatch(setStartDate(data));
// Also update enhanced kanban if on board tab
if (tab === 'board') {
dispatch(updateEnhancedKanbanTaskStartDate({ task: data }));
}
}
);
} catch (error) {
@@ -88,6 +95,10 @@ const TaskDrawerDueDate = ({ task, t, form }: TaskDrawerDueDateProps) => {
(data: IProjectTask) => {
dispatch(setTaskEndDate(data));
// Also update enhanced kanban if on board tab
if (tab === 'board') {
dispatch(updateEnhancedKanbanTaskEndDate({ task: data }));
}
}
);
} catch (error) {