Skip to content

Commit

Permalink
New: Add The TVDB link to library import search results
Browse files Browse the repository at this point in the history
Closes #4996
  • Loading branch information
markus101 committed Apr 24, 2022
1 parent fa4b80b commit 893a674
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
.series {
.container {
display: flex;
padding: 10px 20px;
width: 100%;

&:hover {
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;
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
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 Icon from 'Components/Icon';
import ImportSeriesTitle from './ImportSeriesTitle';
import styles from './ImportSeriesSearchResult.css';

class ImportSeriesSearchResult extends Component {
function ImportSeriesSearchResult(props) {
const {
tvdbId,
title,
year,
network,
isExistingSeries,
onPress
} = props;

//
// Listeners
const onPressCallback = useCallback(() => onPress(tvdbId), [tvdbId, onPress]);

onPress = () => {
this.props.onPress(this.props.tvdbId);
}

//
// Render

render() {
const {
title,
year,
network,
isExistingSeries
} = this.props;

return (
return (
<div className={styles.container}>
<Link
className={styles.series}
onPress={this.onPress}
onPress={onPressCallback}
>
<ImportSeriesTitle
title={title}
Expand All @@ -36,8 +31,19 @@ class ImportSeriesSearchResult extends Component {
isExistingSeries={isExistingSeries}
/>
</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 = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,27 @@ function ImportSeriesTitle(props) {

{
!title.contains(year) &&
year > 0 &&
year > 0 ?
<span className={styles.year}>
({year})
</span>
</span> :
null
}

{
!!network &&
<Label>{network}</Label>
network ?
<Label>{network}</Label> :
null
}

{
isExistingSeries &&
isExistingSeries ?
<Label
kind={kinds.WARNING}
>
Existing
</Label>
</Label> :
null
}
</div>
);
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/Components/Table/VirtualTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class VirtualTable extends Component {
scroller,
header,
headerHeight,
rowHeight,
rowRenderer,
...otherProps
} = this.props;
Expand Down Expand Up @@ -153,7 +154,7 @@ class VirtualTable extends Component {
width={width}
height={height}
headerHeight={height - headerHeight}
rowHeight={ROW_HEIGHT}
rowHeight={rowHeight}
rowCount={items.length}
columnCount={1}
columnWidth={width}
Expand Down Expand Up @@ -194,7 +195,8 @@ VirtualTable.propTypes = {

VirtualTable.defaultProps = {
className: styles.tableContainer,
headerHeight: 38
headerHeight: 38,
rowHeight: ROW_HEIGHT
};

export default VirtualTable;

0 comments on commit 893a674

Please sign in to comment.