From 41041fa296be4f719e653e200de81f24af3180e4 Mon Sep 17 00:00:00 2001 From: icarus Date: Mon, 13 Oct 2025 14:20:07 +0800 Subject: [PATCH] feat(video): add download button for completed videos Implement download button UI for completed videos. Currently shows a toast notification as the functionality is not yet implemented. --- src/renderer/src/pages/video/VideoPanel.tsx | 7 ++++++- src/renderer/src/pages/video/VideoViewer.tsx | 22 +++++++++++++------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/renderer/src/pages/video/VideoPanel.tsx b/src/renderer/src/pages/video/VideoPanel.tsx index a10d3a9b97..a7532121d9 100644 --- a/src/renderer/src/pages/video/VideoPanel.tsx +++ b/src/renderer/src/pages/video/VideoPanel.tsx @@ -69,6 +69,10 @@ export const VideoPanel = ({ provider, video, params, updateParams }: VideoPanel } }, [addOpenAIVideo, couldCreateVideo, params, t, video]) + const handleDownloadVideo = (videoId: string) => { + window.toast.info('Not implemented') + } + const handleUploadFile = useCallback(() => { fileInputRef.current?.click() }, []) @@ -114,7 +118,8 @@ export const VideoPanel = ({ provider, video, params, updateParams }: VideoPanel
- + {video && } + {!video && }
diff --git a/src/renderer/src/pages/video/VideoViewer.tsx b/src/renderer/src/pages/video/VideoViewer.tsx index 611456260c..a63413cd19 100644 --- a/src/renderer/src/pages/video/VideoViewer.tsx +++ b/src/renderer/src/pages/video/VideoViewer.tsx @@ -14,11 +14,17 @@ import { CheckCircleIcon, CircleXIcon } from 'lucide-react' import { useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' -export interface VideoViewerProps { - video?: Video -} +export type VideoViewerProps = + | { + video: undefined + onDownload?: never + } + | { + video: Video + onDownload: (videoId: string) => void + } -export const VideoViewer = ({ video }: VideoViewerProps) => { +export const VideoViewer = ({ video, onDownload }: VideoViewerProps) => { const { t } = useTranslation() const [loadSuccess, setLoadSuccess] = useState(undefined) return ( @@ -27,7 +33,7 @@ export const VideoViewer = ({ video }: VideoViewerProps) => { {video === undefined && t('video.undefined')} {video && video.status === 'queued' && } {video && video.status === 'in_progress' && } - {video && video.status === 'completed' && } + {video && video.status === 'completed' && onDownload(video.id)} />} {video && video.status === 'downloading' && } {video && video.status === 'downloaded' && loadSuccess !== false && (