Files
flipper/desktop/flipper-ui-core/src/utils/notifications.tsx
Andrey Goncharov 35c145463a Limit notification length
Summary: See https://fb.workplace.com/groups/flippersupport/permalink/1593262167821102/

Reviewed By: antonk52

Differential Revision: D44459787

fbshipit-source-id: ef14e560c523fddf4f815d0faafa37e44dc416b8
2023-03-28 07:00:20 -07:00

46 lines
1.2 KiB
TypeScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import {notification, Typography} from 'antd';
import React from 'react';
import {FlipperDevTools} from '../chrome/FlipperDevTools';
import {setStaticView} from '../reducers/connections';
import {getStore} from '../store';
import {Layout} from '../ui';
import {v4 as uuid} from 'uuid';
import {NotificationBody} from '../ui/components/NotificationBody';
const {Link} = Typography;
export function showErrorNotification(message: string, description?: string) {
const key = uuid();
notification.error({
key,
message,
description: description ? (
<NotificationBody text={description} />
) : (
<Layout.Container gap>
<p>
See{' '}
<Link
onClick={() => {
getStore().dispatch(setStaticView(FlipperDevTools));
notification.close(key);
}}>
logs
</Link>{' '}
for details.
</p>
</Layout.Container>
),
placement: 'bottomLeft',
});
}