// SPDX-License-Identifier: MIT // Copyright (c) 2021 The Pybricks Authors // Provides special notification contents for unexpected errors. import { AnchorButton, Button, ButtonGroup, Intent } from '@blueprintjs/core'; import { useI18n } from '@shopify/react-i18n'; import React from 'react'; import { MessageId } from './notification-i18n'; import en from './notification-i18n.en.json'; type OwnProps = { messageId: MessageId; err: Error; }; export default function UnexpectedErrorNotification(props: OwnProps): JSX.Element { const [i18n] = useI18n({ id: 'notification', translations: { en }, fallback: en, }); const { messageId, err } = props; return ( <>
{i18n.translate(messageId, { errorMessage: err.message })}