Notification refactor for consistency

Summary: ^

Reviewed By: aigoncharov

Differential Revision: D47873882

fbshipit-source-id: 9bfb17b1ecadc3489645b456d6760fc217af7759
This commit is contained in:
Lorenzo Blasa
2023-07-28 12:06:11 -07:00
committed by Facebook GitHub Bot
parent ea50f19655
commit aaa0a01c6b

View File

@@ -37,13 +37,7 @@ export function connectFlipperServerToStore(
) {
server.on('notification', ({type, title, description}) => {
const key = `[${type}] ${title}: ${description}`;
notification.open({
message: title,
description: <NotificationBody text={description} />,
type: type,
duration: 0,
key,
});
showNotification(key, type, title, description);
});
server.on(
@@ -288,6 +282,21 @@ export function handleDeviceDisconnected(
existing?.connected.set(false);
}
function showNotification(
key: string,
type: 'success' | 'info' | 'error' | 'warning',
message: string,
description: string,
) {
notification.open({
message,
description: <NotificationBody text={description} />,
type,
duration: 0,
key,
});
}
function showConnectivityTroubleshootNotification(
store: Store,
key: string,