diff --git a/apps/web/src/pages/generate/components/material/ManualMaterialList.tsx b/apps/web/src/pages/generate/components/material/ManualMaterialList.tsx index 4823fbdb3..faafc7518 100644 --- a/apps/web/src/pages/generate/components/material/ManualMaterialList.tsx +++ b/apps/web/src/pages/generate/components/material/ManualMaterialList.tsx @@ -23,42 +23,32 @@ const ManualMaterialList: React.FC = ({ // 追踪当前正在播放的视频元素,确保同时只有一个视频播放 const activeVideoRef = useRef(null) - const handleVideoMouseEnter = useCallback( - (e: React.MouseEvent) => { - const video = e.currentTarget - // 暂停之前正在播放的视频 - if (activeVideoRef.current && activeVideoRef.current !== video) { - activeVideoRef.current.pause() - activeVideoRef.current.currentTime = 0 - } - activeVideoRef.current = video - video.play().catch(() => {}) - }, - [], - ) + const handleVideoMouseEnter = useCallback((e: React.MouseEvent) => { + const video = e.currentTarget + // 暂停之前正在播放的视频 + if (activeVideoRef.current && activeVideoRef.current !== video) { + activeVideoRef.current.pause() + activeVideoRef.current.currentTime = 0 + } + activeVideoRef.current = video + video.play().catch(() => {}) + }, []) - const handleVideoMouseLeave = useCallback( - (e: React.MouseEvent) => { - const video = e.currentTarget - video.pause() - video.currentTime = 0 - if (activeVideoRef.current === video) { - activeVideoRef.current = null - } - }, - [], - ) + const handleVideoMouseLeave = useCallback((e: React.MouseEvent) => { + const video = e.currentTarget + video.pause() + video.currentTime = 0 + if (activeVideoRef.current === video) { + activeVideoRef.current = null + } + }, []) return (
{materialsLoading ? ( - - 加载素材中… - + 加载素材中… ) : materials.items.length === 0 ? ( - + 暂无素材,请先在视频库中上传 ) : ( @@ -75,9 +65,7 @@ const ManualMaterialList: React.FC = ({ alignItems: "center", gap: 10, padding: "8px 12px", - background: checked - ? "var(--primary-soft, #eef2ff)" - : "#f8fafc", + background: checked ? "var(--primary-soft, #eef2ff)" : "#f8fafc", borderRadius: 10, cursor: "pointer", border: checked @@ -138,8 +126,7 @@ const ManualMaterialList: React.FC = ({ onError={(e) => { const target = e.target as HTMLImageElement target.style.display = "none" - const fallback = - target.nextElementSibling as HTMLElement | null + const fallback = target.nextElementSibling as HTMLElement | null if (fallback) fallback.style.display = "flex" }} />