mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
added louder to add torrent button
This commit is contained in:
@@ -14,7 +14,9 @@ import { useDropzone } from 'react-dropzone'
|
|||||||
import { useMediaQuery } from '@material-ui/core'
|
import { useMediaQuery } from '@material-ui/core'
|
||||||
import parseTorrent from 'parse-torrent'
|
import parseTorrent from 'parse-torrent'
|
||||||
import ptt from 'parse-torrent-title'
|
import ptt from 'parse-torrent-title'
|
||||||
|
import CircularProgress from '@material-ui/core/CircularProgress'
|
||||||
|
|
||||||
|
import { checkImageURL, getMoviePosters, chechTorrentSource } from './helpers'
|
||||||
import {
|
import {
|
||||||
ButtonWrapper,
|
ButtonWrapper,
|
||||||
CancelIconWrapper,
|
CancelIconWrapper,
|
||||||
@@ -35,7 +37,6 @@ import {
|
|||||||
TorrentIconWrapper,
|
TorrentIconWrapper,
|
||||||
RightSideContainer,
|
RightSideContainer,
|
||||||
} from './style'
|
} from './style'
|
||||||
import { checkImageURL, getMoviePosters, chechTorrentSource } from './helpers'
|
|
||||||
|
|
||||||
export default function AddDialog({ handleClose }) {
|
export default function AddDialog({ handleClose }) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
@@ -51,6 +52,7 @@ export default function AddDialog({ handleClose }) {
|
|||||||
const [currentLang] = useChangeLanguage()
|
const [currentLang] = useChangeLanguage()
|
||||||
const [selectedFile, setSelectedFile] = useState()
|
const [selectedFile, setSelectedFile] = useState()
|
||||||
const [posterSearchLanguage, setPosterSearchLanguage] = useState(currentLang === 'ru' ? 'ru' : 'en')
|
const [posterSearchLanguage, setPosterSearchLanguage] = useState(currentLang === 'ru' ? 'ru' : 'en')
|
||||||
|
const [isLoadingButton, setIsLoadingButton] = useState(false)
|
||||||
|
|
||||||
const fullScreen = useMediaQuery('@media (max-width:930px)')
|
const fullScreen = useMediaQuery('@media (max-width:930px)')
|
||||||
|
|
||||||
@@ -144,6 +146,8 @@ export default function AddDialog({ handleClose }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
|
setIsLoadingButton(true)
|
||||||
|
|
||||||
if (selectedFile) {
|
if (selectedFile) {
|
||||||
// file save
|
// file save
|
||||||
const data = new FormData()
|
const data = new FormData()
|
||||||
@@ -151,7 +155,10 @@ export default function AddDialog({ handleClose }) {
|
|||||||
data.append('file', selectedFile)
|
data.append('file', selectedFile)
|
||||||
title && data.append('title', title)
|
title && data.append('title', title)
|
||||||
posterUrl && data.append('poster', posterUrl)
|
posterUrl && data.append('poster', posterUrl)
|
||||||
axios.post(torrentUploadHost(), data).finally(handleClose)
|
axios
|
||||||
|
.post(torrentUploadHost(), data)
|
||||||
|
// .then(res => console.log(res))
|
||||||
|
.finally(handleClose)
|
||||||
} else {
|
} else {
|
||||||
// link save
|
// link save
|
||||||
axios
|
axios
|
||||||
@@ -305,8 +312,14 @@ export default function AddDialog({ handleClose }) {
|
|||||||
{t('Cancel')}
|
{t('Cancel')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button variant='contained' disabled={!torrentSource} onClick={handleSave} color='primary'>
|
<Button
|
||||||
{t('Add')}
|
variant='contained'
|
||||||
|
style={{ minWidth: '110px' }}
|
||||||
|
disabled={!torrentSource}
|
||||||
|
onClick={handleSave}
|
||||||
|
color='primary'
|
||||||
|
>
|
||||||
|
{isLoadingButton ? <CircularProgress style={{ color: 'white' }} size={20} /> : t('Add')}
|
||||||
</Button>
|
</Button>
|
||||||
</ButtonWrapper>
|
</ButtonWrapper>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|||||||
Reference in New Issue
Block a user