feat(webui): support responsive layout and transparent bg for left sidebar carousel

This commit is contained in:
yiling
2026-06-15 16:35:34 +08:00
parent eabf49f6e3
commit 673041e28a
3 changed files with 10 additions and 6 deletions
@@ -100,6 +100,7 @@ export const FileViewerLeftSidebar: FC<FileViewerLeftSidebarProps> = ({
if (activeFileInView && activeItemRef.current && !hasScrolledRef.current) {
activeItemRef.current.scrollIntoView({
block: 'center',
inline: 'center',
behavior: 'smooth',
})
hasScrolledRef.current = true
@@ -107,8 +108,8 @@ export const FileViewerLeftSidebar: FC<FileViewerLeftSidebarProps> = ({
}, [files, currentAssetId])
return (
<div className="h-full w-24 bg-gray-100 dark:bg-gray-950 flex flex-col flex-shrink-0 select-none">
<div className="flex-1 overflow-y-auto py-4 flex flex-col items-center gap-3 no-scrollbar">
<div className="h-24 md:h-full w-full md:w-24 bg-gray-100 dark:bg-gray-950 flex flex-row md:flex-col flex-shrink-0 select-none">
<div className="flex-1 overflow-x-auto overflow-y-hidden md:overflow-y-auto md:overflow-x-hidden px-4 md:px-0 py-2 md:py-4 flex flex-row md:flex-col items-center gap-3 no-scrollbar">
{files.map((file) => {
if (!file) return null
const isActive = file.id === currentAssetId
@@ -137,7 +138,10 @@ export const FileViewerLeftSidebar: FC<FileViewerLeftSidebarProps> = ({
{/* Infinite Scroll Trigger */}
{hasMore && (
<div ref={ref} className="py-2 flex justify-center items-center w-full">
<div
ref={ref}
className="px-2 md:px-0 py-2 md:py-4 flex justify-center items-center h-full md:w-full flex-shrink-0"
>
{isFetchingNext && <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />}
</div>
)}
+2 -2
View File
@@ -199,7 +199,7 @@ export function FileViewer({
if (isUnsupported) {
return (
<div className="flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative">
<div className="flex-1 flex min-h-0 relative">
<div className="flex-1 flex flex-col-reverse md:flex-row min-h-0 relative">
{children}
<div className="flex-1 flex items-center justify-center">
<p className="text-muted-foreground">Preview unavailable</p>
@@ -227,7 +227,7 @@ export function FileViewer({
<div className="flex flex-col flex-1 h-full overflow-hidden bg-gray-100 dark:bg-gray-950 relative">
{isImage && (
<>
<div className="flex-1 flex min-h-0 relative">
<div className="flex-1 flex flex-col-reverse md:flex-row min-h-0 relative">
{children}
<div ref={containerRef} className="flex-1 relative overflow-hidden">
<DrawingCanvas
@@ -799,7 +799,7 @@ const VideoPlayer: React.FC<VideoPlayerProps> = ({
onMouseMove={handleMouseMove}
onMouseLeave={handleMouseLeave}
>
<div className="flex-1 flex min-h-0 relative">
<div className="flex-1 flex flex-col-reverse md:flex-row min-h-0 relative">
{/* Render Carousel/Sidebar here if not fullscreen */}
{!state.isFullScreen && children}