diff --git a/apps/editor/app/viewer/[id]/thumbnail-generator.tsx b/apps/editor/app/viewer/[id]/thumbnail-generator.tsx index df885751..4dec9b9f 100644 --- a/apps/editor/app/viewer/[id]/thumbnail-generator.tsx +++ b/apps/editor/app/viewer/[id]/thumbnail-generator.tsx @@ -5,6 +5,7 @@ import { useThree } from '@react-three/fiber' import { useEffect, useRef } from 'react' import * as THREE from 'three' import { uploadProjectThumbnail } from '@/features/community/lib/projects/actions' +import { useProjectStore } from '@/features/community/lib/projects/store' const THUMBNAIL_WIDTH = 1920 const THUMBNAIL_HEIGHT = 1080 @@ -70,8 +71,7 @@ export const ThumbnailGenerator = ({ projectId: propProjectId }: ThumbnailGenera const result = await uploadProjectThumbnail(projectId, blob) if (result.success) { - console.log('✅ Thumbnail uploaded successfully!') - console.log('🔗 URL:', result.data.thumbnail_url) + useProjectStore.getState().updateActiveThumbnail(result.data.thumbnail_url) } else { console.error('❌ Failed to upload thumbnail:', result.error) } diff --git a/apps/editor/components/ui/sidebar/panels/settings-panel/index.tsx b/apps/editor/components/ui/sidebar/panels/settings-panel/index.tsx index b71e997e..a5d896a2 100644 --- a/apps/editor/components/ui/sidebar/panels/settings-panel/index.tsx +++ b/apps/editor/components/ui/sidebar/panels/settings-panel/index.tsx @@ -71,15 +71,9 @@ export function SettingsPanel() { }; const handleGenerateThumbnail = () => { - if (!projectId) { - console.error('❌ No project ID found'); - return; - } - console.log('🎯 Generate thumbnail clicked for project:', projectId); + if (!projectId) return; setIsGeneratingThumbnail(true); emitter.emit('camera-controls:generate-thumbnail', { projectId }); - console.log('📤 Event emitted with project ID:', projectId); - // Reset loading state after a delay (thumbnail generation is async) setTimeout(() => setIsGeneratingThumbnail(false), 3000); }; @@ -106,6 +100,16 @@ export function SettingsPanel() { + {activeProject?.thumbnail_url && ( +