expose playlist to main screen and move edit to poster

This commit is contained in:
nikk gitanes
2021-08-20 14:19:23 +03:00
parent d386873a0b
commit 00439e64cf
4 changed files with 15 additions and 6 deletions

View File

@@ -1,12 +1,12 @@
import { forwardRef, memo, useState } from 'react'
import {
UnfoldMore as UnfoldMoreIcon,
Edit as EditIcon,
PlayArrow as PlayArrowIcon,
Close as CloseIcon,
Delete as DeleteIcon,
} from '@material-ui/icons'
import { getPeerString, humanizeSize, humanizeSpeed, removeRedundantCharacters } from 'utils/Utils'
import { torrentsHost } from 'utils/Hosts'
import { playlistTorrHost, torrentsHost } from 'utils/Hosts'
import { NoImageIcon } from 'icons'
import DialogTorrentDetailsContent from 'components/DialogTorrentDetailsContent'
import Dialog from '@material-ui/core/Dialog'
@@ -59,10 +59,12 @@ const Torrent = ({ torrent }) => {
const handleClickOpenEditDialog = () => setIsEditDialogOpen(true)
const handleCloseEditDialog = () => setIsEditDialogOpen(false)
const fullPlaylistLink = `${playlistTorrHost()}/${encodeURIComponent(parsedTitle || 'file')}.m3u?link=${hash}&m3u`
return (
<>
<TorrentCard>
<TorrentCardPoster isPoster={poster}>
<TorrentCardPoster isPoster={poster} onClick={handleClickOpenEditDialog}>
{poster ? <img src={poster} alt='poster' /> : <NoImageIcon />}
</TorrentCardPoster>
@@ -72,9 +74,13 @@ const Torrent = ({ torrent }) => {
<span>{t('Details')}</span>
</StyledButton>
<StyledButton onClick={handleClickOpenEditDialog}>
<EditIcon />
<span>{t('Edit')}</span>
<StyledButton
onClick={() => {
window.open(fullPlaylistLink, '_blank')
}}
>
<PlayArrowIcon />
<span>{t('Playlist')}</span>
</StyledButton>
<StyledButton onClick={() => dropTorrent(torrent)}>

View File

@@ -37,6 +37,7 @@ export const TorrentCardPoster = styled.div`
border-radius: 5px;
overflow: hidden;
text-align: center;
cursor: pointer;
${({
isPoster,

View File

@@ -71,6 +71,7 @@
"Peers": "Peers",
"PiecesCount": "Pieces count",
"PiecesLength": "Pieces length",
"Playlist": "Playlist",
"Preload": "Preload",
"ProjectSource": "Project page",
"Releases": "TorrServer Releases",

View File

@@ -71,6 +71,7 @@
"Peers": "Пиры",
"PiecesCount": "Кол-во блоков",
"PiecesLength": "Размер блока",
"Playlist": "Плейлист",
"Preload": "Предзагр.",
"ProjectSource": "Сайт проекта",
"Releases": "Релизы TorrServer",