Add category associated to each torrent

This commit is contained in:
LIAUD Corentin
2023-11-22 14:08:10 +01:00
parent 286609acec
commit 8c92856595
22 changed files with 171 additions and 70 deletions

View File

@@ -27,7 +27,7 @@ import {
TorrentFilesSection,
Divider,
} from './style'
import { DownlodSpeedWidget, UploadSpeedWidget, PeersWidget, SizeWidget, StatusWidget } from './widgets'
import { DownlodSpeedWidget, UploadSpeedWidget, PeersWidget, SizeWidget, StatusWidget, CategoryWidget } from './widgets'
import TorrentFunctions from './TorrentFunctions'
import { isFilePlayable } from './helpers'
@@ -51,6 +51,7 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
poster,
hash,
title,
category,
name,
stat,
download_speed: downloadSpeed,
@@ -184,6 +185,7 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
<PeersWidget data={torrent} />
<SizeWidget data={torrentSize} />
<StatusWidget stat={stat} />
<CategoryWidget data={category} />
</WidgetWrapper>
<Divider />

View File

@@ -6,6 +6,7 @@ import {
Widgets as WidgetsIcon,
PhotoSizeSelectSmall as PhotoSizeSelectSmallIcon,
Build as BuildIcon,
Category as CategoryIcon,
} from '@material-ui/icons'
import { getPeerString, humanizeSize, humanizeSpeed } from 'utils/Utils'
import { useTranslation } from 'react-i18next'
@@ -126,3 +127,18 @@ export const SizeWidget = ({ data }) => {
/>
)
}
export const CategoryWidget = ({ data }) => {
const { t } = useTranslation()
const { iconBGColor, valueBGColor } = useGetWidgetColors('category')
return (
<StatisticsField
title={t('Category')}
value={data}
iconBg={iconBGColor}
valueBg={valueBGColor}
icon={CategoryIcon}
/>
)
}

View File

@@ -13,6 +13,7 @@ const colors = {
piecesLength: { iconBGColor: '#0982c8', valueBGColor: '#098cd7' },
status: { iconBGColor: '#aea25b', valueBGColor: '#b4aa6e' },
size: { iconBGColor: '#9b01ad', valueBGColor: '#ac03bf' },
category: { iconBGColor: '#914820', valueBGColor: '#c9632c' },
},
dark: {
downloadSpeed: { iconBGColor: '#0c6600', valueBGColor: '#0d7000' },
@@ -22,6 +23,7 @@ const colors = {
piecesLength: { iconBGColor: '#07659c', valueBGColor: '#0872af' },
status: { iconBGColor: '#938948', valueBGColor: '#9f9450' },
size: { iconBGColor: '#81008f', valueBGColor: '#9102a1' },
category: { iconBGColor: '#914820', valueBGColor: '#c9632c' },
},
}