-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
215 notification about auth transitioning (#216)
* add warning mechanism * changelog; add message to config * too much blank spaces
- Loading branch information
1 parent
e63992b
commit ff591c5
Showing
7 changed files
with
95 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from "react"; | ||
import { Alert } from "@material-ui/lab"; | ||
import { Collapse, IconButton } from "@material-ui/core"; | ||
import CloseIcon from "@material-ui/icons/Close"; | ||
import { useDispatch, useSelector } from "react-redux"; | ||
import { closeWarningMessage} from "../../actions"; | ||
|
||
export const WarningMessage = () => { | ||
|
||
const dispatch = useDispatch(); | ||
const { messageOpen, error, message } = useSelector( | ||
(state) => state.warning | ||
); | ||
|
||
const handleClose = () => { | ||
dispatch(closeWarningMessage()); | ||
}; | ||
|
||
return ( | ||
<Collapse in={messageOpen}> | ||
<Alert | ||
severity="warning" | ||
action={ | ||
<> | ||
<IconButton | ||
aria-label="close" | ||
color="inherit" | ||
size="small" | ||
onClick={handleClose} | ||
> | ||
<CloseIcon fontSize="inherit" /> | ||
</IconButton> | ||
</> | ||
} | ||
> | ||
{message} | ||
</Alert> | ||
</Collapse> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { OPEN_WARNING_MESSAGE, CLOSE_WARNING_MESSAGE } from "../actions/index"; | ||
|
||
const initialState = { | ||
messageOpen: false, | ||
message: "", | ||
}; | ||
|
||
const warning = (state = initialState, action) => { | ||
switch (action.type) { | ||
case OPEN_WARNING_MESSAGE: | ||
return { | ||
...state, | ||
messageOpen: true, | ||
message: action.message, | ||
}; | ||
case CLOSE_WARNING_MESSAGE: | ||
return { | ||
...state, | ||
messageOpen: false, | ||
message: "", | ||
}; | ||
default: | ||
return state; | ||
} | ||
}; | ||
|
||
export default warning; |