feat(ui): move to React 18 and base for using shadcn/ui (#4174)
Co-authored-by: IbrahimCSAE <ibrahim.mdev@gmail.com>
This commit is contained in:
1 parent
72b63dcd6a
commit
70f2c797f4
153 files changed
+2973
-2043
No files matched your search
@@ -10,7 +10,7 @@ import IconButton from '../IconButton';
|
||||
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
|
||||
const DefaultFallback = ({ error, context, resetErrorBoundary, fallbackRoute }) => {
|
||||
const DefaultFallback = ({ error, context, resetErrorBoundary = () => {}, fallbackRoute }) => {
|
||||
const { t } = useTranslation('ErrorBoundary');
|
||||
const [showDetails, setShowDetails] = useState(false);
|
||||
const title = `${t('Something went wrong')}${!isProduction && ` ${t('in')} ${context}`}.`;
|
||||
@@ -57,25 +57,19 @@ const DefaultFallback = ({ error, context, resetErrorBoundary, fallbackRoute })
|
||||
);
|
||||
};
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
DefaultFallback.propTypes = {
|
||||
error: PropTypes.object.isRequired,
|
||||
resetErrorBoundary: PropTypes.func,
|
||||
componentStack: PropTypes.string,
|
||||
};
|
||||
|
||||
DefaultFallback.defaultProps = {
|
||||
resetErrorBoundary: noop,
|
||||
};
|
||||
|
||||
const ErrorBoundary = ({
|
||||
context,
|
||||
onReset,
|
||||
onError,
|
||||
fallbackComponent: FallbackComponent,
|
||||
context = 'OHIF',
|
||||
onReset = () => {},
|
||||
onError = () => {},
|
||||
fallbackComponent: FallbackComponent = DefaultFallback,
|
||||
children,
|
||||
fallbackRoute,
|
||||
fallbackRoute = null,
|
||||
isPage,
|
||||
}) => {
|
||||
const [isOpen, setIsOpen] = useState(true);
|
||||
@@ -132,12 +126,4 @@ ErrorBoundary.propTypes = {
|
||||
fallbackRoute: PropTypes.string,
|
||||
};
|
||||
|
||||
ErrorBoundary.defaultProps = {
|
||||
context: 'OHIF',
|
||||
onReset: noop,
|
||||
onError: noop,
|
||||
fallbackComponent: DefaultFallback,
|
||||
fallbackRoute: null,
|
||||
};
|
||||
|
||||
export default ErrorBoundary;
|
||||
Reference in new issue
Block a user