|
@@ -3,8 +3,8 @@ import { invoke } from "@tauri-apps/api/core";
|
|
|
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
|
import { listen, type UnlistenFn } from "@tauri-apps/api/event";
|
|
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
|
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
|
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
|
|
-import { openUrl, revealItemInDir } from "@tauri-apps/plugin-opener";
|
|
|
|
|
-import { Button, ConfigProvider, Divider, InputNumber, Layout, Menu, notification, Space, theme, Tooltip } from "antd";
|
|
|
|
|
|
|
+import { revealItemInDir } from "@tauri-apps/plugin-opener";
|
|
|
|
|
+import { Button, Divider, InputNumber, Layout, Menu, notification, Space, theme, Tooltip } from "antd";
|
|
|
import {
|
|
import {
|
|
|
countPendingTasks,
|
|
countPendingTasks,
|
|
|
listPendingTasks,
|
|
listPendingTasks,
|
|
@@ -44,8 +44,10 @@ import {
|
|
|
LinkOutlined,
|
|
LinkOutlined,
|
|
|
LoadingOutlined,
|
|
LoadingOutlined,
|
|
|
MinusOutlined,
|
|
MinusOutlined,
|
|
|
|
|
+ OrderedListOutlined,
|
|
|
PictureOutlined,
|
|
PictureOutlined,
|
|
|
PlayCircleFilled,
|
|
PlayCircleFilled,
|
|
|
|
|
+ PlusOutlined,
|
|
|
StopOutlined,
|
|
StopOutlined,
|
|
|
VideoCameraOutlined,
|
|
VideoCameraOutlined,
|
|
|
} from "@ant-design/icons";
|
|
} from "@ant-design/icons";
|
|
@@ -78,13 +80,13 @@ async function loadInWebview(taskId: string, url: string) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/** 点条目右侧图标:调系统浏览器打开 */
|
|
/** 点条目右侧图标:调系统浏览器打开 */
|
|
|
-async function openInBrowser(url: string) {
|
|
|
|
|
- try {
|
|
|
|
|
- await openUrl(url);
|
|
|
|
|
- } catch (e) {
|
|
|
|
|
- console.error("打开系统浏览器失败:", e);
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
|
|
+// async function openInBrowser(url: string) {
|
|
|
|
|
+// try {
|
|
|
|
|
+// await openUrl(url);
|
|
|
|
|
+// } catch (e) {
|
|
|
|
|
+// console.error("打开系统浏览器失败:", e);
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
function App() {
|
|
function App() {
|
|
|
// 当前激活的任务 id(仅用于左栏视觉高亮)
|
|
// 当前激活的任务 id(仅用于左栏视觉高亮)
|
|
@@ -206,7 +208,8 @@ function App() {
|
|
|
const pending = await countPendingTasks().catch(() => 0);
|
|
const pending = await countPendingTasks().catch(() => 0);
|
|
|
const list = await reloadTasks();
|
|
const list = await reloadTasks();
|
|
|
if (pending === 0 && list.length === 0) {
|
|
if (pending === 0 && list.length === 0) {
|
|
|
- await openImportWindow();
|
|
|
|
|
|
|
+ setTimeout(() =>
|
|
|
|
|
+ openImportWindow(), 500);
|
|
|
}
|
|
}
|
|
|
})();
|
|
})();
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -569,8 +572,8 @@ function App() {
|
|
|
token: { colorBgContainer },
|
|
token: { colorBgContainer },
|
|
|
} = theme.useToken();
|
|
} = theme.useToken();
|
|
|
|
|
|
|
|
- const [statusColor, setStatusColor] = useState("#888");
|
|
|
|
|
- const [statusText, setStatusText] = useState("请选择任务");
|
|
|
|
|
|
|
+ const [statusColor] = useState("#888");
|
|
|
|
|
+ const [statusText] = useState("请选择任务");
|
|
|
|
|
|
|
|
// 当前窗口句柄,用于自定义标题栏的最小化 / 关闭
|
|
// 当前窗口句柄,用于自定义标题栏的最小化 / 关闭
|
|
|
const appWindow = useMemo(() => getCurrentWindow(), []);
|
|
const appWindow = useMemo(() => getCurrentWindow(), []);
|
|
@@ -789,19 +792,24 @@ function App() {
|
|
|
</Header>
|
|
</Header>
|
|
|
<Layout>
|
|
<Layout>
|
|
|
<Sider className="select-none" collapsible collapsed={collapsed} onCollapse={(c) => handleCollaspsed(c)} width={180} style={{ background: colorBgContainer }}>
|
|
<Sider className="select-none" collapsible collapsed={collapsed} onCollapse={(c) => handleCollaspsed(c)} width={180} style={{ background: colorBgContainer }}>
|
|
|
- <Menu
|
|
|
|
|
- mode="inline"
|
|
|
|
|
- defaultSelectedKeys={[activeId || '']}
|
|
|
|
|
- selectedKeys={[activeId || '']}
|
|
|
|
|
- style={{ height: '100%', borderInlineEnd: 0 }}
|
|
|
|
|
- onClick={handleSelectTask}
|
|
|
|
|
|
|
+ <div className="h-full w-full flex-row">
|
|
|
|
|
+ <div className="flex justify-between items-center text-md pl-1 font-bold text-white"><OrderedListOutlined />{collapsed ? '' : '所有任务'}<Button icon={<PlusOutlined />} onClick={openImportWindow} /> </div>
|
|
|
|
|
+ <div className="flex-1 overflow-y-auto">
|
|
|
|
|
+ <Menu
|
|
|
|
|
+ mode="vertical"
|
|
|
|
|
+ defaultSelectedKeys={[activeId || '']}
|
|
|
|
|
+ selectedKeys={[activeId || '']}
|
|
|
|
|
+ style={{ borderInlineEnd: 0, height: '100%' }}
|
|
|
|
|
+ onClick={handleSelectTask}
|
|
|
|
|
|
|
|
- >
|
|
|
|
|
- {tasks.map((t) => <Menu.Item icon={<LinkOutlined />} key={t.id}>
|
|
|
|
|
- {t.id}
|
|
|
|
|
- </Menu.Item>
|
|
|
|
|
- )}
|
|
|
|
|
- </Menu>
|
|
|
|
|
|
|
+ >
|
|
|
|
|
+ {tasks.map((t) => <Menu.Item icon={<LinkOutlined />} key={t.id}>
|
|
|
|
|
+ {t.id}
|
|
|
|
|
+ </Menu.Item>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </Menu>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</Sider>
|
|
</Sider>
|
|
|
<Layout className="flex flex-row">
|
|
<Layout className="flex flex-row">
|
|
|
<Content className="w-full m-0 p-1 flex-1" />
|
|
<Content className="w-full m-0 p-1 flex-1" />
|
|
@@ -819,11 +827,4 @@ function App() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-export default function Main() {
|
|
|
|
|
- return <ConfigProvider theme={{
|
|
|
|
|
- // 1. Use dark algorithm alone
|
|
|
|
|
- algorithm: [theme.darkAlgorithm, theme.compactAlgorithm]
|
|
|
|
|
- }}>
|
|
|
|
|
- <App />
|
|
|
|
|
- </ ConfigProvider>
|
|
|
|
|
-};
|
|
|
|
|
|
|
+export default App;
|