sforkowany z mirror/soapbox
Don't dismiss ServiceWorker snackbar
rodzic
82122ffe45
commit
23c37229b8
|
@ -19,6 +19,7 @@ type SnackbarOpts = {
|
|||
actionLabel?: SnackbarMessage,
|
||||
actionLink?: string,
|
||||
action?: () => void,
|
||||
dismissAfter?: number | false,
|
||||
};
|
||||
|
||||
export const show = (
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ function main() {
|
|||
action: () => {
|
||||
OfflinePluginRuntime.applyUpdate();
|
||||
},
|
||||
dismissAfter: false,
|
||||
}));
|
||||
},
|
||||
onUpdated: function() {
|
||||
|
|
|
@ -14,6 +14,7 @@ const AlertRecord = ImmutableRecord({
|
|||
actionLabel: '',
|
||||
actionLink: '',
|
||||
action: () => {},
|
||||
dismissAfter: 6000 as number | false,
|
||||
});
|
||||
|
||||
import type { AnyAction } from 'redux';
|
||||
|
|
Ładowanie…
Reference in New Issue