mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
use translated main categories in details
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
|||||||
import { getPeerString, humanizeSize, humanizeSpeed } from 'utils/Utils'
|
import { getPeerString, humanizeSize, humanizeSpeed } from 'utils/Utils'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { GETTING_INFO, IN_DB, CLOSED, PRELOAD, WORKING } from 'torrentStates'
|
import { GETTING_INFO, IN_DB, CLOSED, PRELOAD, WORKING } from 'torrentStates'
|
||||||
|
import { TORRENT_CATEGORIES } from 'components/categories'
|
||||||
|
|
||||||
import StatisticsField from '../StatisticsField'
|
import StatisticsField from '../StatisticsField'
|
||||||
import useGetWidgetColors from './useGetWidgetColors'
|
import useGetWidgetColors from './useGetWidgetColors'
|
||||||
@@ -131,12 +132,15 @@ export const SizeWidget = ({ data }) => {
|
|||||||
export const CategoryWidget = ({ data }) => {
|
export const CategoryWidget = ({ data }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { iconBGColor, valueBGColor } = useGetWidgetColors('category')
|
const { iconBGColor, valueBGColor } = useGetWidgetColors('category')
|
||||||
|
// main categories
|
||||||
|
const catIndex = TORRENT_CATEGORIES.findIndex(e => e.key === data)
|
||||||
|
const catArray = TORRENT_CATEGORIES.find(e => e.key === data)
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
return (
|
return (
|
||||||
<StatisticsField
|
<StatisticsField
|
||||||
title={t('Category')}
|
title={t('Category')}
|
||||||
value={data}
|
value={catIndex >= 0 ? t(catArray.name) : data}
|
||||||
iconBg={iconBGColor}
|
iconBg={iconBGColor}
|
||||||
valueBg={valueBGColor}
|
valueBg={valueBGColor}
|
||||||
icon={CategoryIcon}
|
icon={CategoryIcon}
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import { useTranslation } from 'react-i18next'
|
|||||||
export default function FilterByCategory({ categoryKey, categoryName, setGlobalFilterCategory, icon }) {
|
export default function FilterByCategory({ categoryKey, categoryName, setGlobalFilterCategory, icon }) {
|
||||||
const onClick = () => {
|
const onClick = () => {
|
||||||
setGlobalFilterCategory(categoryKey)
|
setGlobalFilterCategory(categoryKey)
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
// if (process.env.NODE_ENV !== 'production') {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log('FilterByCategory categoryKey: %s categoryName: %s', categoryKey, categoryName)
|
// console.log('FilterByCategory categoryKey: %s categoryName: %s', categoryKey, categoryName)
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ const Torrent = ({ torrent }) => {
|
|||||||
const fullPlaylistLink = `${playlistTorrHost()}/${encodeURIComponent(parsedTitle || 'file')}.m3u?link=${hash}&m3u`
|
const fullPlaylistLink = `${playlistTorrHost()}/${encodeURIComponent(parsedTitle || 'file')}.m3u?link=${hash}&m3u`
|
||||||
|
|
||||||
const detailedInfoDialogRef = useOnStandaloneAppOutsideClick(closeDetailedInfo)
|
const detailedInfoDialogRef = useOnStandaloneAppOutsideClick(closeDetailedInfo)
|
||||||
// FIXME
|
// main categories
|
||||||
const catIndex = TORRENT_CATEGORIES.findIndex(e => e.key === category)
|
const catIndex = TORRENT_CATEGORIES.findIndex(e => e.key === category)
|
||||||
const catArray = TORRENT_CATEGORIES.find(e => e.key === category)
|
const catArray = TORRENT_CATEGORIES.find(e => e.key === category)
|
||||||
|
|
||||||
@@ -123,9 +123,7 @@ const Torrent = ({ torrent }) => {
|
|||||||
<div className='description-title-wrapper'>
|
<div className='description-title-wrapper'>
|
||||||
<div className='description-section-name'>
|
<div className='description-section-name'>
|
||||||
{t('Name')}
|
{t('Name')}
|
||||||
<div className='description-category-wrapper'>
|
<div className='description-category-wrapper'>{catIndex >= 0 ? t(catArray.name) : category}</div>
|
||||||
{catIndex >= 0 ? t(catArray.name) : '' /* {category} */}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className='description-torrent-title'>{parsedTitle}</div>
|
<div className='description-torrent-title'>{parsedTitle}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user