revert details

This commit is contained in:
nikk gitanes
2021-06-16 05:00:26 +03:00
parent 1736f8a2d0
commit 4c400cae09
4 changed files with 10 additions and 54 deletions

View File

@@ -1,6 +1,5 @@
import 'fontsource-roboto' import 'fontsource-roboto'
import { forwardRef, memo, useState } from 'react' import { forwardRef, memo, useState } from 'react'
import ptt from 'parse-torrent-title'
import { import {
UnfoldMore as UnfoldMoreIcon, UnfoldMore as UnfoldMoreIcon,
Edit as EditIcon, Edit as EditIcon,
@@ -15,9 +14,9 @@ import Dialog from '@material-ui/core/Dialog'
import Slide from '@material-ui/core/Slide' import Slide from '@material-ui/core/Slide'
import { Button, DialogActions, DialogTitle, useMediaQuery, useTheme } from '@material-ui/core' import { Button, DialogActions, DialogTitle, useMediaQuery, useTheme } from '@material-ui/core'
import axios from 'axios' import axios from 'axios'
import ptt from 'parse-torrent-title'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import AddDialog from 'components/Add/AddDialog' import AddDialog from 'components/Add/AddDialog'
import { isFilePlayable } from 'components/DialogTorrentDetailsContent/helpers'
import { StyledButton, TorrentCard, TorrentCardButtons, TorrentCardDescription, TorrentCardPoster } from './style' import { StyledButton, TorrentCard, TorrentCardButtons, TorrentCardDescription, TorrentCardPoster } from './style'
@@ -41,19 +40,7 @@ const Torrent = ({ torrent }) => {
const dropTorrent = () => axios.post(torrentsHost(), { action: 'drop', hash }) const dropTorrent = () => axios.post(torrentsHost(), { action: 'drop', hash })
const deleteTorrent = () => axios.post(torrentsHost(), { action: 'rem', hash }) const deleteTorrent = () => axios.post(torrentsHost(), { action: 'rem', hash })
const getParsedData = () => { const parsedTitle = (title || name) && ptt.parse(title || name).title
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 [isEditDialogOpen, setIsEditDialogOpen] = useState(false) const [isEditDialogOpen, setIsEditDialogOpen] = useState(false)
const handleClickOpenEditDialog = () => setIsEditDialogOpen(true) const handleClickOpenEditDialog = () => setIsEditDialogOpen(true)
@@ -94,29 +81,6 @@ const Torrent = ({ torrent }) => {
<div className='description-torrent-title'>{shortenText(parsedTitle, 100)}</div> <div className='description-torrent-title'>{shortenText(parsedTitle, 100)}</div>
</div> </div>
<div className='description-statistics-wrapper'>
{parsedResolution && (
<div className='description-statistics-element-wrapper'>
<div className='description-section-name'>{t('Resolution')}</div>
<div className='description-statistics-element-value'>{parsedResolution}</div>
</div>
)}
{parsedYear && (
<div className='description-statistics-element-wrapper'>
<div className='description-section-name'>{t('Year')}</div>
<div className='description-statistics-element-value'>{parsedYear}</div>
</div>
)}
{playableFileAmount > 1 && (
<div className='description-statistics-element-wrapper'>
<div className='description-section-name'>{t('Files')}</div>
<div className='description-statistics-element-value'>{playableFileAmount}</div>
</div>
)}
</div>
<div className='description-statistics-wrapper'> <div className='description-statistics-wrapper'>
<div className='description-statistics-element-wrapper'> <div className='description-statistics-element-wrapper'>
<div className='description-section-name'>{t('Size')}</div> <div className='description-section-name'>{t('Size')}</div>

View File

@@ -16,13 +16,13 @@ export const TorrentCard = styled.div`
'poster description' 'poster description'
'buttons buttons'; 'buttons buttons';
grid-template-columns: 90px 1fr; grid-template-columns: 70px 1fr;
grid-template-rows: 130px max-content; grid-template-rows: 110px max-content;
} }
@media (max-width: 770px) { @media (max-width: 770px) {
grid-template-columns: 80px 1fr; grid-template-columns: 60px 1fr;
grid-template-rows: 110px max-content; grid-template-rows: 90px max-content;
} }
` `
@@ -79,15 +79,11 @@ export const TorrentCardDescription = styled.div`
border-radius: 5px; border-radius: 5px;
padding: 5px; padding: 5px;
display: grid; display: grid;
grid-template-rows: 40% 1fr 1fr; grid-template-rows: 55% 1fr;
gap: 10px; gap: 10px;
@media (max-width: 1260px) {
grid-template-rows: max-content 1fr 1fr;
}
@media (max-width: 770px) { @media (max-width: 770px) {
grid-template-rows: 35% 1fr 1fr; grid-template-rows: 60% 1fr;
gap: 3px; gap: 3px;
} }

View File

@@ -48,7 +48,6 @@
"EditTorrent": "Edit torrent", "EditTorrent": "Edit torrent",
"EnableIPv6": "IPv6", "EnableIPv6": "IPv6",
"Episode": "Episode", "Episode": "Episode",
"Files": "Files",
"ForceEncrypt": "Force Encrypt Headers", "ForceEncrypt": "Force Encrypt Headers",
"FromLatestFile": "From Latest File", "FromLatestFile": "From Latest File",
"Full": "Full", "Full": "Full",
@@ -114,6 +113,5 @@
"UseDiskDesc": "Better use external media on flash-based devices", "UseDiskDesc": "Better use external media on flash-based devices",
"UTP": "μTP (Micro Transport Protocol)", "UTP": "μTP (Micro Transport Protocol)",
"Viewed": "Viewed", "Viewed": "Viewed",
"WrongTorrentSource": "Wrong torrent source", "WrongTorrentSource": "Wrong torrent source"
"Year": "Year"
} }

View File

@@ -48,7 +48,6 @@
"EditTorrent": "Изменить торрент", "EditTorrent": "Изменить торрент",
"EnableIPv6": "IPv6", "EnableIPv6": "IPv6",
"Episode": "Серия", "Episode": "Серия",
"Files": "Файлы",
"ForceEncrypt": "Принудительное шифрование заголовков", "ForceEncrypt": "Принудительное шифрование заголовков",
"FromLatestFile": "C последнего файла", "FromLatestFile": "C последнего файла",
"Full": "Полный", "Full": "Полный",
@@ -114,6 +113,5 @@
"UseDiskDesc": "Рекомендуется использовать внешние носители на устройствах с flash-памятью", "UseDiskDesc": "Рекомендуется использовать внешние носители на устройствах с flash-памятью",
"UTP": "μTP (Micro Transport Protocol)", "UTP": "μTP (Micro Transport Protocol)",
"Viewed": "Просм.", "Viewed": "Просм.",
"WrongTorrentSource": "Неправильный torrent-источник", "WrongTorrentSource": "Неправильный torrent-источник"
"Year": "Год"
} }