Bug fix + UI improvment

- Fixes Bug when loading torrent category from cache
- UI: Do not display category if not provided
This commit is contained in:
LIAUD Corentin
2024-04-06 13:28:21 +02:00
parent e5a2739941
commit c8e02deefd
3 changed files with 15 additions and 9 deletions

View File

@@ -108,6 +108,7 @@ func GetTorrent(hashHex string) *Torrent {
tr.Data = tor.Data tr.Data = tor.Data
tr.Size = tor.Size tr.Size = tor.Size
tr.Timestamp = tor.Timestamp tr.Timestamp = tor.Timestamp
tr.Category = tor.Category
tr.GotInfo() tr.GotInfo()
} }
}() }()

View File

@@ -55,6 +55,7 @@ func GetTorrentDB(hash metainfo.Hash) *Torrent {
torr.Size = db.Size torr.Size = db.Size
torr.Data = db.Data torr.Data = db.Data
torr.Stat = state.TorrentInDB torr.Stat = state.TorrentInDB
torr.Category = db.Category
return torr return torr
} }
} }

View File

@@ -132,13 +132,17 @@ export const CategoryWidget = ({ data }) => {
const { t } = useTranslation() const { t } = useTranslation()
const { iconBGColor, valueBGColor } = useGetWidgetColors('category') const { iconBGColor, valueBGColor } = useGetWidgetColors('category')
return ( if (data) {
<StatisticsField return (
title={t('Category')} <StatisticsField
value={data} title={t('Category')}
iconBg={iconBGColor} value={data}
valueBg={valueBGColor} iconBg={iconBGColor}
icon={CategoryIcon} valueBg={valueBGColor}
/> icon={CategoryIcon}
) />
)
}
return null
} }