diff --git a/web/src/components/DialogTorrentDetailsContent/index.jsx b/web/src/components/DialogTorrentDetailsContent/index.jsx index 16648d3..dea5b57 100644 --- a/web/src/components/DialogTorrentDetailsContent/index.jsx +++ b/web/src/components/DialogTorrentDetailsContent/index.jsx @@ -37,8 +37,6 @@ import { } from './style' import StatisticsField from './StatisticsField' -ptt.addHandler('part', /Part[. ]([0-9])/i, { type: 'integer' }) - const shortenText = (text, count) => text.slice(0, count) + (text.length > count ? '...' : '') export default function DialogTorrentDetailsContent({ closeDialog, torrent }) { @@ -76,6 +74,10 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) { const getFileLink = (path, id) => `${streamHost()}/${encodeURIComponent(path.split('\\').pop().split('/').pop())}?link=${hash}&index=${id}&play` + const fileHasEpisodeText = !!playableFileList?.find(({ path }) => ptt.parse(path).episode) + const fileHasSeasonText = !!playableFileList?.find(({ path }) => ptt.parse(path).season) + const fileHasResolutionText = !!playableFileList?.find(({ path }) => ptt.parse(path).resolution) + const { Capacity, PiecesCount, PiecesLength, Filled } = cache useEffect(() => { @@ -220,24 +222,6 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) { - - {/* - - - - - - */} @@ -269,113 +253,61 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) { Torrent Content - - - - - - - - - - - - + {!playableFileList?.length ? ( + 'No playable files in this torrent' + ) : ( + <> +
viewednameseasonepisoderesolutionsizeactions
+ + + + + {fileHasSeasonText && } + {fileHasEpisodeText && } + {fileHasResolutionText && } + + + + - - - - - - - - - + + {playableFileList.map(({ id, path, length }) => { + const { title, resolution, episode, season } = ptt.parse(path) + const isViewed = viewedFileList?.includes(id) + const link = getFileLink(path, id) - - - - - - - - + return ( + + + {fileHasSeasonText && } + {fileHasEpisodeText && } + {fileHasResolutionText && } + + - - - - - - - - -
viewednameseasonepisoderesolutionsizeactions
- Jupiters Legacy311080p945,41 MB - - - -
- Jupiters Legacy321080p712,47 MB - - - -
+ {title}{season}{episode}{resolution}{humanizeSize(length)} + -
- Jupiters Legacy331080p687,44 MB - - - -
+ + + - {!playableFileList?.length - ? 'No playable files in this torrent' - : playableFileList.map(({ id, path, length }) => { - { - /* console.log(ptt.parse(path)) */ - } - { - /* console.log({ title: ptt.parse(path).title }) - console.log({ resolution: ptt.parse(path).resolution }) - console.log({ episode: ptt.parse(path).episode }) - console.log({ season: ptt.parse(path).season }) */ - } - - return ( - - - - - - ) - })} + + + + + + ) + })} + + + + )}
)} diff --git a/web/src/components/DialogTorrentDetailsContent/style.js b/web/src/components/DialogTorrentDetailsContent/style.js index 0cd7a50..60af08e 100644 --- a/web/src/components/DialogTorrentDetailsContent/style.js +++ b/web/src/components/DialogTorrentDetailsContent/style.js @@ -213,7 +213,6 @@ export const Table = styled.table` } &.viewed-file-row { - color: lightgray; background: #f3f3f3; } }