Skip to content

Add component for outage notification #2008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/modules/IDE/pages/IDEView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Feedback from '../components/Feedback';
import { CollectionSearchbar } from '../components/Searchbar';
import { getIsUserOwner } from '../selectors/users';
import RootPage from '../../../components/RootPage';
import Notification from '../../User/components/Notification';

function getTitle(props) {
const { id } = props.project;
Expand Down Expand Up @@ -252,6 +253,7 @@ class IDEView extends React.Component {
render() {
return (
<RootPage>
<Notification />
<Helmet>
<title>{getTitle(this.props)}</title>
</Helmet>
Expand Down
22 changes: 22 additions & 0 deletions client/modules/User/components/Notification.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { useEffect } from 'react';
import Cookies from 'js-cookie';
import { useDispatch } from 'react-redux';
import { showToast, setToastText } from '../../IDE/actions/toast';

function Notification() {
const dispatch = useDispatch();
useEffect(() => {
const notification = Cookies.get('p5-notification');
if (!notification) {
// show the toast
dispatch(showToast(30000));
const text = `There is a scheduled outage on Sunday, April 9 3AM - 5AM UTC.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@catarak
Is this on Saturday, April 9? Someone was having trouble with the date.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is on Sunday the 10th. Sorry, this is a confusion from converting EDT to UTC.

The entire site will be down, so please plan accordingly.`;
dispatch(setToastText(text));
Cookies.set('p5-notification', true, { expires: 365 });
}
});
return null;
}

export default Notification;