From 5ef7f2d2a703339bdbc7530e169a92c61d6b244a Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 5 Aug 2024 13:31:13 +0300 Subject: [PATCH] Cleanup old prop-types for TS --- .../History/Details/HistoryDetailsModal.tsx | 6 +--- frontend/src/Activity/History/HistoryRow.tsx | 6 +--- frontend/src/Activity/Queue/QueueStatus.tsx | 6 ---- frontend/src/App/App.tsx | 8 +---- frontend/src/App/AppRoutes.tsx | 5 ---- frontend/src/App/State/SystemAppState.ts | 4 +-- frontend/src/Commands/Command.ts | 2 +- .../Components/Form/SeriesTypeSelectInput.tsx | 9 ++---- frontend/src/System/Status/Status.tsx | 29 ++++++++----------- 9 files changed, 20 insertions(+), 55 deletions(-) diff --git a/frontend/src/Activity/History/Details/HistoryDetailsModal.tsx b/frontend/src/Activity/History/Details/HistoryDetailsModal.tsx index a833bca5b..a33e0b1ba 100644 --- a/frontend/src/Activity/History/Details/HistoryDetailsModal.tsx +++ b/frontend/src/Activity/History/Details/HistoryDetailsModal.tsx @@ -51,7 +51,7 @@ function HistoryDetailsModal(props: HistoryDetailsModalProps) { sourceTitle, data, downloadId, - isMarkingAsFailed, + isMarkingAsFailed = false, shortDateFormat, timeFormat, onMarkAsFailedPress, @@ -93,8 +93,4 @@ function HistoryDetailsModal(props: HistoryDetailsModalProps) { ); } -HistoryDetailsModal.defaultProps = { - isMarkingAsFailed: false, -}; - export default HistoryDetailsModal; diff --git a/frontend/src/Activity/History/HistoryRow.tsx b/frontend/src/Activity/History/HistoryRow.tsx index bcd84f606..c24f6a286 100644 --- a/frontend/src/Activity/History/HistoryRow.tsx +++ b/frontend/src/Activity/History/HistoryRow.tsx @@ -61,7 +61,7 @@ function HistoryRow(props: HistoryRowProps) { date, data, downloadId, - isMarkingAsFailed, + isMarkingAsFailed = false, markAsFailedError, columns, } = props; @@ -268,8 +268,4 @@ function HistoryRow(props: HistoryRowProps) { ); } -HistoryRow.defaultProps = { - customFormats: [], -}; - export default HistoryRow; diff --git a/frontend/src/Activity/Queue/QueueStatus.tsx b/frontend/src/Activity/Queue/QueueStatus.tsx index d7314baff..64d802df8 100644 --- a/frontend/src/Activity/Queue/QueueStatus.tsx +++ b/frontend/src/Activity/Queue/QueueStatus.tsx @@ -155,10 +155,4 @@ function QueueStatus(props: QueueStatusProps) { ); } -QueueStatus.defaultProps = { - trackedDownloadStatus: 'ok', - trackedDownloadState: 'downloading', - canFlip: false, -}; - export default QueueStatus; diff --git a/frontend/src/App/App.tsx b/frontend/src/App/App.tsx index 6c2d799f3..0014c1d3f 100644 --- a/frontend/src/App/App.tsx +++ b/frontend/src/App/App.tsx @@ -1,5 +1,4 @@ import { ConnectedRouter, ConnectedRouterProps } from 'connected-react-router'; -import PropTypes from 'prop-types'; import React from 'react'; import DocumentTitle from 'react-document-title'; import { Provider } from 'react-redux'; @@ -20,7 +19,7 @@ function App({ store, history }: AppProps) { - + @@ -28,9 +27,4 @@ function App({ store, history }: AppProps) { ); } -App.propTypes = { - store: PropTypes.object.isRequired, - history: PropTypes.object.isRequired, -}; - export default App; diff --git a/frontend/src/App/AppRoutes.tsx b/frontend/src/App/AppRoutes.tsx index e3bf426c9..1b4fea9c2 100644 --- a/frontend/src/App/AppRoutes.tsx +++ b/frontend/src/App/AppRoutes.tsx @@ -1,4 +1,3 @@ -import PropTypes from 'prop-types'; import React from 'react'; import { Redirect, Route } from 'react-router-dom'; import Blocklist from 'Activity/Blocklist/Blocklist'; @@ -165,8 +164,4 @@ function AppRoutes() { ); } -AppRoutes.propTypes = { - app: PropTypes.func.isRequired, -}; - export default AppRoutes; diff --git a/frontend/src/App/State/SystemAppState.ts b/frontend/src/App/State/SystemAppState.ts index d20dacc51..1161f0e1e 100644 --- a/frontend/src/App/State/SystemAppState.ts +++ b/frontend/src/App/State/SystemAppState.ts @@ -8,15 +8,15 @@ import AppSectionState, { AppSectionItemState } from './AppSectionState'; export type DiskSpaceAppState = AppSectionState; export type HealthAppState = AppSectionState; export type SystemStatusAppState = AppSectionItemState; -export type UpdateAppState = AppSectionState; export type TaskAppState = AppSectionState; +export type UpdateAppState = AppSectionState; interface SystemAppState { diskSpace: DiskSpaceAppState; health: HealthAppState; - updates: UpdateAppState; status: SystemStatusAppState; tasks: TaskAppState; + updates: UpdateAppState; } export default SystemAppState; diff --git a/frontend/src/Commands/Command.ts b/frontend/src/Commands/Command.ts index d0797a79a..ed0a449ab 100644 --- a/frontend/src/Commands/Command.ts +++ b/frontend/src/Commands/Command.ts @@ -26,7 +26,7 @@ export interface CommandBody { seriesId?: number; seriesIds?: number[]; seasonNumber?: number; - [key: string]: string | number | boolean | undefined | number[] | undefined; + [key: string]: string | number | boolean | number[] | undefined; } interface Command extends ModelBase { diff --git a/frontend/src/Components/Form/SeriesTypeSelectInput.tsx b/frontend/src/Components/Form/SeriesTypeSelectInput.tsx index cea7f4fb5..17082c75c 100644 --- a/frontend/src/Components/Form/SeriesTypeSelectInput.tsx +++ b/frontend/src/Components/Form/SeriesTypeSelectInput.tsx @@ -46,9 +46,9 @@ function SeriesTypeSelectInput(props: SeriesTypeSelectInputProps) { const values = [...seriesTypeOptions]; const { - includeNoChange, + includeNoChange = false, includeNoChangeDisabled = true, - includeMixed, + includeMixed = false, } = props; if (includeNoChange) { @@ -77,9 +77,4 @@ function SeriesTypeSelectInput(props: SeriesTypeSelectInputProps) { ); } -SeriesTypeSelectInput.defaultProps = { - includeNoChange: false, - includeMixed: false, -}; - export default SeriesTypeSelectInput; diff --git a/frontend/src/System/Status/Status.tsx b/frontend/src/System/Status/Status.tsx index ae1636b3e..74fdf25d8 100644 --- a/frontend/src/System/Status/Status.tsx +++ b/frontend/src/System/Status/Status.tsx @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React from 'react'; import PageContent from 'Components/Page/PageContent'; import PageContentBody from 'Components/Page/PageContentBody'; import translate from 'Utilities/String/translate'; @@ -7,22 +7,17 @@ import DiskSpace from './DiskSpace/DiskSpace'; import Health from './Health/Health'; import MoreInfo from './MoreInfo/MoreInfo'; -class Status extends Component { - // - // Render - - render() { - return ( - - - - - - - - - ); - } +function Status() { + return ( + + + + + + + + + ); } export default Status;