From aaa0a01c6b6c6570e42e513b3fd2aaa508e67d4b Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Fri, 28 Jul 2023 12:06:11 -0700 Subject: [PATCH] Notification refactor for consistency Summary: ^ Reviewed By: aigoncharov Differential Revision: D47873882 fbshipit-source-id: 9bfb17b1ecadc3489645b456d6760fc217af7759 --- .../src/dispatcher/flipperServer.tsx | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/desktop/flipper-ui-core/src/dispatcher/flipperServer.tsx b/desktop/flipper-ui-core/src/dispatcher/flipperServer.tsx index 03153c5b4..634c7aac3 100644 --- a/desktop/flipper-ui-core/src/dispatcher/flipperServer.tsx +++ b/desktop/flipper-ui-core/src/dispatcher/flipperServer.tsx @@ -37,13 +37,7 @@ export function connectFlipperServerToStore( ) { server.on('notification', ({type, title, description}) => { const key = `[${type}] ${title}: ${description}`; - notification.open({ - message: title, - 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: , + type, + duration: 0, + key, + }); +} + function showConnectivityTroubleshootNotification( store: Store, key: string,