点击视频编辑按钮会跳到第一个分镜,应该修改跳转到当前分镜

This commit is contained in:
北枳 2025-08-26 21:25:40 +08:00
parent eccb0a3e53
commit 6d703aef5e
3 changed files with 12 additions and 17 deletions

View File

@ -268,7 +268,7 @@ export function InputBar({ onSend, setVideoPreview, initialVideoUrl, initialVide
<motion.div layout key="text-input" className="flex-1 flex"> <motion.div layout key="text-input" className="flex-1 flex">
<textarea <textarea
ref={textareaRef} ref={textareaRef}
placeholder="输入文字…" placeholder="Describe your idea..."
className="w-full pl-2 pr-2 py-4 rounded-2 leading-4 text-sm border-none bg-transparent text-white placeholder:text-white/[0.40] focus:outline-none resize-none min-h-[48px] max-h-[120px] overflow-y-auto" className="w-full pl-2 pr-2 py-4 rounded-2 leading-4 text-sm border-none bg-transparent text-white placeholder:text-white/[0.40] focus:outline-none resize-none min-h-[48px] max-h-[120px] overflow-y-auto"
rows={1} rows={1}
value={text} value={text}

View File

@ -175,13 +175,6 @@ export default function SmartChatBox({
<span className="w-2 h-2 bg-gray-400 rounded-full animate-bounce"></span> <span className="w-2 h-2 bg-gray-400 rounded-full animate-bounce"></span>
</div> </div>
)} )}
{/* Error message */}
{error && (
<div className="text-red-500 text-center py-2 text-sm">
{error.message}
</div>
)}
{/* Back to latest button */} {/* Back to latest button */}
{isViewingHistory && !isAtBottom && ( {isViewingHistory && !isAtBottom && (

View File

@ -63,15 +63,16 @@ export const ShotTabContent = forwardRef<
const [updateData, setUpdateData] = useState<VideoSegmentEntity[]>([]); const [updateData, setUpdateData] = useState<VideoSegmentEntity[]>([]);
useEffect(() => { useEffect(() => {
console.log('shotTabContent-----shotData', shotData); console.log('shotTabContent-----selectedSegment', selectedSegment);
}, [shotData]); }, [selectedSegment]);
useEffect(() => { useEffect(() => {
console.log('-==========shotData===========-', shotData); console.log('-==========shotTabContent===========-', shotData, currentSketchIndex, originalVideos);
// 只在初始化且有角色数据时执行 // 只在初始化且有角色数据时执行
if (isInitialized && shotData.length > 0) { if (isInitialized && shotData.length > 0) {
setIsInitialized(false); setIsInitialized(false);
setSelectedSegment(shotData[0]); const defaultSelectIndex = currentSketchIndex >= shotData.length ? 0 : currentSketchIndex;
setSelectedSegment(shotData[defaultSelectIndex]);
} }
}, [shotData, isInitialized]); }, [shotData, isInitialized]);
@ -118,7 +119,6 @@ export const ShotTabContent = forwardRef<
// 清空检测状态 和 检测结果 // 清空检测状态 和 检测结果
setScanState('idle'); setScanState('idle');
setDetections([]); setDetections([]);
setSelectedSegment(shotData[0]);
} }
}, [shotData, selectedSegment]); }, [shotData, selectedSegment]);
@ -314,7 +314,7 @@ export const ShotTabContent = forwardRef<
<HorizontalScroller <HorizontalScroller
itemWidth={128} itemWidth={128}
gap={0} gap={0}
selectedIndex={originalVideos.findIndex(shot => selectedSegment?.videoUrl.some(url => url.video_id === shot.video_id))} selectedIndex={originalVideos.findIndex(shot => selectedSegment?.id === shot.video_id)}
onItemClick={(i: number) => handleSelectShot(i)} onItemClick={(i: number) => handleSelectShot(i)}
> >
{originalVideos.map((shot, index) => ( {originalVideos.map((shot, index) => (
@ -322,7 +322,7 @@ export const ShotTabContent = forwardRef<
key={shot.video_id || index} key={shot.video_id || index}
className={cn( className={cn(
'relative flex-shrink-0 w-32 aspect-video rounded-lg overflow-hidden cursor-pointer group', 'relative flex-shrink-0 w-32 aspect-video rounded-lg overflow-hidden cursor-pointer group',
selectedSegment?.videoUrl.some(url => url.video_id === shot.video_id) ? 'ring-2 ring-blue-500' : 'hover:ring-2 hover:ring-blue-500/50' selectedSegment?.id === shot.video_id ? 'ring-2 ring-blue-500' : 'hover:ring-2 hover:ring-blue-500/50'
)} )}
whileHover={{ scale: 1.02 }} whileHover={{ scale: 1.02 }}
whileTap={{ scale: 0.98 }} whileTap={{ scale: 0.98 }}
@ -361,11 +361,11 @@ export const ShotTabContent = forwardRef<
<HorizontalScroller <HorizontalScroller
itemWidth={'auto'} itemWidth={'auto'}
gap={0} gap={0}
selectedIndex={originalVideos.findIndex(shot => selectedSegment?.videoUrl.some(url => url.video_id === shot.video_id))} selectedIndex={originalVideos.findIndex(shot => selectedSegment?.id === shot.video_id)}
onItemClick={(i: number) => handleSelectShot(i)} onItemClick={(i: number) => handleSelectShot(i)}
> >
{originalVideos.map((shot, index) => { {originalVideos.map((shot, index) => {
const isActive = selectedSegment?.videoUrl.some(url => url.video_id === shot.video_id); const isActive = selectedSegment?.id === shot.video_id;
return ( return (
<motion.div <motion.div
key={shot.video_id || index} key={shot.video_id || index}
@ -611,3 +611,5 @@ export const ShotTabContent = forwardRef<
</div> </div>
); );
}); });
ShotTabContent.displayName = 'ShotTabContent';