diff --git a/web/src/App/Sidebar.jsx b/web/src/App/Sidebar.jsx index a999a84..c2fa30f 100644 --- a/web/src/App/Sidebar.jsx +++ b/web/src/App/Sidebar.jsx @@ -7,7 +7,6 @@ import AddDialogButton from 'components/Add' import RemoveAll from 'components/RemoveAll' import SettingsDialog from 'components/Settings' import AboutDialog from 'components/About' -import UploadDialog from 'components/Upload' import { CreditCard as CreditCardIcon, List as ListIcon, Language as LanguageIcon } from '@material-ui/icons' import List from '@material-ui/core/List' import CloseServer from 'components/CloseServer' @@ -24,7 +23,6 @@ export default function Sidebar({ isDrawerOpen, setIsDonationDialogOpen }) { - diff --git a/web/src/components/Add/AddDialog.jsx b/web/src/components/Add/AddDialog.jsx index a30adc1..d703256 100644 --- a/web/src/components/Add/AddDialog.jsx +++ b/web/src/components/Add/AddDialog.jsx @@ -1,14 +1,10 @@ -import { useCallback, useMemo, useState } from 'react' +import { useMemo, useState } from 'react' import Button from '@material-ui/core/Button' import TextField from '@material-ui/core/TextField' import Dialog from '@material-ui/core/Dialog' -import DialogActions from '@material-ui/core/DialogActions' -import DialogContent from '@material-ui/core/DialogContent' -import DialogTitle from '@material-ui/core/DialogTitle' import { torrentsHost, torrentUploadHost } from 'utils/Hosts' import axios from 'axios' import { useTranslation } from 'react-i18next' -import { Input, ListItem, ListItemIcon, ListItemText } from '@material-ui/core' import styled, { css } from 'styled-components' import { NoImageIcon, AddItemIcon, TorrentIcon } from 'icons' import debounce from 'lodash/debounce' @@ -16,8 +12,7 @@ import { v4 as uuidv4 } from 'uuid' import useChangeLanguage from 'utils/useChangeLanguage' import { Cancel as CancelIcon } from '@material-ui/icons' -const AddDialogStyle = styled.div`` -const TitleSection = styled.div` +const Header = styled.div` background: #00a572; color: rgba(0, 0, 0, 0.87); font-size: 20px; @@ -27,14 +22,14 @@ const TitleSection = styled.div` padding: 15px 24px; position: relative; ` -const MainSection = styled.div` +const ContentWrapper = styled.div` background: linear-gradient(145deg, #e4f6ed, #b5dec9); display: flex; flex-direction: column; justify-content: space-between; ` -const MainSectionContentWrapper = styled.div` +const Content = styled.div` flex: 1; display: grid; grid-template-columns: repeat(2, 1fr); @@ -110,6 +105,7 @@ const IconWrapper = styled.div` const FileUploadLabel = styled.label` transition: all 0.3s; + flex: 1; ` const RightSideTopSection = styled.div` @@ -290,6 +286,7 @@ export default function AddDialog({ handleClose }) { const data = new FormData() data.append('save', 'true') data.append('file', selectedFile) + title && data.append('title', title) posterUrl && data.append('poster', posterUrl) axios.post(torrentUploadHost(), data).finally(() => handleClose()) } else { @@ -307,8 +304,7 @@ export default function AddDialog({ handleClose }) { setTorrentSource(file.name) } - const clearSelectedFile = e => { - e.stopPropagation() + const clearSelectedFile = () => { setSelectedFile() setTorrentSource('') } @@ -320,163 +316,118 @@ export default function AddDialog({ handleClose }) { } return ( - <> - - - Add new torrent - - - - - +
{t('AddNewTorrent')}
+ + + + + + + + + + {isPosterUrlCorrect ? poster : } + + + + {posterList + ?.filter(url => url !== posterUrl) + .slice(0, 12) + .map(url => ( + userChangesPosterUrl(url)} key={uuidv4()}> + poster + + ))} + + + + + + + + + setTorrentSourceSelected(true)} + onBlur={() => setTorrentSourceSelected(false)} + inputProps={{ autoComplete: 'off' }} + disabled={!!selectedFile} + /> + + + {selectedFile ? ( + + + + + + + + + + ) : ( + + - - - {isPosterUrlCorrect ? poster : } - + +
{t('AppendFile.Or')}
- - {posterList - ?.filter(url => url !== posterUrl) - .slice(0, 12) - .map(url => ( - userChangesPosterUrl(url)} key={uuidv4()}> - poster - - ))} - + + +
{t('AppendFile.ClickOrDrag')}
+
+
+
+ )} +
+
- - -
- - - - setTorrentSourceSelected(true)} - onBlur={() => setTorrentSourceSelected(false)} - inputProps={{ autoComplete: 'off' }} - disabled={selectedFile} - /> - - - {selectedFile ? ( - - - - - - - - - - ) : ( - - - - -
OR
- - - -
CLICK / DRAG & DROP
-
-
-
- )} -
-
- - - - - -
-
- {/* {t('AddMagnetOrLink')} - - - - - - - */} - {/* */} - {/* - - + - - - */} -
- + + + ) } diff --git a/web/src/components/DialogTorrentDetailsContent/widgets.jsx b/web/src/components/DialogTorrentDetailsContent/widgets.jsx index c3d65e3..a8d5f69 100644 --- a/web/src/components/DialogTorrentDetailsContent/widgets.jsx +++ b/web/src/components/DialogTorrentDetailsContent/widgets.jsx @@ -72,19 +72,15 @@ export const PiecesLengthWidget = ({ data }) => { export const StatusWidget = ({ data }) => { const { t } = useTranslation() let i18nd = data - if (data.toLowerCase() === 'torrent added') - i18nd = t('TorrentAdded') - else if (data.toLowerCase() === 'torrent getting info') - i18nd = t('TorrentGettingInfo') - else if (data.toLowerCase() === 'torrent preload') - i18nd = t('TorrentPreload') - else if (data.toLowerCase() === 'torrent working') - i18nd = t('TorrentWorking') - else if (data.toLowerCase() === 'torrent closed') - i18nd = t('TorrentClosed') - else if (data.toLowerCase() === 'torrent in db') - i18nd = t('TorrentInDb') - return + if (data.toLowerCase() === 'torrent added') i18nd = t('TorrentAdded') + else if (data.toLowerCase() === 'torrent getting info') i18nd = t('TorrentGettingInfo') + else if (data.toLowerCase() === 'torrent preload') i18nd = t('TorrentPreload') + else if (data.toLowerCase() === 'torrent working') i18nd = t('TorrentWorking') + else if (data.toLowerCase() === 'torrent closed') i18nd = t('TorrentClosed') + else if (data.toLowerCase() === 'torrent in db') i18nd = t('TorrentInDb') + return ( + + ) } export const SizeWidget = ({ data }) => { diff --git a/web/src/components/Upload.jsx b/web/src/components/Upload.jsx deleted file mode 100644 index fcaf9f0..0000000 --- a/web/src/components/Upload.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import ListItemIcon from '@material-ui/core/ListItemIcon' -import ListItemText from '@material-ui/core/ListItemText' -import ListItem from '@material-ui/core/ListItem' -import PublishIcon from '@material-ui/icons/Publish' -import { torrentUploadHost } from 'utils/Hosts' -import axios from 'axios' -import { useTranslation } from 'react-i18next' - -export default function UploadDialog() { - const { t } = useTranslation() - const handleCapture = ({ target: { files } }) => { - const [file] = files - const data = new FormData() - data.append('save', 'true') - data.append('file', file) - axios.post(torrentUploadHost(), data) - } - return ( -
- {/* */} -
- ) -} diff --git a/web/src/locales/en/translation.json b/web/src/locales/en/translation.json index bdfba9b..45c37e4 100644 --- a/web/src/locales/en/translation.json +++ b/web/src/locales/en/translation.json @@ -3,7 +3,7 @@ "Actions": "Actions", "Add": "Add", "AddFromLink": "Add from Link", - "AddMagnetOrLink": "Add magnet or link to torrent file", + "AddNewTorrent": "Add new torrent", "AddRetrackers": "Add retrackers", "Buffer": "Preload Buffer / Cache", "BufferNote": "Enable “Preload Buffer” in settings to see cache loading progress", @@ -62,7 +62,7 @@ "RemoveViews": "Remove View States", "ReplaceRetrackers": "Replace retrackers", "Resolution": "Resolution", - "RetrackersMode": "Retrackers Mode", + "RetrackersMode": "Retrackers Mode", "Save": "Save", "Season": "Season", "SelectSeason": "Select Season", @@ -96,5 +96,11 @@ "UseDisk": "Use Disk for Cache", "UseDiskDesc": "Better use external media on flash-based devices", "UTP": "μTP (Micro Transport Protocol)", - "Viewed": "Viewed" + "Viewed": "Viewed", + "AppendFile": { + "Or": "OR", + "ClickOrDrag": "CLICK / DRAG & DROP" + }, + "TorrentSourceOptions": "magnet / hash / .torrent file link", + "Clear": "Clear" } \ No newline at end of file diff --git a/web/src/locales/ru/translation.json b/web/src/locales/ru/translation.json index eb28836..db4d8df 100644 --- a/web/src/locales/ru/translation.json +++ b/web/src/locales/ru/translation.json @@ -3,7 +3,7 @@ "Actions": "Действия", "Add": "Добавить", "AddFromLink": "Добавить", - "AddMagnetOrLink": "Добавьте magnet или ссылку на торрент", + "AddNewTorrent": "Добавить новый торрент", "AddRetrackers": "Добавлять", "Buffer": "Предзагрузка / Кеш", "BufferNote": "Включите «Наполнять кеш перед началом воспроизведения» в настройках для показа заполнения кеша", @@ -96,5 +96,11 @@ "UseDisk": "Использовать диск для кеша", "UseDiskDesc": "Рекомендуется использовать внешние носители на устройствах с flash-памятью", "UTP": "μTP (Micro Transport Protocol)", - "Viewed": "Просм." + "Viewed": "Просм.", + "AppendFile": { + "Or": "ИЛИ", + "ClickOrDrag": "НАЖМИТЕ / ПЕРЕТАЩИТЕ ФАЙЛ" + }, + "TorrentSourceOptions": "магнитная ссылка / хэш / ссылка на .torrent файл", + "Clear": "Очистить" } \ No newline at end of file