Skip to content

Commit c6894ae

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents a1028e7 + 479413f commit c6894ae

File tree

5 files changed

+35
-23
lines changed

5 files changed

+35
-23
lines changed

crowdin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
files:
2-
- source: /public/locales/en-US/*.json
2+
- source: /public/locales/zh-CN/*.json
33
translation: /public/locales/%locale%/%original_file_name%

public/locales/en-US/dashboard.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@
669669
"compressSize": "Maximum file size to be compressed",
670670
"compressSizeDes": "The maximum total file size of compression jobs that can be created by the user, fill in 0 to indicate no limit.",
671671
"decompressSize": "Maximum file size to be decompressed",
672-
"decompressSizeDes": "The maximum total file size of decompression jobs that can be created by the user, fill in 0 to indicate no limit.",
672+
"decompressSizeDes": "The maximum total file size of decompression jobs that can be created by the user, fill in 0 to indicate no limit."
673673
},
674674
"user": {
675675
"deleted": "User deleted.",
@@ -766,4 +766,4 @@
766766
"lastProgress": "Last progress",
767767
"errorMsg": "Error message"
768768
}
769-
}
769+
}

public/locales/zh-CN/dashboard.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@
668668
"compressSize": "待压缩文件最大大小",
669669
"compressSizeDes": "用户可创建的压缩任务的文件最大总大小,填写为 0 表示不限制",
670670
"decompressSize": "待解压文件最大大小",
671-
"decompressSizeDes": "用户可创建的解压缩任务的文件最大总大小,填写为 0 表示不限制",
671+
"decompressSizeDes": "用户可创建的解压缩任务的文件最大总大小,填写为 0 表示不限制"
672672
},
673673
"user": {
674674
"deleted": "用户已删除",
@@ -765,4 +765,4 @@
765765
"lastProgress": "最后进度",
766766
"errorMsg": "错误信息"
767767
}
768-
}
768+
}

src/component/Modals/DirectoryDownload.js

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
import React, { useCallback, useState, useEffect, useRef } from "react";
1+
import React, { useState, useEffect, useRef } from "react";
22
import {
33
Button,
44
CircularProgress,
55
Dialog,
66
DialogActions,
77
DialogContent,
8-
DialogContentText,
98
DialogTitle,
109
makeStyles,
11-
FormControl,
1210
FormControlLabel,
1311
Checkbox,
1412
} from "@material-ui/core";
15-
import { useDispatch } from "react-redux";
1613
import TextField from "@material-ui/core/TextField";
1714
import { useTranslation } from "react-i18next";
18-
import { useInterval } from "ahooks";
15+
import { useInterval, usePrevious, useGetState } from "ahooks";
1916
import { cancelDirectoryDownload } from "../../redux/explorer/action";
17+
import Auth from "../../middleware/Auth";
2018

2119
const useStyles = makeStyles((theme) => ({
2220
contentFix: {
@@ -39,13 +37,25 @@ export default function DirectoryDownloadDialog(props) {
3937
const classes = useStyles();
4038

4139
const logRef = useRef();
42-
const autoScroll = useRef(true);
40+
const [autoScroll, setAutoScroll] = useState(
41+
Auth.GetPreferenceWithDefault("autoScroll", true)
42+
);
43+
const previousLog = usePrevious(props.log, (prev, next) => true);
44+
const [timer, setTimer] = useState(-1);
4345

4446
useInterval(() => {
45-
if (autoScroll.current && !props.done && logRef.current) {
47+
if (autoScroll && logRef.current && previousLog !== props.log) {
4648
logRef.current.scrollIntoView({ behavior: "smooth", block: "end" });
4749
}
48-
}, 1000);
50+
}, timer);
51+
52+
useEffect(() => {
53+
if (props.done) {
54+
setTimer(-1);
55+
} else if (props.open) {
56+
setTimer(1000);
57+
}
58+
}, [props.done, props.open]);
4959

5060
return (
5161
<Dialog
@@ -65,24 +75,25 @@ export default function DirectoryDownloadDialog(props) {
6575
ref={logRef}
6676
multiline
6777
fullWidth
68-
autoFocus
6978
id="standard-basic"
7079
/>
7180
</DialogContent>
7281
<DialogActions>
7382
<FormControlLabel
74-
control={
75-
<Checkbox
76-
checked={autoScroll.current}
77-
onChange={() =>
78-
(autoScroll.current = !autoScroll.current)
79-
}
80-
/>
83+
control={<Checkbox />}
84+
checked={autoScroll}
85+
onChange={() =>
86+
setAutoScroll((previous) => {
87+
Auth.SetPreference("autoScroll", !previous);
88+
return !previous;
89+
})
8190
}
8291
label={t("modals.directoryDownloadAutoscroll")}
8392
/>
8493
<Button
85-
onClick={props.done ? props.onClose : cancelDirectoryDownload}
94+
onClick={
95+
props.done ? props.onClose : cancelDirectoryDownload
96+
}
8697
>
8798
{t("cancel", { ns: "common" })}
8899
</Button>

src/redux/explorer/action.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ export const startDirectoryDownload = (
458458
share: any
459459
): ThunkAction<any, any, any, any> => {
460460
return async (dispatch, getState): Promise<void> => {
461+
dispatch(changeContextMenu("file", false));
462+
461463
directoryDownloadAbortController = new AbortController();
462464
if (!window.showDirectoryPicker || !window.isSecureContext) {
463465
return;
@@ -493,7 +495,6 @@ export const startDirectoryDownload = (
493495
return;
494496
}
495497

496-
dispatch(changeContextMenu("file", false));
497498
const {
498499
explorer: { selected },
499500
navigator: { path },

0 commit comments

Comments
 (0)