feat: added warning for unreachable server (#43576)

* feat: added warning for unreachable server

* fix: update initial state in test file

* fix: make offline warning scroll with page

* adjust z-indexes for warning banners

* add hyperlink for offline warning
This commit is contained in:
Budbreaker
2021-10-06 15:18:02 +02:00
committed by GitHub
parent 83354c5632
commit bc802cbbbd
15 changed files with 70 additions and 14 deletions

View File

@@ -60,6 +60,7 @@ const initialState = {
sessionMeta: { activeDonations: 0 },
showDonationModal: false,
isOnline: true,
isServerOnline: true,
donationFormState: {
...defaultDonationFormState
}
@@ -102,6 +103,7 @@ export const updateDonationFormState = createAction(
);
export const onlineStatusChange = createAction(actionTypes.onlineStatusChange);
export const serverStatusChange = createAction(actionTypes.serverStatusChange);
// TODO: re-evaluate this since /internal is no longer used.
// `hardGoTo` is used to hit the API server directly
@@ -189,6 +191,7 @@ export const stepsToClaimSelector = state => {
};
export const isDonatingSelector = state => userSelector(state).isDonating;
export const isOnlineSelector = state => state[ns].isOnline;
export const isServerOnlineSelector = state => state[ns].isServerOnline;
export const isSignedInSelector = state => !!state[ns].appUsername;
export const isDonationModalOpenSelector = state => state[ns].showDonationModal;
export const recentlyClaimedBlockSelector = state =>
@@ -553,6 +556,10 @@ export const reducer = handleActions(
...state,
isOnline
}),
[actionTypes.serverStatusChange]: (state, { payload: isServerOnline }) => ({
...state,
isServerOnline
}),
[actionTypes.closeDonationModal]: state => ({
...state,
showDonationModal: false