From c8e02deefd113d16af2ccdb2acadc18573219764 Mon Sep 17 00:00:00 2001 From: LIAUD Corentin Date: Sat, 6 Apr 2024 13:28:21 +0200 Subject: [PATCH] Bug fix + UI improvment - Fixes Bug when loading torrent category from cache - UI: Do not display category if not provided --- server/torr/apihelper.go | 1 + server/torr/dbwrapper.go | 1 + .../widgets/index.jsx | 22 +++++++++++-------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/server/torr/apihelper.go b/server/torr/apihelper.go index 83dcffe..76e4ca6 100644 --- a/server/torr/apihelper.go +++ b/server/torr/apihelper.go @@ -108,6 +108,7 @@ func GetTorrent(hashHex string) *Torrent { tr.Data = tor.Data tr.Size = tor.Size tr.Timestamp = tor.Timestamp + tr.Category = tor.Category tr.GotInfo() } }() diff --git a/server/torr/dbwrapper.go b/server/torr/dbwrapper.go index 663a580..60e525f 100644 --- a/server/torr/dbwrapper.go +++ b/server/torr/dbwrapper.go @@ -55,6 +55,7 @@ func GetTorrentDB(hash metainfo.Hash) *Torrent { torr.Size = db.Size torr.Data = db.Data torr.Stat = state.TorrentInDB + torr.Category = db.Category return torr } } diff --git a/web/src/components/DialogTorrentDetailsContent/widgets/index.jsx b/web/src/components/DialogTorrentDetailsContent/widgets/index.jsx index e50629a..637d340 100644 --- a/web/src/components/DialogTorrentDetailsContent/widgets/index.jsx +++ b/web/src/components/DialogTorrentDetailsContent/widgets/index.jsx @@ -132,13 +132,17 @@ export const CategoryWidget = ({ data }) => { const { t } = useTranslation() const { iconBGColor, valueBGColor } = useGetWidgetColors('category') - return ( - - ) + if (data) { + return ( + + ) + } + + return null }