From f226bc74c69db6d9eff7331a5175417be3a00982 Mon Sep 17 00:00:00 2001 From: yiling Date: Mon, 15 Jun 2026 16:02:18 +0800 Subject: [PATCH] feat(webui): render bottom bar for all file types and layout carousel above it --- packages/webui/components/file-viewer.tsx | 75 ++++++++++------ .../webui/components/viewers/video-player.tsx | 87 ++++++++++--------- .../projects/$projectId/files/$fileId.tsx | 21 ++--- 3 files changed, 108 insertions(+), 75 deletions(-) diff --git a/packages/webui/components/file-viewer.tsx b/packages/webui/components/file-viewer.tsx index 05e40708..f9884e0b 100644 --- a/packages/webui/components/file-viewer.tsx +++ b/packages/webui/components/file-viewer.tsx @@ -2,7 +2,7 @@ import { useScreenSize } from '@/ui/hooks/useScreenSize' import { getBestTranscode } from '@/ui/lib/media' import type { AssetInfo } from '@shumai/dtos' import { Check, Copy, Download, Minus, Plus } from 'lucide-react' -import type { RefObject } from 'react' +import type { ReactNode, RefObject } from 'react' import { useEffect, useRef, useState } from 'react' import type Player from 'video.js/dist/types/player' import DrawingCanvas from './drawing-canvas' @@ -18,6 +18,7 @@ type FileViewerProps = { onPause?: () => void onTimeUpdate?: (time: number) => void annotations?: Annotation[] + children?: ReactNode } export function FileViewer({ @@ -27,6 +28,7 @@ export function FileViewer({ onPause, onTimeUpdate, annotations, + children, }: FileViewerProps) { const { width: screenWidth } = useScreenSize() const isImage = file.mediaType?.startsWith('image/') @@ -186,10 +188,28 @@ export function FileViewer({ } } - if (!bestUrl) { + const isUnsupported = !bestUrl || (!isImage && !isVideo) + + if (isUnsupported) { return ( -
-

Preview unavailable

+
+
+ {children} +
+

Preview unavailable

+
+
+
+ +
) } @@ -201,26 +221,29 @@ export function FileViewer({
{isImage && ( <> -
- +
+ {children} +
+ +
{/* Zoom Toolbar */}
@@ -278,7 +301,9 @@ export function FileViewer({ onPause={onPause} onTimeUpdate={onTimeUpdate} annotations={displayAnnotations} - /> + > + {children} + )}
) diff --git a/packages/webui/components/viewers/video-player.tsx b/packages/webui/components/viewers/video-player.tsx index c77b003f..2cf6a31b 100644 --- a/packages/webui/components/viewers/video-player.tsx +++ b/packages/webui/components/viewers/video-player.tsx @@ -53,6 +53,7 @@ interface VideoPlayerProps { onPause?: () => void onTimeUpdate?: (time: number) => void annotations?: Annotation[] + children?: React.ReactNode } type DisplayTranscode = VideoTranscode & { resolution: string } @@ -310,6 +311,7 @@ const VideoPlayer: React.FC = ({ onPause, onTimeUpdate, annotations, + children, }) => { const localPlayerRef = useRef(null) const playerRef = passedPlayerRef || localPlayerRef @@ -797,49 +799,54 @@ const VideoPlayer: React.FC = ({ onMouseMove={handleMouseMove} onMouseLeave={handleMouseLeave} > - {/* Video Area */} -
- {/* Hidden VideoJS container */} -
+
+ {/* Render Carousel/Sidebar here if not fullscreen */} + {!state.isFullScreen && children} - {/* Drawing Canvas (Visible) */} - {videoHtmlEl && containerSize.width > 0 && ( - - )} + {/* Video Area */} +
+ {/* Hidden VideoJS container */} +
- {/* Big Play Button Overlay (when paused) */} - {!state.isPlaying && !isDrawing && ( -
-
- + {/* Drawing Canvas (Visible) */} + {videoHtmlEl && containerSize.width > 0 && ( + + )} + + {/* Big Play Button Overlay (when paused) */} + {!state.isPlaying && !isDrawing && ( +
+
+ +
-
- )} + )} +
- {carouselState.show && ( - - )}
{isFetching && (
@@ -331,7 +322,17 @@ function FileViewPage() { onPlay={handlePlay} onTimeUpdate={setCurrentTime} annotations={annotations} - /> + > + {carouselState.show && ( + + )} +
{