mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
Merge pull request #70 from tsynik/master
change details in card and list
This commit is contained in:
@@ -4,9 +4,9 @@ export const pieceSizeForMiniMap = 23
|
|||||||
export const gapBetweenPieces = 3
|
export const gapBetweenPieces = 3
|
||||||
export const miniCacheMaxHeight = 340
|
export const miniCacheMaxHeight = 340
|
||||||
|
|
||||||
export const defaultBorderColor = '#eef2f4'
|
export const defaultBorderColor = '#dbf2e8'
|
||||||
export const defaultBackgroundColor = '#fff'
|
export const defaultBackgroundColor = '#fff'
|
||||||
export const completeColor = '#00a572'
|
export const completeColor = '#00a572'
|
||||||
export const progressColor = '#ffa724'
|
export const progressColor = '#ffa724'
|
||||||
export const activeColor = '#000'
|
export const activeColor = '#000'
|
||||||
export const rangeColor = '#9a9aff'
|
export const rangeColor = '#ffa724'
|
||||||
|
|||||||
@@ -62,5 +62,5 @@ export const SnakeWrapper = styled.div`
|
|||||||
|
|
||||||
export const PercentagePiece = styled.div`
|
export const PercentagePiece = styled.div`
|
||||||
background: ${completeColor};
|
background: ${completeColor};
|
||||||
height: ${({ percentage }) => (percentage / 100) * 12}px;
|
height: ${({ percentage }) => (percentage)}%;
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { NoImageIcon } from 'icons'
|
import { NoImageIcon } from 'icons'
|
||||||
import { humanizeSize, shortenText } from 'utils/Utils'
|
import { humanizeSize } from 'utils/Utils'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { Button, ButtonGroup } from '@material-ui/core'
|
import { Button, ButtonGroup } from '@material-ui/core'
|
||||||
import ptt from 'parse-torrent-title'
|
import ptt from 'parse-torrent-title'
|
||||||
@@ -110,10 +110,10 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
|||||||
newNameStrings.push(title)
|
newNameStrings.push(title)
|
||||||
} else if (torrentParsedName?.title) newNameStrings.push(torrentParsedName?.title)
|
} else if (torrentParsedName?.title) newNameStrings.push(torrentParsedName?.title)
|
||||||
|
|
||||||
if (torrentParsedName?.year) newNameStrings.push(torrentParsedName?.year)
|
// if (torrentParsedName?.year) newNameStrings.push(torrentParsedName?.year)
|
||||||
if (torrentParsedName?.resolution) newNameStrings.push(torrentParsedName?.resolution)
|
// if (torrentParsedName?.resolution) newNameStrings.push(torrentParsedName?.resolution)
|
||||||
|
|
||||||
return newNameStrings.join('. ')
|
return newNameStrings.join(' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -146,11 +146,11 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
|||||||
<div>
|
<div>
|
||||||
{title && name !== title ? (
|
{title && name !== title ? (
|
||||||
<>
|
<>
|
||||||
<SectionTitle>{shortenText(getParsedTitle(), 55)}</SectionTitle>
|
<SectionTitle>{ptt.parse(name).title}</SectionTitle>
|
||||||
<SectionSubName mb={20}>{shortenText(ptt.parse(name).title, 110)}</SectionSubName>
|
<SectionSubName mb={20}>{getParsedTitle()}</SectionSubName>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<SectionTitle mb={20}>{shortenText(getParsedTitle(), 55)}</SectionTitle>
|
<SectionTitle mb={20}>{getParsedTitle()}</SectionTitle>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<WidgetWrapper>
|
<WidgetWrapper>
|
||||||
|
|||||||
@@ -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,19 @@ 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 getParsedTitle = () => {
|
||||||
const parse = key => ptt.parse(title || '')?.[key] || ptt.parse(name || '')?.[key]
|
const parse = key => ptt.parse(title || '')?.[key] || ptt.parse(name || '')?.[key]
|
||||||
|
const titleStrings = []
|
||||||
|
let parsedTitle = parse('title')
|
||||||
const parsedYear = parse('year')
|
const parsedYear = parse('year')
|
||||||
const parsedResolution = parse('resolution')
|
const parsedResolution = parse('resolution')
|
||||||
const parsedTitle = parse('title')
|
if (parsedTitle) titleStrings.push(parsedTitle)
|
||||||
|
if (parsedYear) titleStrings.push(`(${parsedYear})`)
|
||||||
return { parsedResolution, parsedYear, parsedTitle }
|
if (parsedResolution) titleStrings.push(`[${parsedResolution}]`)
|
||||||
|
parsedTitle = titleStrings.join(' ')
|
||||||
|
return { parsedTitle }
|
||||||
}
|
}
|
||||||
|
const { parsedTitle } = getParsedTitle()
|
||||||
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)
|
||||||
@@ -91,30 +90,7 @@ const Torrent = ({ torrent }) => {
|
|||||||
<TorrentCardDescription>
|
<TorrentCardDescription>
|
||||||
<div className='description-title-wrapper'>
|
<div className='description-title-wrapper'>
|
||||||
<div className='description-section-name'>{t('Name')}</div>
|
<div className='description-section-name'>{t('Name')}</div>
|
||||||
<div className='description-torrent-title'>{shortenText(parsedTitle, 100)}</div>
|
<div className='description-torrent-title'>{shortenText(parsedTitle, 255)}</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>
|
||||||
|
|
||||||
<div className='description-statistics-wrapper'>
|
<div className='description-statistics-wrapper'>
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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",
|
||||||
@@ -60,7 +59,7 @@
|
|||||||
"Offline": "Offline",
|
"Offline": "Offline",
|
||||||
"OK": "OK",
|
"OK": "OK",
|
||||||
"OpenLink": "Open link",
|
"OpenLink": "Open link",
|
||||||
"Peers": "Peers",
|
"Peers": "[Connected] Peers",
|
||||||
"PeersListenPort": "Peers Listen Port",
|
"PeersListenPort": "Peers Listen Port",
|
||||||
"PEX": "PEX (Peer Exchange)",
|
"PEX": "PEX (Peer Exchange)",
|
||||||
"PiecesCount": "Pieces count",
|
"PiecesCount": "Pieces count",
|
||||||
@@ -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"
|
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"About": "О сервере",
|
"About": "О сервере",
|
||||||
"Actions": "Действия",
|
"Actions": "Действия",
|
||||||
"Add": "Добавить",
|
"Add": "Добавить",
|
||||||
"AddDialogTorrentTitle": "Имя (пустой для имени из торрента)",
|
"AddDialogTorrentTitle": "Название (оставьте пустым для имени из торрента)",
|
||||||
"AddFromLink": "Добавить",
|
"AddFromLink": "Добавить",
|
||||||
"AddNewTorrent": "Добавить новый торрент",
|
"AddNewTorrent": "Добавить новый торрент",
|
||||||
"AddPosterLinkInput": "Ссылка на постер",
|
"AddPosterLinkInput": "Ссылка на постер",
|
||||||
@@ -48,7 +48,6 @@
|
|||||||
"EditTorrent": "Изменить торрент",
|
"EditTorrent": "Изменить торрент",
|
||||||
"EnableIPv6": "IPv6",
|
"EnableIPv6": "IPv6",
|
||||||
"Episode": "Серия",
|
"Episode": "Серия",
|
||||||
"Files": "Файлы",
|
|
||||||
"ForceEncrypt": "Принудительное шифрование заголовков",
|
"ForceEncrypt": "Принудительное шифрование заголовков",
|
||||||
"FromLatestFile": "C последнего файла",
|
"FromLatestFile": "C последнего файла",
|
||||||
"Full": "Полный",
|
"Full": "Полный",
|
||||||
@@ -60,7 +59,7 @@
|
|||||||
"Offline": "Сервер не доступен",
|
"Offline": "Сервер не доступен",
|
||||||
"OK": "OK",
|
"OK": "OK",
|
||||||
"OpenLink": "Открыть",
|
"OpenLink": "Открыть",
|
||||||
"Peers": "Подкл./Пиры",
|
"Peers": "[Подкл.] Пиры",
|
||||||
"PeersListenPort": "Порт для входящих подключений",
|
"PeersListenPort": "Порт для входящих подключений",
|
||||||
"PEX": "PEX (Peer Exchange)",
|
"PEX": "PEX (Peer Exchange)",
|
||||||
"PiecesCount": "Кол-во блоков",
|
"PiecesCount": "Кол-во блоков",
|
||||||
@@ -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": "Год"
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
export function humanizeSize(size) {
|
export function humanizeSize(size) {
|
||||||
if (!size) return ''
|
if (!size) return ''
|
||||||
const i = Math.floor(Math.log(size) / Math.log(1024))
|
const i = Math.floor(Math.log(size) / Math.log(1024))
|
||||||
return `${(size / Math.pow(1024, i)).toFixed(2) * 1} ${['B', 'kB', 'MB', 'GB', 'TB'][i]}`
|
return `${(size / Math.pow(1024, i)).toFixed(2) * 1} ${['B', 'KB', 'MB', 'GB', 'TB'][i]}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPeerString(torrent) {
|
export function getPeerString(torrent) {
|
||||||
@@ -10,4 +10,4 @@ export function getPeerString(torrent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const shortenText = (text, sympolAmount) =>
|
export const shortenText = (text, sympolAmount) =>
|
||||||
text ? text.slice(0, sympolAmount) + (text.length > sympolAmount ? '...' : '') : ''
|
text ? text.slice(0, sympolAmount) + (text.length > sympolAmount ? '…' : '') : ''
|
||||||
|
|||||||
Reference in New Issue
Block a user