Don't dismiss ServiceWorker snackbar

virtuoso-debug
Alex Gleason 2022-06-23 18:03:35 -05:00
rodzic 82122ffe45
commit 23c37229b8
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
4 zmienionych plików z 6 dodań i 3 usunięć

Wyświetl plik

@ -19,6 +19,7 @@ type SnackbarOpts = {
actionLabel?: SnackbarMessage,
actionLink?: string,
action?: () => void,
dismissAfter?: number | false,
};
export const show = (

Wyświetl plik

@ -1,5 +1,5 @@
import React from 'react';
import { useIntl } from 'react-intl';
import { useIntl, MessageDescriptor } from 'react-intl';
import { NotificationStack, NotificationObject, StyleFactoryFn } from 'react-notification';
import { useHistory } from 'react-router-dom';
@ -18,7 +18,7 @@ const SnackbarContainer: React.FC = () => {
const alerts = useAppSelector(state => state.alerts);
/** Apply i18n to the message if it's an object. */
const maybeFormatMessage = (message: any): string => {
const maybeFormatMessage = (message: MessageDescriptor | string): string => {
switch (typeof message) {
case 'string': return message;
case 'object': return intl.formatMessage(message);
@ -39,7 +39,7 @@ const SnackbarContainer: React.FC = () => {
key: item.key,
className: `notification-bar-${item.severity}`,
activeClassName: 'snackbar--active',
dismissAfter: 6000,
dismissAfter: item.dismissAfter,
style: false,
};

Wyświetl plik

@ -47,6 +47,7 @@ function main() {
action: () => {
OfflinePluginRuntime.applyUpdate();
},
dismissAfter: false,
}));
},
onUpdated: function() {

Wyświetl plik

@ -14,6 +14,7 @@ const AlertRecord = ImmutableRecord({
actionLabel: '',
actionLink: '',
action: () => {},
dismissAfter: 6000 as number | false,
});
import type { AnyAction } from 'redux';