60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
import { createSlice } from "@reduxjs/toolkit";
|
|
|
|
const initialState = {
|
|
collapsed: true,
|
|
siderWidth: 250,
|
|
hovered: false,
|
|
modalVisible: false,
|
|
selectedAppointment: null,
|
|
scheduledAppointments: [],
|
|
selectedScheduledAppointment: null,
|
|
};
|
|
|
|
const appointmentsSlice = createSlice({
|
|
name: 'appointmentsUI',
|
|
initialState,
|
|
reducers: {
|
|
toggleSider: (state) => {
|
|
state.collapsed = !state.collapsed;
|
|
},
|
|
setSiderWidth: (state, action) => {
|
|
state.siderWidth = action.payload;
|
|
},
|
|
setHovered: (state, action) => {
|
|
state.hovered = action.payload;
|
|
},
|
|
setSelectedDate: (state, action) => {
|
|
state.selectedDate = action.payload;
|
|
},
|
|
openModal: (state) => {
|
|
state.modalVisible = true;
|
|
},
|
|
closeModal: (state) => {
|
|
state.modalVisible = false;
|
|
},
|
|
setSelectedAppointment: (state, action) => {
|
|
state.selectedAppointment = action.payload;
|
|
},
|
|
setScheduledAppointments: (state, action) => {
|
|
state.scheduledAppointments = action.payload;
|
|
},
|
|
setSelectedScheduledAppointment: (state, action) => {
|
|
state.selectedScheduledAppointment = action.payload;
|
|
},
|
|
}
|
|
});
|
|
|
|
export const {
|
|
toggleSider,
|
|
setSiderWidth,
|
|
setHovered,
|
|
setSelectedDate,
|
|
openModal,
|
|
closeModal,
|
|
setSelectedAppointments,
|
|
setSelectedAppointment,
|
|
setSelectedScheduledAppointment,
|
|
setScheduledAppointments,
|
|
} = appointmentsSlice.actions;
|
|
|
|
export default appointmentsSlice.reducer; |