feat(video): enhance video error handling with retry options

Add retry and redownload buttons for failed video loading states
Improve error message display with detailed failure reason
This commit is contained in:
icarus 2025-10-12 03:44:16 +08:00
parent 46221985bd
commit 82ad9e15e2
2 changed files with 16 additions and 3 deletions

View File

@ -1014,10 +1014,12 @@
"prompt": "Prompt",
"provider": "Provider",
"reasoning_content": "Deep reasoning",
"redownload": "Redownload",
"refresh": "Refresh",
"regenerate": "Regenerate",
"rename": "Rename",
"reset": "Reset",
"retry": "Retry",
"save": "Save",
"saved": "Saved",
"search": "Search",
@ -4648,7 +4650,10 @@
"video": {
"error": {
"invalid": "Invalid video",
"load": "Failed to load the video"
"load": {
"message": "Failed to load the video",
"reason": "The file may be corrupted or has been deleted externally."
}
},
"prompt": {
"placeholder": "describes the video to generate"

View File

@ -1,4 +1,4 @@
import { Progress, Radio, RadioGroup, Spinner } from '@heroui/react'
import { Button, Progress, Radio, RadioGroup, Spinner } from '@heroui/react'
import { Video, VideoStatus } from '@renderer/types/video'
import { CheckCircleIcon, CircleXIcon } from 'lucide-react'
import { useState } from 'react'
@ -85,12 +85,20 @@ export const VideoViewer = ({ video: _video }: VideoProps) => {
<div className="flex h-full w-full flex-col items-center justify-center rounded-2xl bg-danger-200">
<CircleXIcon size={64} className="fill-danger text-danger-200" />
<span className="font-bold text-2xl">{t('video.status.failed')}</span>
<div className="my-2 flex justify-between gap-2">
<Button onPress={() => window.toast.info('Not implemented')}>{t('common.detail')}</Button>
<Button onPress={() => window.toast.info('Not implemented')}>{t('common.retry')}</Button>
</div>
</div>
)}
{video && video.status === 'downloaded' && loadSuccess === false && (
<div className="flex h-full w-full flex-col items-center justify-center rounded-2xl bg-danger-200">
<CircleXIcon size={64} className="fill-danger text-danger-200" />
<span className="font-bold text-2xl">{t('video.error.load')}</span>
<span className="font-bold text-2xl">{t('video.error.load.message')}</span>
<span>{t('video.error.load.reason')}</span>
<div className="my-2 flex justify-between gap-2">
<Button onPress={() => window.toast.info('Not implemented')}>{t('common.redownload')}</Button>
</div>
</div>
)}
</div>