Skip to content

Commit

Permalink
Notification refactor for consistency
Browse files Browse the repository at this point in the history
Summary: ^

Reviewed By: aigoncharov

Differential Revision: D47873882

fbshipit-source-id: 9bfb17b1ecadc3489645b456d6760fc217af7759
  • Loading branch information
lblasa authored and facebook-github-bot committed Jul 28, 2023
1 parent ea50f19 commit aaa0a01
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions desktop/flipper-ui-core/src/dispatcher/flipperServer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit aaa0a01

Please sign in to comment.