import { useMachine } from '@xstate/react';
import { Table, Button, Progress, Alert } from 'antd';
import { shell } from 'electron';
import {
DownloadOutlined,
PlaySquareOutlined,
ClearOutlined,
GithubOutlined,
EyeOutlined,
FormatPainterOutlined,
RedoOutlined,
} from '@ant-design/icons';
import fsm from './fsm';
import './App.less';
function App() {
const [state, send] = useMachine(fsm);
const { captureList, currentUrl, downloadProgress } = state.context;
return (
{state.matches('检测初始化') ?
检测中……
: null}
{state.matches('初始化完成') ? (
}
onClick={() => send('e_清空捕获记录')}
>
清空
}
onClick={() => shell.openExternal('https://github.com/lecepin/WeChatVideoDownloader')}
type="primary"
ghost
>
Star
value,
ellipsis: true,
},
{
title: '大小',
dataIndex: 'prettySize',
key: 'prettySize',
width: '100px',
render: value => value,
},
{
title: '操作',
dataIndex: 'action',
key: 'action',
width: '210px',
render: (_, { url, decodeKey, hdUrl, fixUrl, description, fullFileName }) => (
{fullFileName ? (
}
type="primary"
onClick={() => {
shell.openPath(fullFileName);
}}
size="small"
ghost
>
查看
) : (
}
type="primary"
onClick={() => {
send({
type: 'e_下载',
url: hdUrl || url,
decodeKey: decodeKey,
description: description,
});
}}
size="small"
>
解密下载
)}
),
},
]}
pagination={{ position: ['none', 'none'] }}
>
{state.matches('初始化完成.预览') ? (
{
e.target == e.currentTarget && send('e_关闭');
}}
>
) : null}
{state.matches('初始化完成.下载.下载中') ? (
) : null}
) : null}
{state.matches('未初始化') ? (
) : null}
{state.matches('开启服务失败') ? (
) : null}
);
}
export default App;