This commit is contained in:
chamikaJ
2025-04-17 18:28:54 +05:30
parent f583291d8a
commit 8825b0410a
2837 changed files with 241385 additions and 127578 deletions

View File

@@ -0,0 +1,34 @@
import { IRPTTimeProject } from '@/types/reporting/reporting.types';
import { createSlice } from '@reduxjs/toolkit';
interface timeLogState {
isTimeLogDrawerOpen: boolean;
selectedLabel: IRPTTimeProject | null;
}
const initialState: timeLogState = {
isTimeLogDrawerOpen: false,
selectedLabel: null,
};
const timeLogSlice = createSlice({
name: 'timeLogReducer',
initialState,
reducers: {
toggleTimeLogDrawer: state => {
state.isTimeLogDrawerOpen
? (state.isTimeLogDrawerOpen = false)
: (state.isTimeLogDrawerOpen = true);
},
setSelectedLabel(state, action) {
state.selectedLabel = action.payload;
},
setLabelAndToggleDrawer(state, action) {
state.selectedLabel = action.payload;
state.isTimeLogDrawerOpen = true;
},
},
});
export const { toggleTimeLogDrawer, setSelectedLabel, setLabelAndToggleDrawer } = timeLogSlice.actions;
export default timeLogSlice.reducer;