mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-15 19:27:42 +08:00
Fix file upload issues on Windows
This commit is contained in:
parent
afcb3b0776
commit
47f22d8753
2 changed files with 20 additions and 3 deletions
|
@ -9,10 +9,10 @@ import { Toolbox } from "@/components";
|
|||
import { QueryOverlay } from "@/components/async";
|
||||
import { ItemEditModal } from "@/components/forms/ItemEditForm";
|
||||
import { SeriesUploadModal } from "@/components/forms/SeriesUploadForm";
|
||||
import File, { FileOverlay } from "@/components/inputs/File";
|
||||
import File, { FileOverlay, FileProps } from "@/components/inputs/File";
|
||||
import { SubtitleToolsModal } from "@/components/modals";
|
||||
import { useModals } from "@/modules/modals";
|
||||
import { task, TaskGroup } from "@/modules/task";
|
||||
import { notification, task, TaskGroup } from "@/modules/task";
|
||||
import ItemOverview from "@/pages/views/ItemOverview";
|
||||
import { useLanguageProfileBy } from "@/utilities/languages";
|
||||
import {
|
||||
|
@ -26,6 +26,7 @@ import {
|
|||
} from "@fortawesome/free-solid-svg-icons";
|
||||
import { Container, Group, Stack } from "@mantine/core";
|
||||
import { useDocumentTitle } from "@mantine/hooks";
|
||||
import { showNotification } from "@mantine/notifications";
|
||||
import { FunctionComponent, useCallback, useMemo, useRef } from "react";
|
||||
import { Navigate, useParams } from "react-router-dom";
|
||||
import Table from "./table";
|
||||
|
@ -73,11 +74,24 @@ const SeriesEpisodesView: FunctionComponent = () => {
|
|||
files,
|
||||
series,
|
||||
});
|
||||
} else {
|
||||
showNotification(
|
||||
notification.warn(
|
||||
"Cannot Upload Files",
|
||||
"series or language profile is not ready"
|
||||
)
|
||||
);
|
||||
}
|
||||
},
|
||||
[modals, profile, series]
|
||||
);
|
||||
|
||||
const onReject = useCallback<Sure<FileProps["onReject"]>>((rejections) => {
|
||||
showNotification(
|
||||
notification.warn("Cannot Upload Files", "Some files are invalid")
|
||||
);
|
||||
}, []);
|
||||
|
||||
useDocumentTitle(`${series?.title ?? "Unknown Series"} - Bazarr (Series)`);
|
||||
|
||||
if (isNaN(id) || (isFetched && !series)) {
|
||||
|
@ -87,6 +101,7 @@ const SeriesEpisodesView: FunctionComponent = () => {
|
|||
return (
|
||||
<Container px={0} fluid>
|
||||
<QueryOverlay result={seriesQuery}>
|
||||
{/* TODO: Still have some bugs. Handle it later */}
|
||||
<FileOverlay
|
||||
disabled={profile === undefined}
|
||||
accept={[""]}
|
||||
|
@ -96,9 +111,9 @@ const SeriesEpisodesView: FunctionComponent = () => {
|
|||
{/* A workaround to allow click to upload files */}
|
||||
<File
|
||||
disabled={profile === undefined}
|
||||
accept={[""]}
|
||||
openRef={dialogRef}
|
||||
onDrop={onDrop}
|
||||
onReject={onReject}
|
||||
></File>
|
||||
</div>
|
||||
<Toolbox>
|
||||
|
|
2
frontend/src/types/utilities.d.ts
vendored
2
frontend/src/types/utilities.d.ts
vendored
|
@ -24,5 +24,7 @@ interface DataWrapperWithTotal<T> {
|
|||
|
||||
type Override<T, U> = T & Omit<U, keyof T>;
|
||||
|
||||
type Sure<T> = Exclude<T, null | undefined>;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type GenericFunction<T = void> = (...args: any[]) => T;
|
||||
|
|
Loading…
Reference in a new issue