mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-18 21:35:27 -04:00
Convert SelectSeriesRow to TypeScript
This commit is contained in:
@@ -66,7 +66,7 @@ interface RowItemData {
|
||||
}
|
||||
|
||||
function Row({ index, style, data }: ListChildComponentProps<RowItemData>) {
|
||||
const { items, columns, onSeriesSelect } = data;
|
||||
const { items, onSeriesSelect } = data;
|
||||
const series = index >= items.length ? null : items[index];
|
||||
|
||||
const handlePress = useCallback(() => {
|
||||
@@ -90,13 +90,10 @@ function Row({ index, style, data }: ListChildComponentProps<RowItemData>) {
|
||||
>
|
||||
<SelectSeriesRow
|
||||
key={series.id}
|
||||
id={series.id}
|
||||
title={series.title}
|
||||
tvdbId={series.tvdbId}
|
||||
imdbId={series.imdbId}
|
||||
year={series.year}
|
||||
columns={columns}
|
||||
onSeriesSelect={onSeriesSelect}
|
||||
/>
|
||||
</VirtualTableRowButton>
|
||||
);
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import Label from 'Components/Label';
|
||||
import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell';
|
||||
import styles from './SelectSeriesRow.css';
|
||||
|
||||
class SelectSeriesRow extends Component {
|
||||
|
||||
//
|
||||
// Listeners
|
||||
|
||||
onPress = () => {
|
||||
this.props.onSeriesSelect(this.props.id);
|
||||
};
|
||||
|
||||
//
|
||||
// Render
|
||||
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
<VirtualTableRowCell className={styles.title}>
|
||||
{this.props.title}
|
||||
</VirtualTableRowCell>
|
||||
|
||||
<VirtualTableRowCell className={styles.year}>
|
||||
{this.props.year}
|
||||
</VirtualTableRowCell>
|
||||
|
||||
<VirtualTableRowCell className={styles.tvdbId}>
|
||||
<Label>{this.props.tvdbId}</Label>
|
||||
</VirtualTableRowCell>
|
||||
|
||||
<VirtualTableRowCell className={styles.imdbId}>
|
||||
{
|
||||
this.props.imdbId ?
|
||||
<Label>{this.props.imdbId}</Label> :
|
||||
null
|
||||
}
|
||||
</VirtualTableRowCell>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SelectSeriesRow.propTypes = {
|
||||
id: PropTypes.number.isRequired,
|
||||
title: PropTypes.string.isRequired,
|
||||
tvdbId: PropTypes.number.isRequired,
|
||||
imdbId: PropTypes.string,
|
||||
year: PropTypes.number.isRequired,
|
||||
onSeriesSelect: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
export default SelectSeriesRow;
|
||||
38
frontend/src/InteractiveImport/Series/SelectSeriesRow.tsx
Normal file
38
frontend/src/InteractiveImport/Series/SelectSeriesRow.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import React from 'react';
|
||||
import Label from 'Components/Label';
|
||||
import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell';
|
||||
import styles from './SelectSeriesRow.css';
|
||||
|
||||
interface SelectSeriesRowProps {
|
||||
title: string;
|
||||
tvdbId: number;
|
||||
imdbId?: string;
|
||||
year: number;
|
||||
}
|
||||
|
||||
function SelectSeriesRow({
|
||||
title,
|
||||
year,
|
||||
tvdbId,
|
||||
imdbId,
|
||||
}: SelectSeriesRowProps) {
|
||||
return (
|
||||
<>
|
||||
<VirtualTableRowCell className={styles.title}>
|
||||
{title}
|
||||
</VirtualTableRowCell>
|
||||
|
||||
<VirtualTableRowCell className={styles.year}>{year}</VirtualTableRowCell>
|
||||
|
||||
<VirtualTableRowCell className={styles.tvdbId}>
|
||||
<Label>{tvdbId}</Label>
|
||||
</VirtualTableRowCell>
|
||||
|
||||
<VirtualTableRowCell className={styles.imdbId}>
|
||||
{imdbId ? <Label>{imdbId}</Label> : null}
|
||||
</VirtualTableRowCell>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default SelectSeriesRow;
|
||||
Reference in New Issue
Block a user