From 7dbfa74c407523ba9e4ef2a19fc8fe6aed871bec Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 4 Sep 2023 05:53:33 +0300 Subject: [PATCH] Add external links for indexer history --- frontend/src/App/State/HistoryAppState.ts | 2 + frontend/src/History/HistoryRowParameter.js | 43 ------------------ frontend/src/History/HistoryRowParameter.tsx | 44 +++++++++++++++++++ .../Info/History/IndexerHistoryRow.tsx | 2 +- 4 files changed, 47 insertions(+), 44 deletions(-) delete mode 100644 frontend/src/History/HistoryRowParameter.js create mode 100644 frontend/src/History/HistoryRowParameter.tsx diff --git a/frontend/src/App/State/HistoryAppState.ts b/frontend/src/App/State/HistoryAppState.ts index dbce6bd7c..357ed29f0 100644 --- a/frontend/src/App/State/HistoryAppState.ts +++ b/frontend/src/App/State/HistoryAppState.ts @@ -1,8 +1,10 @@ import AppSectionState from 'App/State/AppSectionState'; +import Column from 'Components/Table/Column'; import History from 'typings/History'; interface HistoryAppState extends AppSectionState { pageSize: number; + columns: Column[]; } export default HistoryAppState; diff --git a/frontend/src/History/HistoryRowParameter.js b/frontend/src/History/HistoryRowParameter.js deleted file mode 100644 index 6b79e32fa..000000000 --- a/frontend/src/History/HistoryRowParameter.js +++ /dev/null @@ -1,43 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import styles from './HistoryRowParameter.css'; - -class HistoryRowParameter extends Component { - - // - // Render - - render() { - const { - title, - value - } = this.props; - - return ( -
-
- - { - title - } - -
- -
- { - value - } -
-
- ); - } -} - -HistoryRowParameter.propTypes = { - title: PropTypes.string.isRequired, - value: PropTypes.string.isRequired -}; - -export default HistoryRowParameter; diff --git a/frontend/src/History/HistoryRowParameter.tsx b/frontend/src/History/HistoryRowParameter.tsx new file mode 100644 index 000000000..0e55c65b3 --- /dev/null +++ b/frontend/src/History/HistoryRowParameter.tsx @@ -0,0 +1,44 @@ +import React from 'react'; +import Link from 'Components/Link/Link'; +import styles from './HistoryRowParameter.css'; + +interface HistoryRowParameterProps { + title: string; + value: string; +} + +function HistoryRowParameter(props: HistoryRowParameterProps) { + const { title, value } = props; + + const type = title.toLowerCase(); + + let link = null; + + if (type === 'imdb') { + link = {value}; + } else if (type === 'tmdb') { + link = ( + {value} + ); + } else if (type === 'tvdb') { + link = ( + + {value} + + ); + } else if (type === 'tvmaze') { + link = {value}; + } + + return ( +
+
+ {title} +
+ +
{link ? link : value}
+
+ ); +} + +export default HistoryRowParameter; diff --git a/frontend/src/Indexer/Info/History/IndexerHistoryRow.tsx b/frontend/src/Indexer/Info/History/IndexerHistoryRow.tsx index 379d524ff..455b5106d 100644 --- a/frontend/src/Indexer/Info/History/IndexerHistoryRow.tsx +++ b/frontend/src/Indexer/Info/History/IndexerHistoryRow.tsx @@ -67,7 +67,7 @@ function IndexerHistoryRow(props: IndexerHistoryRowProps) { ); })}