|
@@ -1,22 +1,28 @@
|
|
import styles from "./FileSort.module.less";
|
|
import styles from "./FileSort.module.less";
|
|
-import { Button } from "antd";
|
|
|
|
|
|
+import { Button, Card } from "antd";
|
|
import { invoke } from "@tauri-apps/api/tauri";
|
|
import { invoke } from "@tauri-apps/api/tauri";
|
|
import { open } from "@tauri-apps/api/dialog";
|
|
import { open } from "@tauri-apps/api/dialog";
|
|
|
|
+import { useState } from "react";
|
|
export default function FileSort() {
|
|
export default function FileSort() {
|
|
|
|
+ const [fileStr, setFile] = useState<string[]>([]);
|
|
async function sort() {
|
|
async function sort() {
|
|
-
|
|
|
|
const selected = await open({
|
|
const selected = await open({
|
|
directory: false,
|
|
directory: false,
|
|
- multiple: false,
|
|
|
|
|
|
+ multiple: false,
|
|
// defaultPath: await appDataDir(),
|
|
// defaultPath: await appDataDir(),
|
|
});
|
|
});
|
|
- await invoke("file_sort", {path: selected});
|
|
|
|
|
|
+ setFile([...fileStr, await invoke("file_sort", { path: selected })]);
|
|
}
|
|
}
|
|
return (
|
|
return (
|
|
<div className={styles.FileSortBox}>
|
|
<div className={styles.FileSortBox}>
|
|
{/* <div style={{ backgroundColor: "green", height: "200vh" }}>FileClear</div> */}
|
|
{/* <div style={{ backgroundColor: "green", height: "200vh" }}>FileClear</div> */}
|
|
<div>
|
|
<div>
|
|
<Button onClick={() => sort()}>Sort</Button>
|
|
<Button onClick={() => sort()}>Sort</Button>
|
|
|
|
+ <div>
|
|
|
|
+ {fileStr.map((item) => (
|
|
|
|
+ <Card key={item}>{item}</Card>
|
|
|
|
+ ))}
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|