diff --git a/web/src/components/Add/AddDialog.jsx b/web/src/components/Add/AddDialog.jsx index 4c8d5b5..aa59b0b 100644 --- a/web/src/components/Add/AddDialog.jsx +++ b/web/src/components/Add/AddDialog.jsx @@ -15,7 +15,13 @@ import { ButtonWrapper, Content, Header } from './style' import RightSideComponent from './RightSideComponent' import LeftSideComponent from './LeftSideComponent' -export default function AddDialog({ handleClose, hash: originalHash, title: originalTitle, poster: originalPoster }) { +export default function AddDialog({ + handleClose, + hash: originalHash, + title: originalTitle, + name: originalName, + poster: originalPoster, +}) { const { t } = useTranslation() const [torrentSource, setTorrentSource] = useState(originalHash || '') const [title, setTitle] = useState(originalTitle || '') @@ -110,7 +116,7 @@ export default function AddDialog({ handleClose, hash: originalHash, title: orig posterSearch(title, posterSearchLanguage) setSkipDebounce(false) } else { - delayedPosterSearch(title, posterSearchLanguage) + title === '' ? removePoster() : delayedPosterSearch(title, posterSearchLanguage) } }, [title, prevTitleState, delayedPosterSearch, posterSearch, posterSearchLanguage, skipDebounce]) @@ -132,7 +138,14 @@ export default function AddDialog({ handleClose, hash: originalHash, title: orig setIsLoadingButton(true) if (isEditMode) { - axios.post(torrentsHost(), { action: 'set', hash: originalHash, title, poster: posterUrl }).finally(handleClose) + axios + .post(torrentsHost(), { + action: 'set', + hash: originalHash, + title: title === '' ? originalName : title, + poster: posterUrl, + }) + .finally(handleClose) } else if (selectedFile) { // file save const data = new FormData() diff --git a/web/src/components/DialogTorrentDetailsContent/index.jsx b/web/src/components/DialogTorrentDetailsContent/index.jsx index dc0fd45..f111305 100644 --- a/web/src/components/DialogTorrentDetailsContent/index.jsx +++ b/web/src/components/DialogTorrentDetailsContent/index.jsx @@ -100,17 +100,20 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) { }, [hash]) const bufferSize = settings?.PreloadBuffer ? Capacity : 33554432 // Default is 32mb if PreloadBuffer is false - // const bufferSize = Capacity - const getTitle = value => { - const torrentParsedName = value && ptt.parse(value) + const getParsedTitle = () => { const newNameStrings = [] - if (torrentParsedName?.title) newNameStrings.push(` ${torrentParsedName?.title}`) - if (torrentParsedName?.year) newNameStrings.push(`. ${torrentParsedName?.year}.`) - if (torrentParsedName?.resolution) newNameStrings.push(` (${torrentParsedName?.resolution})`) + const torrentParsedName = name && ptt.parse(name) - return newNameStrings.join(' ') + if (title !== name) { + newNameStrings.push(title) + } else if (torrentParsedName?.title) newNameStrings.push(torrentParsedName?.title) + + if (torrentParsedName?.year) newNameStrings.push(torrentParsedName?.year) + if (torrentParsedName?.resolution) newNameStrings.push(torrentParsedName?.resolution) + + return newNameStrings.join('. ') } return ( @@ -141,13 +144,13 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) { {poster ? poster : }
- {name && name !== title ? ( + {title && name !== title ? ( <> - {shortenText(getTitle(name), 50)} - {shortenText(title, 160)} + {shortenText(getParsedTitle(), 55)} + {shortenText(ptt.parse(name).title, 110)} ) : ( - {shortenText(getTitle(title), 50)} + {shortenText(getParsedTitle(), 55)} )} diff --git a/web/src/components/TorrentCard/index.jsx b/web/src/components/TorrentCard/index.jsx index 9dbab62..dc88def 100644 --- a/web/src/components/TorrentCard/index.jsx +++ b/web/src/components/TorrentCard/index.jsx @@ -134,7 +134,9 @@ const Torrent = ({ torrent }) => { - {isEditDialogOpen && } + {isEditDialogOpen && ( + + )} ) }