diff --git a/web/src/components/TorrentCard/index.jsx b/web/src/components/TorrentCard/index.jsx index e3936ad..dc88def 100644 --- a/web/src/components/TorrentCard/index.jsx +++ b/web/src/components/TorrentCard/index.jsx @@ -1,6 +1,5 @@ import 'fontsource-roboto' import { forwardRef, memo, useState } from 'react' -import ptt from 'parse-torrent-title' import { UnfoldMore as UnfoldMoreIcon, Edit as EditIcon, @@ -15,9 +14,9 @@ import Dialog from '@material-ui/core/Dialog' import Slide from '@material-ui/core/Slide' import { Button, DialogActions, DialogTitle, useMediaQuery, useTheme } from '@material-ui/core' import axios from 'axios' +import ptt from 'parse-torrent-title' import { useTranslation } from 'react-i18next' import AddDialog from 'components/Add/AddDialog' -import { isFilePlayable } from 'components/DialogTorrentDetailsContent/helpers' import { StyledButton, TorrentCard, TorrentCardButtons, TorrentCardDescription, TorrentCardPoster } from './style' @@ -41,19 +40,7 @@ const Torrent = ({ torrent }) => { const dropTorrent = () => axios.post(torrentsHost(), { action: 'drop', hash }) const deleteTorrent = () => axios.post(torrentsHost(), { action: 'rem', hash }) - const getParsedData = () => { - const parse = key => ptt.parse(title || '')?.[key] || ptt.parse(name || '')?.[key] - - const parsedYear = parse('year') - const parsedResolution = parse('resolution') - const parsedTitle = parse('title') - - return { parsedResolution, parsedYear, parsedTitle } - } - - const { parsedResolution, parsedYear, parsedTitle } = getParsedData() - - const playableFileAmount = torrent.file_stats?.filter(({ path }) => isFilePlayable(path))?.length + const parsedTitle = (title || name) && ptt.parse(title || name).title const [isEditDialogOpen, setIsEditDialogOpen] = useState(false) const handleClickOpenEditDialog = () => setIsEditDialogOpen(true) @@ -94,29 +81,6 @@ const Torrent = ({ torrent }) => {
{shortenText(parsedTitle, 100)}
-
- {parsedResolution && ( -
-
{t('Resolution')}
-
{parsedResolution}
-
- )} - - {parsedYear && ( -
-
{t('Year')}
-
{parsedYear}
-
- )} - - {playableFileAmount > 1 && ( -
-
{t('Files')}
-
{playableFileAmount}
-
- )} -
-
{t('Size')}
diff --git a/web/src/components/TorrentCard/style.js b/web/src/components/TorrentCard/style.js index cd5dad7..31ca13f 100644 --- a/web/src/components/TorrentCard/style.js +++ b/web/src/components/TorrentCard/style.js @@ -16,13 +16,13 @@ export const TorrentCard = styled.div` 'poster description' 'buttons buttons'; - grid-template-columns: 90px 1fr; - grid-template-rows: 130px max-content; + grid-template-columns: 70px 1fr; + grid-template-rows: 110px max-content; } @media (max-width: 770px) { - grid-template-columns: 80px 1fr; - grid-template-rows: 110px max-content; + grid-template-columns: 60px 1fr; + grid-template-rows: 90px max-content; } ` @@ -79,15 +79,11 @@ export const TorrentCardDescription = styled.div` border-radius: 5px; padding: 5px; display: grid; - grid-template-rows: 40% 1fr 1fr; + grid-template-rows: 55% 1fr; gap: 10px; - @media (max-width: 1260px) { - grid-template-rows: max-content 1fr 1fr; - } - @media (max-width: 770px) { - grid-template-rows: 35% 1fr 1fr; + grid-template-rows: 60% 1fr; gap: 3px; } diff --git a/web/src/locales/en/translation.json b/web/src/locales/en/translation.json index 7264978..02e894a 100644 --- a/web/src/locales/en/translation.json +++ b/web/src/locales/en/translation.json @@ -48,7 +48,6 @@ "EditTorrent": "Edit torrent", "EnableIPv6": "IPv6", "Episode": "Episode", - "Files": "Files", "ForceEncrypt": "Force Encrypt Headers", "FromLatestFile": "From Latest File", "Full": "Full", @@ -114,6 +113,5 @@ "UseDiskDesc": "Better use external media on flash-based devices", "UTP": "μTP (Micro Transport Protocol)", "Viewed": "Viewed", - "WrongTorrentSource": "Wrong torrent source", - "Year": "Year" + "WrongTorrentSource": "Wrong torrent source" } \ No newline at end of file diff --git a/web/src/locales/ru/translation.json b/web/src/locales/ru/translation.json index b4ad1b3..aa93941 100644 --- a/web/src/locales/ru/translation.json +++ b/web/src/locales/ru/translation.json @@ -48,7 +48,6 @@ "EditTorrent": "Изменить торрент", "EnableIPv6": "IPv6", "Episode": "Серия", - "Files": "Файлы", "ForceEncrypt": "Принудительное шифрование заголовков", "FromLatestFile": "C последнего файла", "Full": "Полный", @@ -114,6 +113,5 @@ "UseDiskDesc": "Рекомендуется использовать внешние носители на устройствах с flash-памятью", "UTP": "μTP (Micro Transport Protocol)", "Viewed": "Просм.", - "WrongTorrentSource": "Неправильный torrent-источник", - "Year": "Год" + "WrongTorrentSource": "Неправильный torrent-источник" } \ No newline at end of file