This commit is contained in:
Daniel Shleifman
2021-06-01 19:37:40 +03:00
parent 950b84e34e
commit 0ccf0caf32
5 changed files with 91 additions and 56 deletions

View File

@@ -0,0 +1,45 @@
import { SectionTitle, WidgetWrapper } from '../style'
import { DetailedViewCacheSection, DetailedViewWidgetSection } from './style'
import TorrentCache from '../TorrentCache'
import {
SizeWidget,
PiecesLengthWidget,
StatusWidget,
PiecesCountWidget,
PeersWidget,
UploadSpeedWidget,
DownlodSpeedWidget,
} from '../widgets'
export default function Test({
downloadSpeed,
uploadSpeed,
torrent,
torrentSize,
PiecesCount,
PiecesLength,
statString,
cache,
}) {
return (
<>
<DetailedViewWidgetSection>
<SectionTitle mb={20}>Data</SectionTitle>
<WidgetWrapper detailedView>
<DownlodSpeedWidget data={downloadSpeed} />
<UploadSpeedWidget data={uploadSpeed} />
<PeersWidget data={torrent} />
<SizeWidget data={torrentSize} />
<PiecesCountWidget data={PiecesCount} />
<PiecesLengthWidget data={PiecesLength} />
<StatusWidget data={statString} />
</WidgetWrapper>
</DetailedViewWidgetSection>
<DetailedViewCacheSection>
<SectionTitle mb={20}>Cache</SectionTitle>
<TorrentCache cache={cache} />
</DetailedViewCacheSection>
</>
)
}

View File

@@ -0,0 +1,19 @@
import styled from 'styled-components'
export const DetailedViewWidgetSection = styled.section`
padding: 40px;
background: linear-gradient(145deg, #e4f6ed, #b5dec9);
@media (max-width: 800px) {
padding: 20px;
}
`
export const DetailedViewCacheSection = styled.section`
padding: 40px;
box-shadow: inset 3px 25px 8px -25px rgba(0, 0, 0, 0.5);
@media (max-width: 800px) {
padding: 20px;
}
`

View File

@@ -73,6 +73,7 @@ const Table = memo(
})} })}
</tbody> </tbody>
</TableStyle> </TableStyle>
<ShortTableWrapper> <ShortTableWrapper>
{playableFileList.map(({ id, path, length }) => { {playableFileList.map(({ id, path, length }) => {
const { title, resolution, episode, season } = ptt.parse(path) const { title, resolution, episode, season } = ptt.parse(path)
@@ -84,12 +85,14 @@ const Table = memo(
<ShortTable key={id} isViewed={isViewed}> <ShortTable key={id} isViewed={isViewed}>
<div className='short-table-name'>{title}</div> <div className='short-table-name'>{title}</div>
<div className='short-table-data'> <div className='short-table-data'>
<div className='short-table-field'> {isViewed && (
<div className='short-table-field-name'>viewed</div> <div className='short-table-field'>
<div className='short-table-field-value'> <div className='short-table-field-name'>viewed</div>
<div className='short-table-viewed-indicator' /> <div className='short-table-field-value'>
<div className='short-table-viewed-indicator' />
</div>
</div> </div>
</div> )}
{fileHasSeasonText && seasonAmount?.length === 1 && ( {fileHasSeasonText && seasonAmount?.length === 1 && (
<div className='short-table-field'> <div className='short-table-field'>
<div className='short-table-field-name'>season</div> <div className='short-table-field-name'>season</div>

View File

@@ -12,9 +12,8 @@ import { useUpdateCache, useGetSettings } from './customHooks'
import DialogHeader from './DialogHeader' import DialogHeader from './DialogHeader'
import TorrentCache from './TorrentCache' import TorrentCache from './TorrentCache'
import Table from './Table' import Table from './Table'
import DetailedView from './DetailedView'
import { import {
DetailedViewWidgetSection,
DetailedViewCacheSection,
DialogContentGrid, DialogContentGrid,
MainSection, MainSection,
Poster, Poster,
@@ -27,20 +26,18 @@ import {
TorrentFilesSection, TorrentFilesSection,
Divider, Divider,
} from './style' } from './style'
import { import { DownlodSpeedWidget, UploadSpeedWidget, PeersWidget, SizeWidget } from './widgets'
DownlodSpeedWidget,
UploadSpeedWidget,
PeersWidget,
SizeWidget,
PiecesCountWidget,
PiecesLengthWidget,
StatusWidget,
} from './widgets'
import TorrentFunctions from './TorrentFunctions' import TorrentFunctions from './TorrentFunctions'
import { isFilePlayable } from './helpers' import { isFilePlayable } from './helpers'
const shortenText = (text, count) => text.slice(0, count) + (text.length > count ? '...' : '') const shortenText = (text, count) => text.slice(0, count) + (text.length > count ? '...' : '')
const Loader = () => (
<div style={{ minHeight: '80vh', display: 'grid', placeItems: 'center' }}>
<CircularProgress />
</div>
)
export default function DialogTorrentDetailsContent({ closeDialog, torrent }) { export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
const [isLoading, setIsLoading] = useState(true) const [isLoading, setIsLoading] = useState(true)
const [isDetailedCacheView, setIsDetailedCacheView] = useState(false) const [isDetailedCacheView, setIsDetailedCacheView] = useState(false)
@@ -115,29 +112,18 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
<div style={{ minHeight: '80vh', overflow: 'auto' }}> <div style={{ minHeight: '80vh', overflow: 'auto' }}>
{isLoading ? ( {isLoading ? (
<div style={{ minHeight: '80vh', display: 'grid', placeItems: 'center' }}> <Loader />
<CircularProgress />
</div>
) : isDetailedCacheView ? ( ) : isDetailedCacheView ? (
<> <DetailedView
<DetailedViewWidgetSection> downloadSpeed={downloadSpeed}
<SectionTitle mb={20}>Data</SectionTitle> uploadSpeed={uploadSpeed}
<WidgetWrapper detailedView> torrent={torrent}
<DownlodSpeedWidget data={downloadSpeed} /> torrentSize={torrentSize}
<UploadSpeedWidget data={uploadSpeed} /> PiecesCount={PiecesCount}
<PeersWidget data={torrent} /> PiecesLength={PiecesLength}
<SizeWidget data={torrentSize} /> statString={statString}
<PiecesCountWidget data={PiecesCount} /> cache={cache}
<PiecesLengthWidget data={PiecesLength} /> />
<StatusWidget data={statString} />
</WidgetWrapper>
</DetailedViewWidgetSection>
<DetailedViewCacheSection>
<SectionTitle mb={20}>Cache</SectionTitle>
<TorrentCache cache={cache} />
</DetailedViewCacheSection>
</>
) : ( ) : (
<DialogContentGrid> <DialogContentGrid>
<MainSection> <MainSection>

View File

@@ -251,21 +251,3 @@ export const Divider = styled.div`
background-color: rgba(0, 0, 0, 0.12); background-color: rgba(0, 0, 0, 0.12);
margin: 30px 0; margin: 30px 0;
` `
export const DetailedViewWidgetSection = styled.section`
padding: 40px;
background: linear-gradient(145deg, #e4f6ed, #b5dec9);
@media (max-width: 800px) {
padding: 20px;
}
`
export const DetailedViewCacheSection = styled.section`
padding: 40px;
box-shadow: inset 3px 25px 8px -25px rgba(0, 0, 0, 0.5);
@media (max-width: 800px) {
padding: 20px;
}
`