parent
aceaaa10e1
commit
311cd66fcd
@ -1,68 +0,0 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
import Link from 'Components/Link/Link';
|
||||
import EpisodeDetailsModal from 'Episode/EpisodeDetailsModal';
|
||||
import styles from './EpisodeTitleLink.css';
|
||||
|
||||
class EpisodeTitleLink extends Component {
|
||||
|
||||
//
|
||||
// Lifecycle
|
||||
|
||||
constructor(props, context) {
|
||||
super(props, context);
|
||||
|
||||
this.state = {
|
||||
isDetailsModalOpen: false
|
||||
};
|
||||
}
|
||||
|
||||
//
|
||||
// Listeners
|
||||
|
||||
onLinkPress = () => {
|
||||
this.setState({ isDetailsModalOpen: true });
|
||||
};
|
||||
|
||||
onModalClose = () => {
|
||||
this.setState({ isDetailsModalOpen: false });
|
||||
};
|
||||
|
||||
//
|
||||
// Render
|
||||
|
||||
render() {
|
||||
const {
|
||||
episodeTitle,
|
||||
...otherProps
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Link
|
||||
className={styles.link}
|
||||
onPress={this.onLinkPress}
|
||||
>
|
||||
{episodeTitle}
|
||||
</Link>
|
||||
|
||||
<EpisodeDetailsModal
|
||||
isOpen={this.state.isDetailsModalOpen}
|
||||
episodeTitle={episodeTitle}
|
||||
{...otherProps}
|
||||
onModalClose={this.onModalClose}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
EpisodeTitleLink.propTypes = {
|
||||
episodeTitle: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
EpisodeTitleLink.defaultProps = {
|
||||
showSeriesButton: false
|
||||
};
|
||||
|
||||
export default EpisodeTitleLink;
|
@ -0,0 +1,46 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import Link from 'Components/Link/Link';
|
||||
import EpisodeDetailsModal from 'Episode/EpisodeDetailsModal';
|
||||
import FinaleType from './FinaleType';
|
||||
import styles from './EpisodeTitleLink.css';
|
||||
|
||||
interface EpisodeTitleLinkProps {
|
||||
episodeTitle: string;
|
||||
finaleType?: string;
|
||||
}
|
||||
|
||||
function EpisodeTitleLink(props: EpisodeTitleLinkProps) {
|
||||
const { episodeTitle, finaleType, ...otherProps } = props;
|
||||
const [isDetailsModalOpen, setIsDetailsModalOpen] = useState(false);
|
||||
const handleLinkPress = useCallback(() => {
|
||||
setIsDetailsModalOpen(true);
|
||||
}, [setIsDetailsModalOpen]);
|
||||
const handleModalClose = useCallback(() => {
|
||||
setIsDetailsModalOpen(false);
|
||||
}, [setIsDetailsModalOpen]);
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Link className={styles.link} onPress={handleLinkPress}>
|
||||
{episodeTitle}
|
||||
</Link>
|
||||
|
||||
{finaleType ? <FinaleType finaleType={finaleType} /> : null}
|
||||
|
||||
<EpisodeDetailsModal
|
||||
isOpen={isDetailsModalOpen}
|
||||
episodeTitle={episodeTitle}
|
||||
{...otherProps}
|
||||
onModalClose={handleModalClose}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
EpisodeTitleLink.propTypes = {
|
||||
episodeTitle: PropTypes.string.isRequired,
|
||||
finaleType: PropTypes.string,
|
||||
};
|
||||
|
||||
export default EpisodeTitleLink;
|
@ -0,0 +1,5 @@
|
||||
.label {
|
||||
composes: label from '~Components/Label.css';
|
||||
|
||||
margin-left: 10px;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
// This file is automatically generated.
|
||||
// Please do not change this file!
|
||||
interface CssExports {
|
||||
'label': string;
|
||||
}
|
||||
export const cssExports: CssExports;
|
||||
export default cssExports;
|
@ -0,0 +1,29 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import Label from 'Components/Label';
|
||||
import { kinds } from 'Helpers/Props';
|
||||
import getFinaleTypeName from './getFinaleTypeName';
|
||||
import styles from './FinaleType.css';
|
||||
|
||||
interface SeriesStatusCellProps {
|
||||
finaleType: string;
|
||||
}
|
||||
|
||||
function FinaleType(props: SeriesStatusCellProps) {
|
||||
const { finaleType } = props;
|
||||
|
||||
const finaleText = useMemo(() => {
|
||||
return getFinaleTypeName(finaleType);
|
||||
}, [finaleType]);
|
||||
|
||||
if (finaleType == null || finaleText == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Label className={styles.label} kind={kinds.INFO}>
|
||||
{finaleText}
|
||||
</Label>
|
||||
);
|
||||
}
|
||||
|
||||
export default FinaleType;
|
@ -0,0 +1,14 @@
|
||||
import translate from 'Utilities/String/translate';
|
||||
|
||||
export default function getFinaleTypeName(finaleType?: string): string | null {
|
||||
switch (finaleType) {
|
||||
case 'series':
|
||||
return translate('SeriesFinale');
|
||||
case 'season':
|
||||
return translate('SeasonFinale');
|
||||
case 'midseason':
|
||||
return translate('MidseasonFinale');
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(196)]
|
||||
public class add_finale_type : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("Episodes").AddColumn("FinaleType").AsString().Nullable();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue