diff --git a/src/renderer/src/pages/video/VideoList.tsx b/src/renderer/src/pages/video/VideoList.tsx index 3bd73658c..14cc530c3 100644 --- a/src/renderer/src/pages/video/VideoList.tsx +++ b/src/renderer/src/pages/video/VideoList.tsx @@ -1,7 +1,7 @@ -import { cn, Progress, Spinner } from '@heroui/react' import { Video } from '@renderer/types' -import { CheckCircleIcon, CircleXIcon, ClockIcon, DownloadIcon, PlusIcon } from 'lucide-react' -import { useTranslation } from 'react-i18next' +import { PlusIcon } from 'lucide-react' + +import { VideoListItem } from './VideoListItem' export type VideoListProps = { videos: Video[] @@ -29,107 +29,3 @@ export const VideoList = ({ videos, activeVideoId, setActiveVideoId }: VideoList ) } - -const VideoListItem = ({ video, isActive, onClick }: { video: Video; isActive: boolean; onClick: () => void }) => { - const { t } = useTranslation() - - const getStatusIcon = () => { - switch (video.status) { - case 'queued': - return - case 'in_progress': - return - case 'completed': - return - case 'downloading': - return - case 'downloaded': - return null // No indicator for downloaded state - case 'failed': - return - default: - return null - } - } - - const getStatusColor = () => { - switch (video.status) { - case 'queued': - return 'bg-default-100' - case 'in_progress': - return 'bg-primary-50' - case 'completed': - return 'bg-success-50' - case 'downloading': - return 'bg-primary-50' - case 'downloaded': - return 'bg-success-50' - case 'failed': - return 'bg-danger-50' - default: - return 'bg-default-50' - } - } - - const showProgress = video.status === 'in_progress' || video.status === 'downloading' - const showThumbnail = - (video.status === 'completed' || video.status === 'downloading' || video.status === 'downloaded') && - video.thumbnail !== null - - return ( -
- {/* Thumbnail placeholder */} -
- {showThumbnail ? ( - Video thumbnail - ) : ( -
-
🎬
-
- )} -
- - {/* Status overlay */} -
- - {/* Status indicator */} - {getStatusIcon() && ( -
- {getStatusIcon()} - {t(`video.status.${video.status}`)} -
- )} - - {/* Progress bar for in_progress and downloading states */} - {showProgress && ( -
- -
- )} - - {/* Video info overlay */} -
-
-

{video.metadata.id}

- {video.prompt &&

{video.prompt}

} -
-
- - {/* Failed state overlay */} - {video.status === 'failed' && ( -
- )} -
- ) -} diff --git a/src/renderer/src/pages/video/VideoListItem.tsx b/src/renderer/src/pages/video/VideoListItem.tsx new file mode 100644 index 000000000..14a3d58c8 --- /dev/null +++ b/src/renderer/src/pages/video/VideoListItem.tsx @@ -0,0 +1,116 @@ +import { cn, Progress, Spinner } from '@heroui/react' +import { Video } from '@renderer/types/video' +import { CheckCircleIcon, CircleXIcon, ClockIcon, DownloadIcon } from 'lucide-react' +import { useTranslation } from 'react-i18next' + +export const VideoListItem = ({ + video, + isActive, + onClick +}: { + video: Video + isActive: boolean + onClick: () => void +}) => { + const { t } = useTranslation() + + const getStatusIcon = () => { + switch (video.status) { + case 'queued': + return + case 'in_progress': + return + case 'completed': + return + case 'downloading': + return + case 'downloaded': + return null // No indicator for downloaded state + case 'failed': + return + default: + return null + } + } + + const getStatusColor = () => { + switch (video.status) { + case 'queued': + return 'bg-default-100' + case 'in_progress': + return 'bg-primary-50' + case 'completed': + return 'bg-success-50' + case 'downloading': + return 'bg-primary-50' + case 'downloaded': + return 'bg-success-50' + case 'failed': + return 'bg-danger-50' + default: + return 'bg-default-50' + } + } + + const showProgress = video.status === 'in_progress' || video.status === 'downloading' + const showThumbnail = + (video.status === 'completed' || video.status === 'downloading' || video.status === 'downloaded') && + video.thumbnail !== null + + return ( +
+ {/* Thumbnail placeholder */} +
+ {showThumbnail ? ( + Video thumbnail + ) : ( +
+
🎬
+
+ )} +
+ + {/* Status overlay */} +
+ + {/* Status indicator */} + {getStatusIcon() && ( +
+ {getStatusIcon()} + {t(`video.status.${video.status}`)} +
+ )} + + {/* Progress bar for in_progress and downloading states */} + {showProgress && ( +
+ +
+ )} + + {/* Video info overlay */} +
+
+

{video.metadata.id}

+ {video.prompt &&

{video.prompt}

} +
+
+ + {/* Failed state overlay */} + {video.status === 'failed' && ( +
+ )} +
+ ) +}