code refactoring
This commit is contained in:
@@ -22,8 +22,16 @@ import Toolbar from '@mui/material/Toolbar'
|
|||||||
import { TransitionProps } from '@mui/material/transitions'
|
import { TransitionProps } from '@mui/material/transitions'
|
||||||
import Typography from '@mui/material/Typography'
|
import Typography from '@mui/material/Typography'
|
||||||
import { Buffer } from 'buffer'
|
import { Buffer } from 'buffer'
|
||||||
import { forwardRef, useContext, useEffect, useMemo, useRef, useState, useTransition } from 'react'
|
import {
|
||||||
import { useDispatch, useSelector } from 'react-redux'
|
forwardRef,
|
||||||
|
useContext,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useRef,
|
||||||
|
useState,
|
||||||
|
useTransition
|
||||||
|
} from 'react'
|
||||||
|
import { useSelector } from 'react-redux'
|
||||||
import FormatsGrid from '../components/FormatsGrid'
|
import FormatsGrid from '../components/FormatsGrid'
|
||||||
import { CliArguments } from '../lib/argsParser'
|
import { CliArguments } from '../lib/argsParser'
|
||||||
import { I18nContext } from '../providers/i18nProvider'
|
import { I18nContext } from '../providers/i18nProvider'
|
||||||
@@ -31,7 +39,6 @@ import { RPCClientContext } from '../providers/rpcClientProvider'
|
|||||||
import { RootState } from '../stores/store'
|
import { RootState } from '../stores/store'
|
||||||
import type { DLMetadata } from '../types'
|
import type { DLMetadata } from '../types'
|
||||||
import { isValidURL, toFormatArgs } from '../utils'
|
import { isValidURL, toFormatArgs } from '../utils'
|
||||||
import { isPending } from '@reduxjs/toolkit'
|
|
||||||
|
|
||||||
const Transition = forwardRef(function Transition(
|
const Transition = forwardRef(function Transition(
|
||||||
props: TransitionProps & {
|
props: TransitionProps & {
|
||||||
@@ -241,13 +248,25 @@ export default function DownloadDialog({
|
|||||||
label={i18n.t('urlInput')}
|
label={i18n.t('urlInput')}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
onChange={handleUrlChange}
|
onChange={handleUrlChange}
|
||||||
disabled={!status.connected || (settings.formatSelection && downloadFormats != null)}
|
disabled={
|
||||||
|
!status.connected
|
||||||
|
|| (settings.formatSelection && downloadFormats != null)
|
||||||
|
}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
endAdornment: (
|
endAdornment: (
|
||||||
<InputAdornment position="end">
|
<InputAdornment position="end">
|
||||||
<label htmlFor="icon-button-file">
|
<label htmlFor="icon-button-file">
|
||||||
<Input id="icon-button-file" type="file" accept=".txt" onChange={parseUrlListFile} />
|
<Input
|
||||||
<IconButton color="primary" aria-label="upload file" component="span">
|
id="icon-button-file"
|
||||||
|
type="file"
|
||||||
|
accept=".txt"
|
||||||
|
onChange={parseUrlListFile}
|
||||||
|
/>
|
||||||
|
<IconButton
|
||||||
|
color="primary"
|
||||||
|
aria-label="upload file"
|
||||||
|
component="span"
|
||||||
|
>
|
||||||
<FileUpload />
|
<FileUpload />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user