refactor(enhanced-kanban): update state management for editable section

- Changed the source of `editableSectionId` from `boardReducer` to `enhancedKanbanReducer` for improved state organization.
- Added `setEditableSection` and `deleteSection` actions to manage the editable section state within the enhanced kanban slice.
This commit is contained in:
shancds
2025-07-02 12:28:34 +05:30
parent d56eaa9f02
commit c9d9134049
2 changed files with 19 additions and 4 deletions

View File

@@ -101,6 +101,7 @@ interface EnhancedKanbanState {
selectedTaskIds: string[];
expandedSubtasks: Record<string, boolean>;
columnOrder: string[];
editableSectionId: string | null;
}
const initialState: EnhancedKanbanState = {
@@ -141,6 +142,7 @@ const initialState: EnhancedKanbanState = {
selectedTaskIds: [],
expandedSubtasks: {},
columnOrder: [],
editableSectionId: null,
};
// Performance monitoring utility
@@ -373,8 +375,6 @@ const deleteTaskFromGroup = (
}
};
const enhancedKanbanSlice = createSlice({
name: 'enhancedKanbanReducer',
initialState,
@@ -871,6 +871,19 @@ const enhancedKanbanSlice = createSlice({
state.groupCache[result.groupId] = result.group;
}
},
setEditableSection: (state, action: PayloadAction<string | null>) => {
state.editableSectionId = action.payload;
},
deleteSection: (state, action: PayloadAction<{ sectionId: string }>) => {
state.taskGroups = state.taskGroups.filter(
section => section.id !== action.payload.sectionId
);
if (state.editableSectionId === action.payload.sectionId) {
state.editableSectionId = null;
}
},
},
extraReducers: (builder) => {
builder
@@ -1061,6 +1074,8 @@ export const {
updateEnhancedKanbanTaskStartDate,
updateEnhancedKanbanSubtask,
toggleTaskExpansion,
setEditableSection,
deleteSection,
} = enhancedKanbanSlice.actions;
export default enhancedKanbanSlice.reducer;