New: Add The TVDB link to library import search results

Closes #4996
This commit is contained in:
Mark McDowall 2022-04-24 12:30:20 -07:00
parent fa4b80b86f
commit 893a6744ac
4 changed files with 60 additions and 32 deletions

View File

@ -1,4 +1,5 @@
.series { .container {
display: flex;
padding: 10px 20px; padding: 10px 20px;
width: 100%; width: 100%;
@ -6,3 +7,19 @@
background-color: $menuItemHoverBackgroundColor; background-color: $menuItemHoverBackgroundColor;
} }
} }
.series {
flex: 1 0 0;
overflow: hidden;
}
.tvdbLink {
composes: link from '~Components/Link/Link.css';
margin-left: auto;
color: $textColor;
}
.tvdbLinkIcon {
margin-left: 10px;
}

View File

@ -1,33 +1,28 @@
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { useCallback } from 'react';
import { icons } from 'Helpers/Props';
import Link from 'Components/Link/Link'; import Link from 'Components/Link/Link';
import Icon from 'Components/Icon';
import ImportSeriesTitle from './ImportSeriesTitle'; import ImportSeriesTitle from './ImportSeriesTitle';
import styles from './ImportSeriesSearchResult.css'; import styles from './ImportSeriesSearchResult.css';
class ImportSeriesSearchResult extends Component { function ImportSeriesSearchResult(props) {
const {
tvdbId,
title,
year,
network,
isExistingSeries,
onPress
} = props;
// const onPressCallback = useCallback(() => onPress(tvdbId), [tvdbId, onPress]);
// Listeners
onPress = () => { return (
this.props.onPress(this.props.tvdbId); <div className={styles.container}>
}
//
// Render
render() {
const {
title,
year,
network,
isExistingSeries
} = this.props;
return (
<Link <Link
className={styles.series} className={styles.series}
onPress={this.onPress} onPress={onPressCallback}
> >
<ImportSeriesTitle <ImportSeriesTitle
title={title} title={title}
@ -36,8 +31,19 @@ class ImportSeriesSearchResult extends Component {
isExistingSeries={isExistingSeries} isExistingSeries={isExistingSeries}
/> />
</Link> </Link>
);
} <Link
className={styles.tvdbLink}
to={`http://www.thetvdb.com/?tab=series&id=${tvdbId}`}
>
<Icon
className={styles.tvdbLinkIcon}
name={icons.EXTERNAL_LINK}
size={16}
/>
</Link>
</div>
);
} }
ImportSeriesSearchResult.propTypes = { ImportSeriesSearchResult.propTypes = {

View File

@ -20,24 +20,27 @@ function ImportSeriesTitle(props) {
{ {
!title.contains(year) && !title.contains(year) &&
year > 0 && year > 0 ?
<span className={styles.year}> <span className={styles.year}>
({year}) ({year})
</span> </span> :
null
} }
{ {
!!network && network ?
<Label>{network}</Label> <Label>{network}</Label> :
null
} }
{ {
isExistingSeries && isExistingSeries ?
<Label <Label
kind={kinds.WARNING} kind={kinds.WARNING}
> >
Existing Existing
</Label> </Label> :
null
} }
</div> </div>
); );

View File

@ -103,6 +103,7 @@ class VirtualTable extends Component {
scroller, scroller,
header, header,
headerHeight, headerHeight,
rowHeight,
rowRenderer, rowRenderer,
...otherProps ...otherProps
} = this.props; } = this.props;
@ -153,7 +154,7 @@ class VirtualTable extends Component {
width={width} width={width}
height={height} height={height}
headerHeight={height - headerHeight} headerHeight={height - headerHeight}
rowHeight={ROW_HEIGHT} rowHeight={rowHeight}
rowCount={items.length} rowCount={items.length}
columnCount={1} columnCount={1}
columnWidth={width} columnWidth={width}
@ -194,7 +195,8 @@ VirtualTable.propTypes = {
VirtualTable.defaultProps = { VirtualTable.defaultProps = {
className: styles.tableContainer, className: styles.tableContainer,
headerHeight: 38 headerHeight: 38,
rowHeight: ROW_HEIGHT
}; };
export default VirtualTable; export default VirtualTable;