Create professional demos and 3D mockups in seconds, directly in your browser
feat: enhance video handling and add custom preview configuration in editor components
CristianOlivera1942468a1ca87
diff --git a/app/[locale]/(editor)/editor/page.tsx b/app/[locale]/(editor)/editor/page.tsxindex 636ef5d..7a2957a 100644--- a/app/[locale]/(editor)/editor/page.tsx+++ b/app/[locale]/(editor)/editor/page.tsx@@ -1581,6 +1581,10 @@ export default function Editor() {videoRef.current.src = url;videoRef.current.currentTime = firstClip.trimStart;}+ if (url) {+ setVideoUrl(url);+ setVideoId(firstClip.libraryVideoId);+ }setCurrentTime(firstClip.startTime);}} else {@@ -1609,6 +1613,23 @@ export default function Editor() {const newDuration = calculateTotalDuration(newClips);setVideoDuration(newDuration);setTrimRange({ start: 0, end: newDuration });++ const activeClip = prev.find(c => c.id === activeClipIdRef.current);+ if (activeClip && activeClip.libraryVideoId === libraryVideoId) {+ const firstClip = [...newClips].sort((a, b) => a.startTime - b.startTime)[0];+ activeClipIdRef.current = firstClip.id;+ activeClipDataRef.current = firstClip;+ const url = videoUrlsRef.current.get(firstClip.libraryVideoId);+ if (url && videoRef.current) {+ videoRef.current.src = url;+ videoRef.current.currentTime = firstClip.trimStart;+ }+ if (url) {+ setVideoUrl(url);+ setVideoId(firstClip.libraryVideoId);+ }+ setCurrentTime(firstClip.startTime);+ }} else {setVideoUrl(null);setVideoId(null);diff --git a/app/components/ui/editor/MockupMenu.tsx b/app/components/ui/editor/MockupMenu.tsxindex cabac95..425c620 100644--- a/app/components/ui/editor/MockupMenu.tsx+++ b/app/components/ui/editor/MockupMenu.tsx@@ -196,7 +196,7 @@ export function MockupMenu({<div className="space-y-2.5"><p className="text-[10px] uppercase tracking-widest text-white/40 font-bold">{t("suggested")}</p><div className="grid grid-cols-3 gap-2">- {["macos", "chrome", "macos-glass", "brave", "chrome-glass", "macos-dark-ide"].map((id) => {+ {["glass-ui-container","macos", "chrome", "macos-glass", "brave", "chrome-glass", "macos-dark-ide", "glass-curve", "macos-ghost"].map((id) => {const mockup = MOCKUPS.find((m) => m.id === id);if (!mockup) return null;const categoryConfig = MOCKUP_CATEGORIES.find((c) => c.id === mockup.category);diff --git a/app/components/ui/editor/PhotoEditorPlaceholder.tsx b/app/components/ui/editor/PhotoEditorPlaceholder.tsxindex 0106fbc..6b8daa5 100644--- a/app/components/ui/editor/PhotoEditorPlaceholder.tsx+++ b/app/components/ui/editor/PhotoEditorPlaceholder.tsx@@ -105,6 +105,21 @@ export function PhotoEditorPlaceholder({const ButtonCard = (<buttononClick={() => {+ if (isCustom && selectedPreviewId !== "custom") {+ // Seed custom config from the currently active preset+ const activePreset = PREVIEW_CONFIGS.find(p => p.id === selectedPreviewId);+ if (activePreset) {+ const seeded: Preview3DConfig = {+ ...activePreset,+ id: "custom",+ label: t("photoPreview.custom.label"),+ };+ setCustomConfig(seeded);+ onSelectPreview?.(seeded);+ setIsCustomPopoverOpen(true);+ return;+ }+ }onSelectPreview?.(config);if (isCustom) setIsCustomPopoverOpen(true);}}