mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-20 14:06:09 +05:00
refactor
This commit is contained in:
@@ -11,14 +11,14 @@ import {
|
||||
DownlodSpeedWidget,
|
||||
} from '../widgets'
|
||||
|
||||
export default function Test({
|
||||
export default function DetailedView({
|
||||
downloadSpeed,
|
||||
uploadSpeed,
|
||||
torrent,
|
||||
torrentSize,
|
||||
PiecesCount,
|
||||
PiecesLength,
|
||||
statString,
|
||||
stat,
|
||||
cache,
|
||||
}) {
|
||||
return (
|
||||
@@ -32,7 +32,7 @@ export default function Test({
|
||||
<SizeWidget data={torrentSize} />
|
||||
<PiecesCountWidget data={PiecesCount} />
|
||||
<PiecesLengthWidget data={PiecesLength} />
|
||||
<StatusWidget data={statString} />
|
||||
<StatusWidget stat={stat} />
|
||||
</WidgetWrapper>
|
||||
</DetailedViewWidgetSection>
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
||||
stat,
|
||||
download_speed: downloadSpeed,
|
||||
upload_speed: uploadSpeed,
|
||||
stat_string: statString,
|
||||
torrent_size: torrentSize,
|
||||
file_stats: torrentFileList,
|
||||
} = torrent
|
||||
@@ -133,7 +132,7 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
||||
torrentSize={torrentSize}
|
||||
PiecesCount={PiecesCount}
|
||||
PiecesLength={PiecesLength}
|
||||
statString={statString}
|
||||
stat={stat}
|
||||
cache={cache}
|
||||
/>
|
||||
) : (
|
||||
@@ -156,7 +155,7 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
||||
<UploadSpeedWidget data={uploadSpeed} />
|
||||
<PeersWidget data={torrent} />
|
||||
<SizeWidget data={torrentSize} />
|
||||
<StatusWidget data={statString} />
|
||||
<StatusWidget stat={stat} />
|
||||
</WidgetWrapper>
|
||||
|
||||
<Divider />
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
} from '@material-ui/icons'
|
||||
import { getPeerString, humanizeSize } from 'utils/Utils'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { GETTING_INFO, IN_DB, CLOSED, PRELOAD, WORKING } from 'torrentStates'
|
||||
|
||||
import StatisticsField from './StatisticsField'
|
||||
|
||||
@@ -69,17 +70,25 @@ export const PiecesLengthWidget = ({ data }) => {
|
||||
)
|
||||
}
|
||||
|
||||
export const StatusWidget = ({ data }) => {
|
||||
export const StatusWidget = ({ stat }) => {
|
||||
const { t } = useTranslation()
|
||||
let i18nd = data
|
||||
if (data.toLowerCase() === 'torrent added') i18nd = t('TorrentAdded')
|
||||
else if (data.toLowerCase() === 'torrent getting info') i18nd = t('TorrentGettingInfo')
|
||||
else if (data.toLowerCase() === 'torrent preload') i18nd = t('TorrentPreload')
|
||||
else if (data.toLowerCase() === 'torrent working') i18nd = t('TorrentWorking')
|
||||
else if (data.toLowerCase() === 'torrent closed') i18nd = t('TorrentClosed')
|
||||
else if (data.toLowerCase() === 'torrent in db') i18nd = t('TorrentInDb')
|
||||
|
||||
const values = {
|
||||
[GETTING_INFO]: t('TorrentGettingInfo'),
|
||||
[PRELOAD]: t('TorrentPreload'),
|
||||
[WORKING]: t('TorrentWorking'),
|
||||
[CLOSED]: t('TorrentClosed'),
|
||||
[IN_DB]: t('TorrentInDb'),
|
||||
}
|
||||
|
||||
return (
|
||||
<StatisticsField title={t('TorrentStatus')} value={i18nd} iconBg='#aea25b' valueBg='#b4aa6e' icon={BuildIcon} />
|
||||
<StatisticsField
|
||||
title={t('TorrentStatus')}
|
||||
value={values[stat]}
|
||||
iconBg='#aea25b'
|
||||
valueBg='#b4aa6e'
|
||||
icon={BuildIcon}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user