Skip to content

Commit c743f2d

Browse files
authored
Merge pull request #2008 from processing/feature/outage-notification
Add component for outage notification
2 parents 5e00f3c + d25132f commit c743f2d

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

client/modules/IDE/pages/IDEView.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import Feedback from '../components/Feedback';
3636
import { CollectionSearchbar } from '../components/Searchbar';
3737
import { getIsUserOwner } from '../selectors/users';
3838
import RootPage from '../../../components/RootPage';
39+
import Notification from '../../User/components/Notification';
3940

4041
function getTitle(props) {
4142
const { id } = props.project;
@@ -252,6 +253,7 @@ class IDEView extends React.Component {
252253
render() {
253254
return (
254255
<RootPage>
256+
<Notification />
255257
<Helmet>
256258
<title>{getTitle(this.props)}</title>
257259
</Helmet>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { useEffect } from 'react';
2+
import Cookies from 'js-cookie';
3+
import { useDispatch } from 'react-redux';
4+
import { showToast, setToastText } from '../../IDE/actions/toast';
5+
6+
function Notification() {
7+
const dispatch = useDispatch();
8+
useEffect(() => {
9+
const notification = Cookies.get('p5-notification');
10+
if (!notification) {
11+
// show the toast
12+
dispatch(showToast(30000));
13+
const text = `There is a scheduled outage on Sunday, April 9 3AM - 5AM UTC.
14+
The entire site will be down, so please plan accordingly.`;
15+
dispatch(setToastText(text));
16+
Cookies.set('p5-notification', true, { expires: 365 });
17+
}
18+
});
19+
return null;
20+
}
21+
22+
export default Notification;

0 commit comments

Comments
 (0)