1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-21 22:05:38 -04:00

Convert Modal components to TypeScript

This commit is contained in:
Mark McDowall
2024-12-21 10:05:34 -08:00
parent ee1a0a1f71
commit 9d0acba000
17 changed files with 340 additions and 444 deletions
@@ -4,6 +4,7 @@ import React, { Component, ErrorInfo } from 'react';
interface ErrorBoundaryProps {
children: React.ReactNode;
errorComponent: React.ElementType;
onModalClose?: () => void;
}
interface ErrorBoundaryState {
@@ -32,11 +33,17 @@ class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
}
render() {
const { children, errorComponent: ErrorComponent } = this.props;
const {
children,
errorComponent: ErrorComponent,
onModalClose,
} = this.props;
const { error, info } = this.state;
if (error) {
return <ErrorComponent error={error} info={info} />;
return (
<ErrorComponent error={error} info={info} onModalClose={onModalClose} />
);
}
return children;