diff --git a/frontend/src/MovieFile/ExtraFile.ts b/frontend/src/MovieFile/ExtraFile.ts new file mode 100644 index 000000000..68fddcc2c --- /dev/null +++ b/frontend/src/MovieFile/ExtraFile.ts @@ -0,0 +1 @@ +export type ExtraFileType = 'subtitle' | 'metadata' | 'other'; diff --git a/frontend/src/MovieFile/Extras/ExtraFileDetailsPopover.tsx b/frontend/src/MovieFile/Extras/ExtraFileDetailsPopover.tsx new file mode 100644 index 000000000..7f4ee2da5 --- /dev/null +++ b/frontend/src/MovieFile/Extras/ExtraFileDetailsPopover.tsx @@ -0,0 +1,56 @@ +import React from 'react'; +import IconButton from 'Components/Link/IconButton'; +import Popover from 'Components/Tooltip/Popover'; +import { icons, tooltipPositions } from 'Helpers/Props'; +import { ExtraFileType } from 'MovieFile/ExtraFile'; +import translate from 'Utilities/String/translate'; + +interface ExtraFileDetailsPopoverProps { + type: ExtraFileType; + title?: string; + languageTags?: string[]; +} + +function ExtraFileDetailsPopover(props: ExtraFileDetailsPopoverProps) { + const { type, title, languageTags = [] } = props; + + const details = []; + + if (type === 'subtitle') { + if (title) { + details.push({ name: translate('Title'), value: title }); + } + + if (languageTags.length) { + details.push({ + name: translate('Disposition'), + value: languageTags.join(', '), + }); + } + } + + if (details.length) { + return ( + } + title={translate('Tags')} + body={ + + } + position={tooltipPositions.LEFT} + /> + ); + } + + return ''; +} + +export default ExtraFileDetailsPopover; diff --git a/frontend/src/MovieFile/Extras/ExtraFileRow.js b/frontend/src/MovieFile/Extras/ExtraFileRow.js index d0888db2c..7d75682a7 100644 --- a/frontend/src/MovieFile/Extras/ExtraFileRow.js +++ b/frontend/src/MovieFile/Extras/ExtraFileRow.js @@ -1,10 +1,9 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; -import IconButton from 'Components/Link/IconButton'; import TableRowCell from 'Components/Table/Cells/TableRowCell'; import TableRow from 'Components/Table/TableRow'; -import { icons } from 'Helpers/Props'; import titleCase from 'Utilities/String/titleCase'; +import ExtraFileDetailsPopover from './ExtraFileDetailsPopover'; import styles from './ExtraFileRow.css'; class ExtraFileRow extends Component { @@ -16,7 +15,9 @@ class ExtraFileRow extends Component { const { relativePath, extension, - type + type, + title, + languageTags } = this.props; return ( @@ -43,8 +44,10 @@ class ExtraFileRow extends Component { - @@ -57,7 +60,9 @@ ExtraFileRow.propTypes = { id: PropTypes.number.isRequired, extension: PropTypes.string.isRequired, type: PropTypes.string.isRequired, - relativePath: PropTypes.string.isRequired + relativePath: PropTypes.string.isRequired, + title: PropTypes.string, + languageTags: PropTypes.arrayOf(PropTypes.string) }; export default ExtraFileRow; diff --git a/src/NzbDrone.Core/Localization/Core/en.json b/src/NzbDrone.Core/Localization/Core/en.json index 468b1e186..7b68840d6 100644 --- a/src/NzbDrone.Core/Localization/Core/en.json +++ b/src/NzbDrone.Core/Localization/Core/en.json @@ -376,6 +376,7 @@ "DiscordUrlInSlackNotification": "You have a Discord notification setup as a Slack notification. Set this up as a Discord notification for better functionality. The effected notifications are: {0}", "Discover": "Discover", "DiskSpace": "Disk Space", + "Disposition": "Disposition", "DoNotBlocklist": "Do not Blocklist", "DoNotBlocklistHint": "Remove without blocklisting", "DoNotPrefer": "Do Not Prefer", diff --git a/src/Radarr.Api.V3/ExtraFiles/ExtraFileResource.cs b/src/Radarr.Api.V3/ExtraFiles/ExtraFileResource.cs index 9d465ee7d..6233eb2f3 100644 --- a/src/Radarr.Api.V3/ExtraFiles/ExtraFileResource.cs +++ b/src/Radarr.Api.V3/ExtraFiles/ExtraFileResource.cs @@ -14,6 +14,8 @@ namespace Radarr.Api.V3.ExtraFiles public int? MovieFileId { get; set; } public string RelativePath { get; set; } public string Extension { get; set; } + public List LanguageTags { get; set; } + public string Title { get; set; } public ExtraFileType Type { get; set; } } @@ -51,6 +53,8 @@ namespace Radarr.Api.V3.ExtraFiles MovieFileId = model.MovieFileId, RelativePath = model.RelativePath, Extension = model.Extension, + LanguageTags = model.LanguageTags, + Title = model.Title, Type = ExtraFileType.Subtitle }; }