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

View File

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

View File

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

View File

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