Refactor media import components for improved layout and functionality
Updated the ManualInboxPanel, MediaImportDialog, MovieImportPanel, and UploadToShowPanel to enhance their layout and responsiveness. Adjusted flex properties to ensure consistent sizing and overflow handling across components. Simplified the MediaImportDialog by removing unnecessary file handling logic, and improved localization strings for clarity. These changes aim to enhance user experience and maintain a cohesive design across the media import interface.
This commit is contained in:
@@ -41,12 +41,9 @@ export function MediaPanel() {
|
||||
const { t } = useTranslation()
|
||||
const queryClient = useQueryClient()
|
||||
const fileInput = useRef<HTMLInputElement>(null)
|
||||
const fileInputShow = useRef<HTMLInputElement>(null)
|
||||
const [filter, setFilter] = useState<MediaFilter>('active')
|
||||
const [page, setPage] = useState(1)
|
||||
const { sort, toggle } = useTableSort('created', true)
|
||||
// Файлы, выбранные для загрузки в шоу: с ними окно импорта открывается сразу на нужной вкладке.
|
||||
const [filesForShow, setFilesForShow] = useState<File[] | null>(null)
|
||||
const [importOpen, setImportOpen] = useState(false)
|
||||
const enqueue = useUploadStore((s) => s.enqueue)
|
||||
|
||||
@@ -170,21 +167,6 @@ export function MediaPanel() {
|
||||
e.target.value = ''
|
||||
}}
|
||||
/>
|
||||
<input
|
||||
ref={fileInputShow}
|
||||
type="file"
|
||||
accept="video/*,.mkv,.avi,.ts"
|
||||
multiple
|
||||
className="hidden"
|
||||
onChange={(e) => {
|
||||
const files = e.target.files
|
||||
if (files && files.length > 0) {
|
||||
setFilesForShow(Array.from(files))
|
||||
setImportOpen(true)
|
||||
}
|
||||
e.target.value = ''
|
||||
}}
|
||||
/>
|
||||
<Button size="sm" variant="outline" onClick={() => setImportOpen(true)}>
|
||||
<FolderInput className="h-4 w-4" />
|
||||
{t('admin.media.importButton')}
|
||||
@@ -196,15 +178,7 @@ export function MediaPanel() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{importOpen && (
|
||||
<MediaImportDialog
|
||||
files={filesForShow}
|
||||
onClose={() => {
|
||||
setImportOpen(false)
|
||||
setFilesForShow(null)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{importOpen && <MediaImportDialog onClose={() => setImportOpen(false)} />}
|
||||
|
||||
<div className="crt-panel overflow-x-auto rounded-md">
|
||||
<table className="w-full text-sm">
|
||||
|
||||
Reference in New Issue
Block a user