From dbd5622f2728a605b2a70887847874c8aa9b545a Mon Sep 17 00:00:00 2001 From: sealday Date: Sun, 17 Mar 2024 12:50:38 +0800 Subject: [PATCH] feat: support tachycode issue feedback --- .../antd/error-fallback/ErrorFallback2.tsx | 50 +++++++++++++++++++ .../antd/error-fallback/index.ts | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 packages/core/client/src/schema-component/antd/error-fallback/ErrorFallback2.tsx diff --git a/packages/core/client/src/schema-component/antd/error-fallback/ErrorFallback2.tsx b/packages/core/client/src/schema-component/antd/error-fallback/ErrorFallback2.tsx new file mode 100644 index 000000000..56b32accc --- /dev/null +++ b/packages/core/client/src/schema-component/antd/error-fallback/ErrorFallback2.tsx @@ -0,0 +1,50 @@ +import { Button, Result, Typography } from 'antd'; +import React, { FC } from 'react'; +import { FallbackProps, useErrorBoundary } from 'react-error-boundary'; +import { Trans, useTranslation } from 'react-i18next'; + +const { Paragraph, Text, Link } = Typography; + +export const ErrorFallback: FC = ({ error }) => { + const { resetBoundary } = useErrorBoundary(); + const { t } = useTranslation(); + + const subTitle = ( + + {'This is likely a TachyCode internals bug. Please open an issue at '} + + here + + + ); + + return ( +
+ + {t('Feedback')} + , + , + ]} + > + + + {error.stack} + + + +
+ ); +}; diff --git a/packages/core/client/src/schema-component/antd/error-fallback/index.ts b/packages/core/client/src/schema-component/antd/error-fallback/index.ts index 12bb8db1b..e7f61b61a 100644 --- a/packages/core/client/src/schema-component/antd/error-fallback/index.ts +++ b/packages/core/client/src/schema-component/antd/error-fallback/index.ts @@ -1 +1 @@ -export * from './ErrorFallback'; +export * from './ErrorFallback2';