feat: complete text

This commit is contained in:
TaurusXin 2024-07-24 08:55:44 +08:00
parent e0dbd03397
commit 29b7366727
1 changed files with 4 additions and 1 deletions

View File

@ -19,6 +19,8 @@ const Download = (props: { onFinish: () => void }) => {
const [downloadProgress, setDownloadProgress] = useState<number>(0.0)
const [isDisabled, setIsDisabled] = useState(true)
const [title, setTitle] = useState('Downloading')
useEffect(() => {
Close().then(res => {
StartDownload().then(res => {
@ -28,6 +30,7 @@ const Download = (props: { onFinish: () => void }) => {
setDownloadProgress(progress * 100)
if (progress === 1) {
props.onFinish()
setTitle('Completed')
setIsDisabled(false)
}
})
@ -38,7 +41,7 @@ const Download = (props: { onFinish: () => void }) => {
<Dialog open={isOpen}>
<DialogContent>
<DialogHeader>
<DialogTitle>Downloading</DialogTitle>
<DialogTitle>{title}</DialogTitle>
</DialogHeader>
<Progress value={downloadProgress} />
<DialogFooter>