mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-09-11 22:06:29 +02:00
add react modal and use it for days wishes
This commit is contained in:
@@ -6,6 +6,7 @@ import javGameList from "./javGameList"
|
||||
import preVolunteerAdd from "./preVolunteerAdd"
|
||||
import preVolunteerCount from "./preVolunteerCount"
|
||||
import teamList from "./teamList"
|
||||
import ui from "./ui"
|
||||
import volunteer from "./volunteer"
|
||||
import volunteerAdd from "./volunteerAdd"
|
||||
import volunteerList from "./volunteerList"
|
||||
@@ -27,6 +28,7 @@ export default (history: History) => ({
|
||||
preVolunteerAdd,
|
||||
preVolunteerCount,
|
||||
teamList,
|
||||
ui,
|
||||
volunteer,
|
||||
volunteerAdd,
|
||||
volunteerList,
|
||||
|
31
src/store/ui.ts
Normal file
31
src/store/ui.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { createSelector, createSlice, PayloadAction } from "@reduxjs/toolkit"
|
||||
import { AppState } from "./index"
|
||||
|
||||
const initialState = {
|
||||
modalId: "",
|
||||
}
|
||||
|
||||
const uiSlice = createSlice({
|
||||
name: "ui",
|
||||
initialState,
|
||||
reducers: {
|
||||
displayModal: (state, action: PayloadAction<string>) => {
|
||||
state.modalId = action.payload
|
||||
},
|
||||
hideModal: (state) => {
|
||||
state.modalId = ""
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
export default uiSlice.reducer
|
||||
|
||||
export const { displayModal, hideModal } = uiSlice.actions
|
||||
|
||||
const selectUiData = (state: AppState) => state.ui
|
||||
|
||||
export const selectActiveModalId = createSelector(selectUiData, (ui) => ui.modalId)
|
||||
|
||||
export const MODAL_IDS = {
|
||||
DAYWISHES: "DAYWISHES",
|
||||
}
|
Reference in New Issue
Block a user