This commit is contained in:
Daniel Shleifman
2021-06-02 22:46:17 +03:00
parent ad6a36d27c
commit 8d242b8cf0

View File

@@ -9,6 +9,7 @@ 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 { StyledButton, TorrentCard, TorrentCardButtons, TorrentCardDescription, TorrentCardPoster } from './style' import { StyledButton, TorrentCard, TorrentCardButtons, TorrentCardDescription, TorrentCardPoster } from './style'
@@ -31,6 +32,8 @@ export default function 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 parsedTitle = (title || name) && ptt.parse(title || name).title
return ( return (
<> <>
<TorrentCard> <TorrentCard>
@@ -58,7 +61,7 @@ export default function Torrent({ torrent }) {
<TorrentCardDescription> <TorrentCardDescription>
<div className='description-title-wrapper'> <div className='description-title-wrapper'>
<div className='description-section-name'>Name</div> <div className='description-section-name'>Name</div>
<div className='description-torrent-title'>{shortenText(title || name, 100)}</div> <div className='description-torrent-title'>{shortenText(parsedTitle, 100)}</div>
</div> </div>
<div className='description-statistics-wrapper'> <div className='description-statistics-wrapper'>