mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
WiP: localized categories
FIXME
This commit is contained in:
@@ -148,11 +148,11 @@ export default function RightSideComponent({
|
||||
onChange={handleCategoryChange}
|
||||
variant='outlined'
|
||||
fullWidth
|
||||
defaultValue='Other'
|
||||
defaultValue='other'
|
||||
>
|
||||
{TORRENT_CATEGORIES.map(category => (
|
||||
<MenuItem key={category.name} value={category.name}>
|
||||
{category.name}
|
||||
<MenuItem key={category.key} value={category.key}>
|
||||
{t(category.name)}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
|
||||
@@ -31,11 +31,18 @@ const Sidebar = ({ isDrawerOpen, setIsDonationDialogOpen, isOffline, isLoading,
|
||||
<Divider />
|
||||
|
||||
<List>
|
||||
<FilterByCategory categoryName='All' icon={<CheckIcon />} setGlobalFilterCategory={setGlobalFilterCategory} />
|
||||
<FilterByCategory
|
||||
key='all'
|
||||
categoryKey='all'
|
||||
categoryName={t('All')}
|
||||
icon={<CheckIcon />}
|
||||
setGlobalFilterCategory={setGlobalFilterCategory}
|
||||
/>
|
||||
{TORRENT_CATEGORIES.map(category => (
|
||||
<FilterByCategory
|
||||
key={category.name}
|
||||
categoryName={category.name}
|
||||
key={category.key}
|
||||
categoryKey={category.key}
|
||||
categoryName={t(category.name)}
|
||||
icon={category.icon}
|
||||
setGlobalFilterCategory={setGlobalFilterCategory}
|
||||
/>
|
||||
|
||||
@@ -43,7 +43,7 @@ export default function App() {
|
||||
const [isDarkMode, currentThemeMode, updateThemeMode, muiTheme] = useMaterialUITheme()
|
||||
const [currentLang, changeLang] = useChangeLanguage()
|
||||
const [isOffline, setIsOffline] = useState(false)
|
||||
const [globalCategoryFilter, setGlobalFilterCategory] = useState('All')
|
||||
const [globalCategoryFilter, setGlobalFilterCategory] = useState('all')
|
||||
const { data: torrents, isLoading } = useQuery('torrents', getTorrents, {
|
||||
retry: 1,
|
||||
refetchInterval: 1000,
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
import ListItem from '@material-ui/core/ListItem'
|
||||
import ListItemIcon from '@material-ui/core/ListItemIcon'
|
||||
import ListItemText from '@material-ui/core/ListItemText'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export default function FilterByCategory({ categoryName, setGlobalFilterCategory, icon }) {
|
||||
export default function FilterByCategory({ categoryKey, categoryName, setGlobalFilterCategory, icon }) {
|
||||
const onClick = () => {
|
||||
setGlobalFilterCategory(categoryName)
|
||||
setGlobalFilterCategory(categoryKey)
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('FilterByCategory categoryKey: %s categoryName: %s', categoryKey, categoryName)
|
||||
}
|
||||
}
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<>
|
||||
<ListItem button key={categoryName} onClick={onClick}>
|
||||
<ListItem button key={categoryKey} onClick={onClick}>
|
||||
<ListItemIcon>{icon}</ListItemIcon>
|
||||
|
||||
<ListItemText primary={categoryName} />
|
||||
<ListItemText primary={t(categoryName)} />
|
||||
</ListItem>
|
||||
</>
|
||||
)
|
||||
|
||||
@@ -19,6 +19,7 @@ import AddDialog from 'components/Add/AddDialog'
|
||||
import { StyledDialog } from 'style/CustomMaterialUiStyles'
|
||||
import useOnStandaloneAppOutsideClick from 'utils/useOnStandaloneAppOutsideClick'
|
||||
import { GETTING_INFO, IN_DB, CLOSED, PRELOAD, WORKING } from 'torrentStates'
|
||||
import { TORRENT_CATEGORIES } from 'components/categories'
|
||||
|
||||
import {
|
||||
StatusIndicators,
|
||||
@@ -81,6 +82,9 @@ const Torrent = ({ torrent }) => {
|
||||
const fullPlaylistLink = `${playlistTorrHost()}/${encodeURIComponent(parsedTitle || 'file')}.m3u?link=${hash}&m3u`
|
||||
|
||||
const detailedInfoDialogRef = useOnStandaloneAppOutsideClick(closeDetailedInfo)
|
||||
// FIXME
|
||||
const catIndex = TORRENT_CATEGORIES.findIndex(e => e.key === category)
|
||||
const catArray = TORRENT_CATEGORIES.find(e => e.key === category)
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -119,7 +123,9 @@ const Torrent = ({ torrent }) => {
|
||||
<div className='description-title-wrapper'>
|
||||
<div className='description-section-name'>
|
||||
{t('Name')}
|
||||
<div className='description-category-wrapper'>{category}</div>
|
||||
<div className='description-category-wrapper'>
|
||||
{catIndex >= 0 ? t(catArray.name) : ''/* {category} */}
|
||||
</div>
|
||||
</div>
|
||||
<div className='description-torrent-title'>{parsedTitle}</div>
|
||||
</div>
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import TorrentCard from 'components/TorrentCard'
|
||||
import CircularProgress from '@material-ui/core/CircularProgress'
|
||||
import { TorrentListWrapper, CenteredGrid } from 'components/App/style'
|
||||
// import { useTranslation } from 'react-i18next'
|
||||
|
||||
import NoServerConnection from './NoServerConnection'
|
||||
import AddFirstTorrent from './AddFirstTorrent'
|
||||
|
||||
export default function TorrentList({ isOffline, isLoading, sortABC, torrents, sortCategory }) {
|
||||
// const { t } = useTranslation()
|
||||
if (isLoading || isOffline || !torrents.length) {
|
||||
return (
|
||||
<CenteredGrid>
|
||||
@@ -20,7 +22,7 @@ export default function TorrentList({ isOffline, isLoading, sortABC, torrents, s
|
||||
)
|
||||
}
|
||||
|
||||
const filteredTorrents = torrents.filter(torrent => sortCategory === 'All' || torrent.category === sortCategory)
|
||||
const filteredTorrents = torrents.filter(torrent => sortCategory === 'all' || torrent.category === sortCategory)
|
||||
|
||||
return sortABC ? (
|
||||
<TorrentListWrapper>
|
||||
|
||||
@@ -2,12 +2,10 @@ import MovieCreationIcon from '@material-ui/icons/MovieCreation'
|
||||
import LiveTvIcon from '@material-ui/icons/LiveTv'
|
||||
import MusicNoteIcon from '@material-ui/icons/MusicNote'
|
||||
import MoreHorizIcon from '@material-ui/icons/MoreHoriz'
|
||||
// import HelpIcon from '@material-ui/icons/Help'
|
||||
|
||||
export const TORRENT_CATEGORIES = [
|
||||
{ name: 'Movies', icon: <MovieCreationIcon /> },
|
||||
{ name: 'Series', icon: <LiveTvIcon /> },
|
||||
{ name: 'Music', icon: <MusicNoteIcon /> },
|
||||
{ name: 'Other', icon: <MoreHorizIcon /> },
|
||||
// { name: 'None', icon: <HelpIcon /> }, // TODO: unset category with this option
|
||||
{ key: 'movies', name: 'Movies', icon: <MovieCreationIcon /> },
|
||||
{ key: 'series', name: 'Series', icon: <LiveTvIcon /> },
|
||||
{ key: 'music', name: 'Music', icon: <MusicNoteIcon /> },
|
||||
{ key: 'other', name: 'Other', icon: <MoreHorizIcon /> },
|
||||
]
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
},
|
||||
"AddFromLink": "Добавете торент",
|
||||
"AddNewTorrent": "Добавете нов торент",
|
||||
"All": "Всичко",
|
||||
"ApiDocs": "Документация на API",
|
||||
"B": "B",
|
||||
"bps": "bps",
|
||||
@@ -30,13 +31,6 @@
|
||||
"Cache": "Кеш",
|
||||
"Cancel": "Отказ",
|
||||
"Category": "Категория",
|
||||
"CategoryLabel": {
|
||||
"Movies": "Филми",
|
||||
"Series": "Серия",
|
||||
"Music": "Музика",
|
||||
"Other": "Други",
|
||||
"None": "Нито един"
|
||||
},
|
||||
"Clear": "Изчисти",
|
||||
"Close": "Затвори",
|
||||
"CloseServer?": "Искате ли да изключите сървъра?",
|
||||
@@ -75,12 +69,16 @@
|
||||
"Links": "Връзки",
|
||||
"MB": "MB",
|
||||
"Mbps": "Mbps",
|
||||
"Movies": "Филми",
|
||||
"Music": "Музика",
|
||||
"Name": "Име",
|
||||
"NasReleases": "NAS Releases",
|
||||
"None": "Нито един",
|
||||
"NoTorrentsAdded": "Няма добавени торенти",
|
||||
"Offline": "Извън линия",
|
||||
"OK": "OK",
|
||||
"OpenLink": "Отвори линк",
|
||||
"Other": "Други",
|
||||
"Peers": "Пиъри·Сийдъри",
|
||||
"PiecesCount": "Брой парчета",
|
||||
"PiecesLength": "Дължина на парчетата",
|
||||
@@ -107,6 +105,7 @@
|
||||
"Sec": "сек",
|
||||
"Seconds": "Секунди",
|
||||
"SelectSeason": "Избери сезон",
|
||||
"Series": "Серия",
|
||||
"SettingsDialog": {
|
||||
"AddRetrackers": "Добавяне на ретракери",
|
||||
"AdditionalSettings": "Допълнителни настройки",
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
},
|
||||
"AddFromLink": "Add Torrent",
|
||||
"AddNewTorrent": "Add new torrent",
|
||||
"All": "All",
|
||||
"ApiDocs": "API Docs",
|
||||
"B": "B",
|
||||
"bps": "bps",
|
||||
@@ -30,12 +31,6 @@
|
||||
"Cache": "Cache",
|
||||
"Cancel": "Cancel",
|
||||
"Category": "Category",
|
||||
"CategoryLabel": {
|
||||
"Movies": "Movies",
|
||||
"Series": "Series",
|
||||
"Music": "Music",
|
||||
"Other": "Other"
|
||||
},
|
||||
"Clear": "Clear",
|
||||
"Close": "Close",
|
||||
"CloseServer?": "Do you want to turn off server?",
|
||||
@@ -74,12 +69,16 @@
|
||||
"Links": "Links",
|
||||
"MB": "MB",
|
||||
"Mbps": "Mbps",
|
||||
"Movies": "Movies",
|
||||
"Music": "Music",
|
||||
"Name": "Name",
|
||||
"NasReleases": "NAS Releases",
|
||||
"None": "None",
|
||||
"NoTorrentsAdded": "No torrents added",
|
||||
"Offline": "Offline",
|
||||
"OK": "OK",
|
||||
"OpenLink": "Open link",
|
||||
"Other": "Other",
|
||||
"Peers": "Peers·Seeds",
|
||||
"PiecesCount": "Pieces count",
|
||||
"PiecesLength": "Pieces length",
|
||||
@@ -106,6 +105,7 @@
|
||||
"Sec": "s",
|
||||
"Seconds": "Seconds",
|
||||
"SelectSeason": "Select Season",
|
||||
"Series": "Series",
|
||||
"SettingsDialog": {
|
||||
"AddRetrackers": "Add retrackers",
|
||||
"AdditionalSettings": "Additional Settings",
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
},
|
||||
"AddFromLink": "Добавить",
|
||||
"AddNewTorrent": "Добавить новый торрент",
|
||||
"All": "Все",
|
||||
"ApiDocs": "Документация API",
|
||||
"B": "Б",
|
||||
"bps": "бит/c",
|
||||
@@ -30,12 +31,6 @@
|
||||
"Cache": "Кеш",
|
||||
"Cancel": "Отмена",
|
||||
"Category": "Категория",
|
||||
"CategoryLabel": {
|
||||
"Movies": "Фильмы",
|
||||
"Series": "Сериалы",
|
||||
"Music": "Музыка",
|
||||
"Other": "Другое"
|
||||
},
|
||||
"Clear": "Очистить",
|
||||
"Close": "Закрыть",
|
||||
"CloseServer?": "Хотите выключить сервер?",
|
||||
@@ -74,12 +69,16 @@
|
||||
"Links": "Ссылки",
|
||||
"MB": "МБ",
|
||||
"Mbps": "Мбит/c",
|
||||
"Movies": "Фильмы",
|
||||
"Music": "Музыка",
|
||||
"Name": "Название",
|
||||
"NasReleases": "Релизы для NAS",
|
||||
"None": "Нет",
|
||||
"NoTorrentsAdded": "Нет торрентов",
|
||||
"Offline": "Сервер недоступен",
|
||||
"OK": "OK",
|
||||
"OpenLink": "Открыть",
|
||||
"Other": "Другое",
|
||||
"Peers": "Пиры·Сиды",
|
||||
"PiecesCount": "Кол-во блоков",
|
||||
"PiecesLength": "Размер блока",
|
||||
@@ -106,6 +105,7 @@
|
||||
"Sec": "c",
|
||||
"Seconds": "Секунды",
|
||||
"SelectSeason": "Выбор сезона",
|
||||
"Series": "Сериалы",
|
||||
"SettingsDialog": {
|
||||
"AddRetrackers": "Добавлять",
|
||||
"AdditionalSettings": "Расширенные настройки",
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
},
|
||||
"AddFromLink": "Додати торент",
|
||||
"AddNewTorrent": "Додати новий торент",
|
||||
"All": "Усе",
|
||||
"ApiDocs": "Документація API",
|
||||
"B": "Б",
|
||||
"bps": "біт/c",
|
||||
@@ -30,13 +31,6 @@
|
||||
"Cache": "Кеш",
|
||||
"Cancel": "Скасувати",
|
||||
"Category": "Категорія",
|
||||
"CategoryLabel": {
|
||||
"Movies": "Фільми",
|
||||
"Series": "Серія",
|
||||
"Music": "Музика",
|
||||
"Other": "Інший",
|
||||
"None": "Жодного"
|
||||
},
|
||||
"Clear": "Очистити",
|
||||
"Close": "Закрити",
|
||||
"CloseServer?": "Хочете вимкнути сервер?",
|
||||
@@ -75,12 +69,16 @@
|
||||
"Links": "Посилання",
|
||||
"MB": "МБ",
|
||||
"Mbps": "Мбіт/c",
|
||||
"Movies": "Фільми",
|
||||
"Music": "Музика",
|
||||
"Name": "Назва",
|
||||
"NasReleases": "Релізи для NAS",
|
||||
"None": "Жодного",
|
||||
"NoTorrentsAdded": "Немає торентів",
|
||||
"Offline": "Сервер не доступний",
|
||||
"OK": "OK",
|
||||
"OpenLink": "Відкрити",
|
||||
"Other": "Інший",
|
||||
"Peers": "Піри·Сіди",
|
||||
"PiecesCount": "К-сть блоків",
|
||||
"PiecesLength": "Розмір блоку",
|
||||
@@ -107,6 +105,7 @@
|
||||
"Sec": "c",
|
||||
"Seconds": "Секунди",
|
||||
"SelectSeason": "Вибір сезону",
|
||||
"Series": "Серія",
|
||||
"SettingsDialog": {
|
||||
"AddRetrackers": "Додавати",
|
||||
"AdditionalSettings": "Додаткові налаштування",
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
},
|
||||
"AddFromLink": "添加种子",
|
||||
"AddNewTorrent": "添加新种子",
|
||||
"All": "全部",
|
||||
"ApiDocs": "API 文档",
|
||||
"B": "B",
|
||||
"bps": "bps",
|
||||
@@ -30,13 +31,6 @@
|
||||
"Cache": "缓存",
|
||||
"Cancel": "取消",
|
||||
"Category": "类别",
|
||||
"CategoryLabel": {
|
||||
"Movies": "电影",
|
||||
"Series": "系列",
|
||||
"Music": "音乐",
|
||||
"Other": "其他",
|
||||
"None": "没有任何"
|
||||
},
|
||||
"Clear": "清除",
|
||||
"Close": "关闭",
|
||||
"CloseServer?": "你想关闭服务器吗?",
|
||||
@@ -75,12 +69,16 @@
|
||||
"Links": "链接",
|
||||
"MB": "MB",
|
||||
"Mbps": "Mbps",
|
||||
"Movies": "电影",
|
||||
"Music": "音乐",
|
||||
"Name": "名称",
|
||||
"NasReleases": "NAS 版本",
|
||||
"None": "没有任何",
|
||||
"NoTorrentsAdded": "没有添加种子",
|
||||
"Offline": "离线",
|
||||
"OK": "确定",
|
||||
"OpenLink": "打开链接",
|
||||
"Other": "其他",
|
||||
"Peers": "Peers·Seeds",
|
||||
"PiecesCount": "块数量",
|
||||
"PiecesLength": "块长度",
|
||||
@@ -107,6 +105,7 @@
|
||||
"Sec": "秒",
|
||||
"Seconds": "秒",
|
||||
"SelectSeason": "选择季",
|
||||
"Series": "系列",
|
||||
"SettingsDialog": {
|
||||
"AddRetrackers": "添加retrackers",
|
||||
"AdditionalSettings": "附加设置",
|
||||
|
||||
Reference in New Issue
Block a user