update web for categories

This commit is contained in:
nikk gitanes
2024-04-06 05:14:27 +03:00
parent 0e33bae9ae
commit de8137bfbf
10 changed files with 66 additions and 29 deletions

View File

@@ -61,8 +61,8 @@ func AddTorrent(spec *torrent.TorrentSpec, title, poster string, data string, ca
if torr.Category == "" { if torr.Category == "" {
if torDB != nil { if torDB != nil {
torr.Category = torDB.Category torr.Category = torDB.Category
} else { // } else {
torr.Category = "Unknown" // torr.Category = "None"
} }
} }
@@ -72,6 +72,7 @@ func AddTorrent(spec *torrent.TorrentSpec, title, poster string, data string, ca
torr.Poster = torDB.Poster torr.Poster = torDB.Poster
} }
} }
if torr.Data == "" { if torr.Data == "" {
torr.Data = data torr.Data = data
if torr.Data == "" && torDB != nil { if torr.Data == "" && torDB != nil {

View File

@@ -3,9 +3,9 @@ import { rgba } from 'polished'
import { NoImageIcon } from 'icons' import { NoImageIcon } from 'icons'
import { import {
FormControl, FormControl,
FormHelperText,
IconButton, IconButton,
InputAdornment, InputAdornment,
InputLabel,
MenuItem, MenuItem,
Select, Select,
TextField, TextField,
@@ -136,19 +136,19 @@ export default function RightSideComponent({
variant='outlined' variant='outlined'
fullWidth fullWidth
/> />
<FormControl fullWidth> <FormControl fullWidth>
<InputLabel id='torrent-category-select-label'>Torrent category</InputLabel> <FormHelperText style={{ padding: '0.2em 1.2em 0.5em 1.2em' }}>
{t('AddDialog.CategoryHelperText')}
</FormHelperText>
<Select <Select
labelId='torrent-category-select-label' labelId='torrent-category-select-label'
id='torrent-category-select' id='torrent-category-select'
value={category} value={category}
label='Torrent category'
margin='dense' margin='dense'
onChange={handleCategoryChange} onChange={handleCategoryChange}
variant='outlined' variant='outlined'
fullWidth fullWidth
defaultValue='Unknown' defaultValue='Other'
> >
{TORRENT_CATEGORIES.map(category => ( {TORRENT_CATEGORIES.map(category => (
<MenuItem value={category.name}>{category.name}</MenuItem> <MenuItem value={category.name}>{category.name}</MenuItem>

View File

@@ -116,16 +116,13 @@ const Torrent = ({ torrent }) => {
</TorrentCardButtons> </TorrentCardButtons>
<TorrentCardDescription> <TorrentCardDescription>
<div className='description-wrapper'>
<div className='description-title-wrapper'> <div className='description-title-wrapper'>
<div className='description-section-name'>{t('Name')}</div> <div className='description-section-name'>
{t('Name')}
<div className='description-category-wrapper'>{category}</div>
</div>
<div className='description-torrent-title'>{parsedTitle}</div> <div className='description-torrent-title'>{parsedTitle}</div>
</div> </div>
<div className='description-category-wrapper'>
<div className='description-section-name'>{t('Category')}</div>
<div className='description-torrent-title'>{category}</div>
</div>
</div>
<div className='description-statistics-wrapper'> <div className='description-statistics-wrapper'>
<div className='description-statistics-element-wrapper'> <div className='description-statistics-element-wrapper'>

View File

@@ -94,6 +94,7 @@ export const TorrentCardButtons = styled.div`
export const TorrentCardDescription = styled.div` export const TorrentCardDescription = styled.div`
${({ ${({
theme: { theme: {
app: { sidebarBGColor },
torrentCard: { cardSecondaryColor, accentCardColor }, torrentCard: { cardSecondaryColor, accentCardColor },
}, },
}) => css` }) => css`
@@ -110,21 +111,17 @@ export const TorrentCardDescription = styled.div`
gap: 3px; gap: 3px;
} }
.description-wrapper {
display: flex;
flex-direction: row;
}
.description-wrapper > * {
flex: 1;
}
.description-title-wrapper { .description-title-wrapper {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.description-section-name { .description-section-name {
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
self-align: end;
text-transform: uppercase; text-transform: uppercase;
font-size: 10px; font-size: 10px;
font-weight: 600; font-weight: 600;
@@ -138,9 +135,8 @@ export const TorrentCardDescription = styled.div`
} }
.description-category-wrapper { .description-category-wrapper {
display: flex; display: inline-flex;
flex-direction: column; color: ${sidebarBGColor};
align-items: end;
} }
.description-status-wrapper { .description-status-wrapper {

View File

@@ -2,12 +2,12 @@ import MovieCreationIcon from '@material-ui/icons/MovieCreation'
import LiveTvIcon from '@material-ui/icons/LiveTv' import LiveTvIcon from '@material-ui/icons/LiveTv'
import MusicNoteIcon from '@material-ui/icons/MusicNote' import MusicNoteIcon from '@material-ui/icons/MusicNote'
import MoreHorizIcon from '@material-ui/icons/MoreHoriz' import MoreHorizIcon from '@material-ui/icons/MoreHoriz'
import HelpIcon from '@material-ui/icons/Help' // import HelpIcon from '@material-ui/icons/Help'
export const TORRENT_CATEGORIES = [ export const TORRENT_CATEGORIES = [
{ name: 'Movies', icon: <MovieCreationIcon /> }, { name: 'Movies', icon: <MovieCreationIcon /> },
{ name: 'Series', icon: <LiveTvIcon /> }, { name: 'Series', icon: <LiveTvIcon /> },
{ name: 'Music', icon: <MusicNoteIcon /> }, { name: 'Music', icon: <MusicNoteIcon /> },
{ name: 'Other', icon: <MoreHorizIcon /> }, { name: 'Other', icon: <MoreHorizIcon /> },
{ name: 'Unknown', icon: <HelpIcon /> }, // { name: 'None', icon: <HelpIcon /> }, // TODO: unset category with this option
] ]

View File

@@ -9,6 +9,7 @@
"Or": "или", "Or": "или",
"ClickOrDrag": "Щракнете / Влачи§Пусни (.torrent)" "ClickOrDrag": "Щракнете / Влачи§Пусни (.torrent)"
}, },
"CategoryHelperText": "Торент категория",
"CustomTorrentTitle": "Персонализирано заглавие (по избор)", "CustomTorrentTitle": "Персонализирано заглавие (по избор)",
"CustomTorrentTitleHelperText": "Напишете персонализирано заглавие, за да намерите плакат", "CustomTorrentTitleHelperText": "Напишете персонализирано заглавие, за да намерите плакат",
"HashExists": "Този торент вече е в базата данни", "HashExists": "Този торент вече е в базата данни",
@@ -28,6 +29,14 @@
"BufferNote": "Задайте предварително зареден кеш преди възпроизвеждане > 32 MB в настройките, за да промените предварителния буфер", "BufferNote": "Задайте предварително зареден кеш преди възпроизвеждане > 32 MB в настройките, за да промените предварителния буфер",
"Cache": "Кеш", "Cache": "Кеш",
"Cancel": "Отказ", "Cancel": "Отказ",
"Category": "Категория",
"CategoryLabel": {
"Movies": "Филми",
"Series": "Серия",
"Music": "Музика",
"Other": "Други",
"None": "Нито един"
},
"Clear": "Изчисти", "Clear": "Изчисти",
"Close": "Затвори", "Close": "Затвори",
"CloseServer?": "Искате ли да изключите сървъра?", "CloseServer?": "Искате ли да изключите сървъра?",

View File

@@ -9,6 +9,7 @@
"Or": "OR", "Or": "OR",
"ClickOrDrag": "CLICK / DRAG & DROP (.torrent)" "ClickOrDrag": "CLICK / DRAG & DROP (.torrent)"
}, },
"CategoryHelperText": "Torrent category",
"CustomTorrentTitle": "Custom title (optional)", "CustomTorrentTitle": "Custom title (optional)",
"CustomTorrentTitleHelperText": "Write custom title to find poster", "CustomTorrentTitleHelperText": "Write custom title to find poster",
"HashExists": "This torrent is already in database", "HashExists": "This torrent is already in database",
@@ -28,6 +29,13 @@
"BufferNote": "Set Preload Cache Before Play > 32 MB in settings to change preload size", "BufferNote": "Set Preload Cache Before Play > 32 MB in settings to change preload size",
"Cache": "Cache", "Cache": "Cache",
"Cancel": "Cancel", "Cancel": "Cancel",
"Category": "Category",
"CategoryLabel": {
"Movies": "Movies",
"Series": "Series",
"Music": "Music",
"Other": "Other"
},
"Clear": "Clear", "Clear": "Clear",
"Close": "Close", "Close": "Close",
"CloseServer?": "Do you want to turn off server?", "CloseServer?": "Do you want to turn off server?",

View File

@@ -9,6 +9,7 @@
"Or": "ИЛИ", "Or": "ИЛИ",
"ClickOrDrag": "НАЖМИТЕ / ПЕРЕТАЩИТЕ ФАЙЛ (.torrent)" "ClickOrDrag": "НАЖМИТЕ / ПЕРЕТАЩИТЕ ФАЙЛ (.torrent)"
}, },
"CategoryHelperText": "Категория для торрента",
"CustomTorrentTitle": "Cвое название (не обязательно)", "CustomTorrentTitle": "Cвое название (не обязательно)",
"CustomTorrentTitleHelperText": "Напишите свое название, чтобы найти постер", "CustomTorrentTitleHelperText": "Напишите свое название, чтобы найти постер",
"HashExists": "Этот торрент уже есть в базе данных", "HashExists": "Этот торрент уже есть в базе данных",
@@ -28,6 +29,13 @@
"BufferNote": "Установите Буфер предзагрузки > 32 МБ в настройках для измененения размера предзагрузки", "BufferNote": "Установите Буфер предзагрузки > 32 МБ в настройках для измененения размера предзагрузки",
"Cache": "Кеш", "Cache": "Кеш",
"Cancel": "Отмена", "Cancel": "Отмена",
"Category": "Категория",
"CategoryLabel": {
"Movies": "Фильмы",
"Series": "Сериалы",
"Music": "Музыка",
"Other": "Другое"
},
"Clear": "Очистить", "Clear": "Очистить",
"Close": "Закрыть", "Close": "Закрыть",
"CloseServer?": "Хотите выключить сервер?", "CloseServer?": "Хотите выключить сервер?",

View File

@@ -9,6 +9,7 @@
"Or": "ЧИ", "Or": "ЧИ",
"ClickOrDrag": "НАТИСНІТЬ / ПЕРЕТЯГНІТЬ ФАЙЛ (.torrent)" "ClickOrDrag": "НАТИСНІТЬ / ПЕРЕТЯГНІТЬ ФАЙЛ (.torrent)"
}, },
"CategoryHelperText": "Торрент-категорія",
"CustomTorrentTitle": "Власна назва (опційно)", "CustomTorrentTitle": "Власна назва (опційно)",
"CustomTorrentTitleHelperText": "Напишіть власну назву, щоб знайти плакат", "CustomTorrentTitleHelperText": "Напишіть власну назву, щоб знайти плакат",
"HashExists": "Даний торент вже є у базі даних", "HashExists": "Даний торент вже є у базі даних",
@@ -28,6 +29,14 @@
"BufferNote": "Встановіть буфер попереднього завантаження > 32 МБ в налаштуваннях, щоб його змінити.", "BufferNote": "Встановіть буфер попереднього завантаження > 32 МБ в налаштуваннях, щоб його змінити.",
"Cache": "Кеш", "Cache": "Кеш",
"Cancel": "Скасувати", "Cancel": "Скасувати",
"Category": "Категорія",
"CategoryLabel": {
"Movies": "Фільми",
"Series": "Серія",
"Music": "Музика",
"Other": "Інший",
"None": "Жодного"
},
"Clear": "Очистити", "Clear": "Очистити",
"Close": "Закрити", "Close": "Закрити",
"CloseServer?": "Хочете вимкнути сервер?", "CloseServer?": "Хочете вимкнути сервер?",

View File

@@ -9,6 +9,7 @@
"Or": "或", "Or": "或",
"ClickOrDrag": "点击/拖放上传 (.torrent)" "ClickOrDrag": "点击/拖放上传 (.torrent)"
}, },
"CategoryHelperText": "Torrent 类别",
"CustomTorrentTitle": "自定义标题(可选)", "CustomTorrentTitle": "自定义标题(可选)",
"CustomTorrentTitleHelperText": "编写自定义标题以查找海报", "CustomTorrentTitleHelperText": "编写自定义标题以查找海报",
"HashExists": "这个种子已经在数据库中", "HashExists": "这个种子已经在数据库中",
@@ -28,6 +29,14 @@
"BufferNote": "在设置中将播放前预加载缓存设置为大于 32 MB 以更改预加载大小", "BufferNote": "在设置中将播放前预加载缓存设置为大于 32 MB 以更改预加载大小",
"Cache": "缓存", "Cache": "缓存",
"Cancel": "取消", "Cancel": "取消",
"Category": "类别",
"CategoryLabel": {
"Movies": "电影",
"Series": "系列",
"Music": "音乐",
"Other": "其他",
"None": "没有任何"
},
"Clear": "清除", "Clear": "清除",
"Close": "关闭", "Close": "关闭",
"CloseServer?": "你想关闭服务器吗?", "CloseServer?": "你想关闭服务器吗?",