chore: export

This commit is contained in:
lencx
2023-01-15 01:18:03 +08:00
parent ae2c56805c
commit f1a807ed46
10 changed files with 264 additions and 19 deletions

View File

@@ -18,7 +18,7 @@ function renderFile(buff: Uint8Array, type: string) {
return URL.createObjectURL(new Blob([buff], { type: renderType }));
}
export default function SyncPrompts() {
export default function Download() {
const [downloadPath, setDownloadPath] = useState('');
const [source, setSource] = useState('');
const [isVisible, setVisible] = useState(false);
@@ -51,9 +51,6 @@ export default function SyncPrompts() {
setVisible(true);
return;
}
if (opInfo.opType === 'file') {
await shell.open(file);
}
if (opInfo.opType === 'delete') {
await fs.removeFile(file);
await handleRefresh();
@@ -90,8 +87,9 @@ export default function SyncPrompts() {
};
const handleRefresh = async () => {
await invoke('download_list', { pathname: CHAT_DOWNLOAD_JSON });
refreshJson();
await invoke('download_list', { pathname: CHAT_DOWNLOAD_JSON, dir: 'download' });
const data = await refreshJson();
opInit(data);
};
const handleCancel = () => {
@@ -107,7 +105,7 @@ export default function SyncPrompts() {
<>
<Popconfirm
overlayStyle={{ width: 250 }}
title="Sync will overwrite the previous data, confirm to sync?"
title="Files cannot be recovered after deletion, are you sure you want to delete them?"
placement="topLeft"
onConfirm={handleDelete}
okText="Yes"