mirror of
https://github.com/zoriya/flood.git
synced 2026-06-02 02:56:05 +00:00
AddTorrentsBy[File/URL]: add "Sequential Download" toggle
This commit is contained in:
@@ -15,6 +15,7 @@ interface FilesystemBrowserTextboxProps {
|
||||
suggested?: string;
|
||||
showBasePathToggle?: boolean;
|
||||
showCompletedToggle?: boolean;
|
||||
showSequentialToggle?: boolean;
|
||||
onChange?: (destination: string) => void;
|
||||
}
|
||||
|
||||
@@ -27,6 +28,7 @@ const FilesystemBrowserTextbox = forwardRef<HTMLInputElement, FilesystemBrowserT
|
||||
suggested,
|
||||
showBasePathToggle,
|
||||
showCompletedToggle,
|
||||
showSequentialToggle,
|
||||
onChange,
|
||||
}: FilesystemBrowserTextboxProps,
|
||||
ref,
|
||||
@@ -79,6 +81,14 @@ const FilesystemBrowserTextbox = forwardRef<HTMLInputElement, FilesystemBrowserT
|
||||
</Checkbox>,
|
||||
);
|
||||
}
|
||||
if (showSequentialToggle) {
|
||||
// TODO: this is getting bloated. toggles can be moved to their own elements...
|
||||
toggles.push(
|
||||
<Checkbox grow={false} id="isSequential" key="isSequential">
|
||||
<FormattedMessage id="torrents.destination.sequential" />
|
||||
</Checkbox>,
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<FormRowGroup ref={formRowRef}>
|
||||
@@ -156,6 +166,7 @@ FilesystemBrowserTextbox.defaultProps = {
|
||||
suggested: undefined,
|
||||
showBasePathToggle: false,
|
||||
showCompletedToggle: false,
|
||||
showSequentialToggle: false,
|
||||
onChange: undefined,
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ interface AddTorrentsByFileFormData {
|
||||
tags: string;
|
||||
isBasePath: boolean;
|
||||
isCompleted: boolean;
|
||||
isSequential: boolean;
|
||||
}
|
||||
|
||||
const AddTorrentsByFile: FC = () => {
|
||||
@@ -64,6 +65,7 @@ const AddTorrentsByFile: FC = () => {
|
||||
selectable="directories"
|
||||
showBasePathToggle
|
||||
showCompletedToggle
|
||||
showSequentialToggle
|
||||
/>
|
||||
<AddTorrentsActions
|
||||
onAddTorrentsClick={() => {
|
||||
@@ -74,7 +76,14 @@ const AddTorrentsByFile: FC = () => {
|
||||
const formData = formRef.current?.getFormData();
|
||||
setIsAddingTorrents(true);
|
||||
|
||||
const {destination, start, tags, isBasePath, isCompleted} = formData as Partial<AddTorrentsByFileFormData>;
|
||||
const {
|
||||
destination,
|
||||
start,
|
||||
tags,
|
||||
isBasePath,
|
||||
isCompleted,
|
||||
isSequential,
|
||||
} = formData as Partial<AddTorrentsByFileFormData>;
|
||||
|
||||
const filesData: Array<string> = [];
|
||||
filesRef.current.forEach((file) => {
|
||||
@@ -94,6 +103,7 @@ const AddTorrentsByFile: FC = () => {
|
||||
tags: tagsArray,
|
||||
isBasePath,
|
||||
isCompleted,
|
||||
isSequential,
|
||||
start,
|
||||
}).then(() => {
|
||||
UIStore.dismissModal();
|
||||
|
||||
@@ -20,6 +20,7 @@ type AddTorrentsByURLFormData = {
|
||||
destination: string;
|
||||
isBasePath: boolean;
|
||||
isCompleted: boolean;
|
||||
isSequential: boolean;
|
||||
start: boolean;
|
||||
tags: string;
|
||||
};
|
||||
@@ -99,6 +100,7 @@ const AddTorrentsByURL: FC = () => {
|
||||
selectable="directories"
|
||||
showBasePathToggle
|
||||
showCompletedToggle
|
||||
showSequentialToggle
|
||||
/>
|
||||
<AddTorrentsActions
|
||||
onAddTorrentsClick={() => {
|
||||
@@ -134,6 +136,7 @@ const AddTorrentsByURL: FC = () => {
|
||||
destination: formData.destination,
|
||||
isBasePath: formData.isBasePath,
|
||||
isCompleted: formData.isCompleted,
|
||||
isSequential: formData.isSequential,
|
||||
start: formData.start,
|
||||
tags,
|
||||
}).then(() => {
|
||||
|
||||
@@ -1859,6 +1859,12 @@
|
||||
"value": "Completed"
|
||||
}
|
||||
],
|
||||
"torrents.destination.sequential": [
|
||||
{
|
||||
"type": 0,
|
||||
"value": "Sequential Download"
|
||||
}
|
||||
],
|
||||
"torrents.details.actions.pause": [
|
||||
{
|
||||
"type": 0,
|
||||
|
||||
@@ -265,6 +265,7 @@
|
||||
"torrents.create.tags.input.placeholder": "Tags in Flood. Not added to created torrent.",
|
||||
"torrents.destination.base_path": "Use as Base Path",
|
||||
"torrents.destination.completed": "Completed",
|
||||
"torrents.destination.sequential": "Sequential Download",
|
||||
"torrents.details.actions.pause": "Pause",
|
||||
"torrents.details.actions.start": "Start",
|
||||
"torrents.details.actions.stop": "Stop",
|
||||
|
||||
Reference in New Issue
Block a user