From 90964aab741b3a879b2215a1e25bb5e6b09a63aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=9E=B3?= <7854742+wang_rumeng@user.noreply.gitee.com> Date: Mon, 20 Oct 2025 15:25:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=88=9B=E5=BB=BA=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=9A=E5=9B=BE=E7=89=87=E5=90=8D=E7=A7=B0=E5=B1=95?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PhotoPreview/PhotoPreviewSection.tsx | 128 +++++++++++------- 1 file changed, 81 insertions(+), 47 deletions(-) diff --git a/components/pages/create-video/PhotoPreview/PhotoPreviewSection.tsx b/components/pages/create-video/PhotoPreview/PhotoPreviewSection.tsx index 515f04d..83923d7 100644 --- a/components/pages/create-video/PhotoPreview/PhotoPreviewSection.tsx +++ b/components/pages/create-video/PhotoPreview/PhotoPreviewSection.tsx @@ -1,9 +1,10 @@ "use client"; import { useState } from 'react'; -import { Image } from 'antd'; +import { Image, Tooltip } from 'antd'; import NextImage from 'next/image'; import { EyeOutlined, SwapOutlined, UserOutlined, CameraOutlined, BulbOutlined } from '@ant-design/icons'; +import { useDeviceType } from '@/hooks/useDeviceType'; import type { PhotoPreviewSectionProps, PhotoType } from './types'; import './styles.css'; @@ -24,6 +25,7 @@ export default function PhotoPreviewSection({ const [previewVisible, setPreviewVisible] = useState(false); const [previewImage, setPreviewImage] = useState(''); const [hoveredIndex, setHoveredIndex] = useState(null); + const { isMobileDevice } = useDeviceType(); /** * Get icon for photo type @@ -93,58 +95,90 @@ export default function PhotoPreviewSection({ data-alt="photo-list-container" className="flex gap-2 overflow-x-auto overflow-y-hidden photo-list-scrollbar pb-1" > - {photos.map((photo, index) => ( -
setHoveredIndex(index)} - onMouseLeave={() => setHoveredIndex(null)} - > - {/* Photo Image */} -
- -
- - {/* Hover Overlay with Preview and Replace Icons */} + {photos.map((photo, index) => { + const photoName = photo.name || `${getTypeLabel(photo.type)} ${index + 1}`; + + return (
- {/* Preview Button */} - + {/* Photo Image */} +
+ +
- {/* Replace Button */} - -
+ {/* Hover Overlay with Preview and Replace Icons */} +
+ {/* Preview Button */} + - {/* Type Icon - Bottom Left Corner */} -
- {getTypeIcon(photo.type)} + {/* Replace Button */} + +
+ + {/* Type Icon - Bottom Left Corner */} +
+ {getTypeIcon(photo.type)} +
+
+ + {/* Photo Name - Below Image */} + {isMobileDevice ? ( + // H5: Direct display with line-clamp +
+ {photoName} +
+ ) : ( + // PC: Tooltip on hover + +
+ {photoName} +
+
+ )}
- - ))} + ); + })} {/* Preview Modal - Using absolute positioning to avoid layout space */}