Create polished demo videos without editing skills. Mac/Windows/Linux
fix: address remaining CodeRabbit feedback
webadderall79d9855ef514
diff --git a/src/components/video-editor/ExtensionManager.tsx b/src/components/video-editor/ExtensionManager.tsxindex 033d5c7a..eee87489 100644--- a/src/components/video-editor/ExtensionManager.tsx+++ b/src/components/video-editor/ExtensionManager.tsx@@ -24,7 +24,7 @@ import {Trash2,} from "lucide-react";import { AnimatePresence, LayoutGroup, motion } from "motion/react";-import { useCallback, useEffect, useState } from "react";+import { useCallback, useEffect, useRef, useState } from "react";import { toast } from "sonner";import { Button } from "@/components/ui/button";import { Dialog, DialogContent } from "@/components/ui/dialog";@@ -45,6 +45,19 @@ const TAB_OPTIONS: { value: ExtensionTab; labelKey: string }[] = [const EXTENSIONS_DOCS_URL = "https://marketplace.recordly.dev/extensions";const EXTENSIONS_SUBMIT_URL = "https://marketplace.recordly.dev/extensions/submit";+function toSafeHttpUrl(value?: string): string | null {+ if (!value) return null;++ try {+ const parsed = new URL(value);+ return parsed.protocol === "http:" || parsed.protocol === "https:"+ ? parsed.toString()+ : null;+ } catch {+ return null;+ }+}+// ---------------------------------------------------------------------------// Installed Extension Card// ---------------------------------------------------------------------------@@ -65,6 +78,7 @@ function InstalledExtensionCard({const t = useScopedT("extensions");const isError = extension.status === "error";const isBuiltin = extension.builtin;+ const homepageUrl = toSafeHttpUrl(extension.manifest.homepage);return (<div@@ -96,9 +110,9 @@ function InstalledExtensionCard({{extension.manifest.author && (<p className="text-[10px] text-slate-500 mt-0.5">- {extension.manifest.homepage ? (+ {homepageUrl ? (<a- href={extension.manifest.homepage}+ href={homepageUrl}target="_blank"rel="noopener noreferrer"className="hover:text-slate-300 transition-colors"@@ -175,6 +189,7 @@ function MarketplaceCard({onClick?: () => void;}) {const t = useScopedT("extensions");+ const homepageUrl = toSafeHttpUrl(extension.homepage);return (<divclassName="flex items-start gap-3 p-3 rounded-xl border border-white/[0.06] bg-white/[0.02] hover:bg-white/[0.04] transition-colors cursor-pointer"@@ -200,9 +215,9 @@ function MarketplaceCard({</div><p className="text-[10px] text-slate-500 mt-0.5">- {extension.homepage ? (+ {homepageUrl ? (<a- href={extension.homepage}+ href={homepageUrl}target="_blank"rel="noopener noreferrer"className="hover:text-slate-300 transition-colors"@@ -357,6 +372,7 @@ function ExtensionDetailModal({const author = isInstalled ? detail.ext.manifest.author : detail.ext.author;const permissions = isInstalled ? detail.ext.manifest.permissions : detail.ext.permissions;const homepage = isInstalled ? detail.ext.manifest.homepage : detail.ext.homepage;+ const homepageUrl = toSafeHttpUrl(homepage);const screenshots = detail.source === "marketplace" ? (detail.ext.screenshots ?? []) : [];const isError = isInstalled ? detail.ext.status === "error" : false;@@ -394,9 +410,9 @@ function ExtensionDetailModal({</div><p className="text-[11px] text-slate-500 mt-0.5">{author ? (- homepage ? (+ homepageUrl ? (<a- href={homepage}+ href={homepageUrl}target="_blank"rel="noopener noreferrer"className="hover:text-slate-300 transition-colors inline-flex items-center gap-1"@@ -644,6 +660,7 @@ export default function ExtensionManager() {// Extension detail modal stateconst [detailData, setDetailData] = useState<ExtensionDetailData | null>(null);+ const hasAutoSearchedBrowseRef = useRef(false);const handleInstallFromFolder = useCallback(async () => {const success = await installFromFolder();@@ -670,6 +687,7 @@ export default function ExtensionManager() {// Marketplace searchconst handleSearch = useCallback(async () => {+ hasAutoSearchedBrowseRef.current = true;setMarketplaceLoading(true);setMarketplaceError(null);try {@@ -707,8 +725,17 @@ export default function ExtensionManager() {// Auto-search when switching to browse tabuseEffect(() => {- if (activeTab === "browse" && marketplaceResults.length === 0 && !marketplaceLoading) {- handleSearch();+ if (activeTab !== "browse") {+ hasAutoSearchedBrowseRef.current = false;+ return;+ }++ if (+ !hasAutoSearchedBrowseRef.current &&+ marketplaceResults.length === 0 &&+ !marketplaceLoading+ ) {+ void handleSearch();}}, [activeTab, handleSearch, marketplaceLoading, marketplaceResults.length]);@@ -724,6 +751,11 @@ export default function ExtensionManager() {setMarketplaceResults((prev) =>prev.map((e) => (e.id === ext.id ? { ...e, installed: true } : e)),);+ setDetailData((prev) =>+ prev?.source === "marketplace" && prev.ext.id === ext.id+ ? { ...prev, ext: { ...prev.ext, installed: true } }+ : prev,+ );} else {toast.error(t("toast.marketplaceInstallFailed", undefined, { name: ext.name }),diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsxindex 60aa8e95..c7f63e10 100644--- a/src/components/video-editor/SettingsPanel.tsx+++ b/src/components/video-editor/SettingsPanel.tsx@@ -217,7 +217,10 @@ function ExtensionSettingsSection({className="w-20 h-1 accent-[#2563EB]"/><span className="text-[10px] text-slate-500 w-8 text-right font-mono">- {(typeof value === "number" ? value : 0).toFixed(1)}+ {(typeof value === "number"+ ? value+ : (field.defaultValue as number)+ ).toFixed(1)}</span></div></div>@@ -2227,7 +2230,7 @@ export function SettingsPanel({{backgroundSettingsContent}{frameSectionContent}{cropSectionContent}- {renderExtensionPanelsForSections("scene", "appearance", "zoom", "frame", "crop")}+ {renderExtensionPanelsForSections("scene", "appearance", "frame", "crop")}</div>);@@ -2368,6 +2371,7 @@ export function SettingsPanel({{tSettings("zoom.deleteZoom")}</Button>)}+ {renderExtensionPanelsForSections("zoom", "appearance", "frame", "crop")}</section>);diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsxindex d4071c98..df24199a 100644--- a/src/components/video-editor/VideoEditor.tsx+++ b/src/components/video-editor/VideoEditor.tsx@@ -2678,29 +2678,35 @@ export default function VideoEditor() {}}, []);- const handleClipSplit = useCallback((splitMs: number) => {- setClipRegions((prev) => {- const target = prev.find((c) => splitMs > c.startMs && splitMs < c.endMs);- if (!target) return prev;- const leftId = `clip-${nextClipIdRef.current++}`;- const rightId = `clip-${nextClipIdRef.current++}`;- const left: ClipRegion = {- id: leftId,- startMs: target.startMs,- endMs: Math.round(splitMs),- speed: target.speed,- muted: target.muted,- };- const right: ClipRegion = {- id: rightId,- startMs: Math.round(splitMs),- endMs: target.endMs,- speed: target.speed,- muted: target.muted,- };- return prev.flatMap((c) => (c.id === target.id ? [left, right] : [c]));- });- }, []);+ const handleClipSplit = useCallback(+ (splitMs: number) => {+ setClipRegions((prev) => {+ const target = prev.find((c) => splitMs > c.startMs && splitMs < c.endMs);+ if (!target) return prev;+ const leftId = `clip-${nextClipIdRef.current++}`;+ const rightId = `clip-${nextClipIdRef.current++}`;+ const left: ClipRegion = {+ id: leftId,+ startMs: target.startMs,+ endMs: Math.round(splitMs),+ speed: target.speed,+ muted: target.muted,+ };+ const right: ClipRegion = {+ id: rightId,+ startMs: Math.round(splitMs),+ endMs: target.endMs,+ speed: target.speed,+ muted: target.muted,+ };+ if (selectedClipId === target.id) {+ setSelectedClipId(leftId);+ }+ return prev.flatMap((c) => (c.id === target.id ? [left, right] : [c]));+ });+ },+ [selectedClipId],+ );const handleClipSpanChange = useCallback((id: string, span: Span) => {@@ -5202,10 +5208,6 @@ export default function VideoEditor() {selectedAnnotationId={selectedAnnotationId}onSelectAnnotation={handleSelectAnnotation}aspectRatio={aspectRatio}- isPlaying={isPlaying}- onTogglePlayPause={togglePlayPause}- volume={previewVolume}- onVolumeChange={setPreviewVolume}/></div></div>diff --git a/src/components/video-editor/timeline/TimelineEditor.tsx b/src/components/video-editor/timeline/TimelineEditor.tsxindex 17af7928..8c15b7d2 100644--- a/src/components/video-editor/timeline/TimelineEditor.tsx+++ b/src/components/video-editor/timeline/TimelineEditor.tsx@@ -63,8 +63,10 @@ import { type AudioPeaksData, useAudioPeaks } from "./useAudioPeaks";import { buildInteractionZoomSuggestions } from "./zoomSuggestionUtils";const ZOOM_ROW_ID = "row-zoom";+const TRIM_ROW_ID = "row-trim";const CLIP_ROW_ID = "row-clip";const ANNOTATION_ROW_ID = "row-annotation";+const SPEED_ROW_ID = "row-speed";const AUDIO_ROW_ID = "row-audio";const FALLBACK_RANGE_MS = 1000;const TARGET_MARKER_COUNT = 12;@@ -119,10 +121,6 @@ interface TimelineEditorProps {onOpenCropEditor?: () => void;isCropped?: boolean;videoPath?: string | null;- isPlaying?: boolean;- onTogglePlayPause?: () => void;- volume?: number;- onVolumeChange?: (volume: number) => void;hideToolbar?: boolean;}@@ -593,9 +591,11 @@ function Timeline({);const zoomItems = items.filter((item) => item.rowId === ZOOM_ROW_ID);+ const trimItems = items.filter((item) => item.rowId === TRIM_ROW_ID);const clipItems = items.filter((item) => item.rowId === CLIP_ROW_ID);const annotationItems = items.filter((item) => item.rowId === ANNOTATION_ROW_ID);+ const speedItems = items.filter((item) => item.rowId === SPEED_ROW_ID);const audioItems = items.filter((item) => item.rowId === AUDIO_ROW_ID);return (@@ -633,6 +633,22 @@ function Timeline({))}</Row>+ <Row id={TRIM_ROW_ID} isEmpty={trimItems.length === 0} hint="Press T to add trim">+ {trimItems.map((item) => (+ <Item+ id={item.id}+ key={item.id}+ rowId={item.rowId}+ span={item.span}+ isSelected={selectAllBlocksActive || item.id === _selectedTrimId}+ onSelect={() => onSelectTrim?.(item.id)}+ variant="trim"+ >+ {item.label}+ </Item>+ ))}+ </Row>+<Row id={ZOOM_ROW_ID} isEmpty={zoomItems.length === 0} hint="Press Z to add zoom">{zoomItems.map((item) => (<Item@@ -650,6 +666,27 @@ function Timeline({))}</Row>+ <Row+ id={SPEED_ROW_ID}+ isEmpty={speedItems.length === 0}+ hint="Press S to add speed"+ >+ {speedItems.map((item) => (+ <Item+ id={item.id}+ key={item.id}+ rowId={item.rowId}+ span={item.span}+ isSelected={selectAllBlocksActive || item.id === _selectedSpeedId}+ onSelect={() => onSelectSpeed?.(item.id)}+ speedValue={item.speedValue}+ variant="speed"+ >+ {item.label}+ </Item>+ ))}+ </Row>+<Rowid={ANNOTATION_ROW_ID}isEmpty={annotationItems.length === 0}@@ -1480,7 +1517,6 @@ const TimelineEditor = forwardRef<TimelineEditorHandle, TimelineEditorProps>(// Tab: Cycle through overlapping annotations at current timeif (e.key === "Tab" && annotationRegions.length > 0) {- const currentTimeMs = Math.round(currentTime * 1000);const overlapping = annotationRegions.filter((a) => currentTimeMs >= a.startMs && currentTimeMs <= a.endMs).sort((a, b) => a.zIndex - b.zIndex); // Sort by z-index@@ -1556,7 +1592,7 @@ const TimelineEditor = forwardRef<TimelineEditorHandle, TimelineEditorProps>(selectedSpeedId,selectedAudioId,annotationRegions,- currentTime,+ currentTimeMs,hasAnyTimelineBlocks,onSelectAnnotation,keyShortcuts,@@ -1605,6 +1641,14 @@ const TimelineEditor = forwardRef<TimelineEditorHandle, TimelineEditorProps>(variant: "zoom",}));+ const trims: TimelineRenderItem[] = trimRegions.map((region, index) => ({+ id: region.id,+ rowId: TRIM_ROW_ID,+ span: { start: region.startMs, end: region.endMs },+ label: `Trim ${index + 1}`,+ variant: "trim",+ }));+const clips: TimelineRenderItem[] = clipRegions.map((region, index) => ({id: region.id,rowId: CLIP_ROW_ID,@@ -1635,6 +1679,15 @@ const TimelineEditor = forwardRef<TimelineEditorHandle, TimelineEditorProps>(};});+ const speeds: TimelineRenderItem[] = speedRegions.map((region, index) => ({+ id: region.id,+ rowId: SPEED_ROW_ID,+ span: { start: region.startMs, end: region.endMs },+ label: `Speed ${index + 1}`,+ speedValue: region.speed,+ variant: "speed",+ }));+const audios: TimelineRenderItem[] = audioRegions.map((region) => {const fileName =region.audioPath@@ -1650,8 +1703,8 @@ const TimelineEditor = forwardRef<TimelineEditorHandle, TimelineEditorProps>(};});- return [...zooms, ...clips, ...annotations, ...audios];- }, [zoomRegions, clipRegions, annotationRegions, audioRegions]);+ return [...zooms, ...trims, ...clips, ...annotations, ...speeds, ...audios];+ }, [zoomRegions, trimRegions, clipRegions, annotationRegions, speedRegions, audioRegions]);// Flat list of draggable row spans for neighbour-clamping during drag/resize.const allRegionSpans = useMemo(() => {@@ -1661,42 +1714,62 @@ const TimelineEditor = forwardRef<TimelineEditorHandle, TimelineEditorProps>(end: r.endMs,rowId: ZOOM_ROW_ID,}));+ const trims = trimRegions.map((r) => ({+ id: r.id,+ start: r.startMs,+ end: r.endMs,+ rowId: TRIM_ROW_ID,+ }));const clips = clipRegions.map((r) => ({id: r.id,start: r.startMs,end: r.endMs,rowId: CLIP_ROW_ID,}));+ const speeds = speedRegions.map((r) => ({+ id: r.id,+ start: r.startMs,+ end: r.endMs,+ rowId: SPEED_ROW_ID,+ }));const audios = audioRegions.map((r) => ({id: r.id,start: r.startMs,end: r.endMs,rowId: AUDIO_ROW_ID,}));- return [...zooms, ...clips, ...audios];- }, [zoomRegions, clipRegions, audioRegions]);+ return [...zooms, ...trims, ...clips, ...speeds, ...audios];+ }, [zoomRegions, trimRegions, clipRegions, speedRegions, audioRegions]);const handleItemSpanChange = useCallback((id: string, span: Span) => {// Check if it's a zoom, trim, clip, speed, or annotation itemif (zoomRegions.some((r) => r.id === id)) {onZoomSpanChange(id, span);+ } else if (trimRegions.some((r) => r.id === id)) {+ onTrimSpanChange?.(id, span);} else if (clipRegions.some((r) => r.id === id)) {onClipSpanChange?.(id, span);} else if (annotationRegions.some((r) => r.id === id)) {onAnnotationSpanChange?.(id, span);+ } else if (speedRegions.some((r) => r.id === id)) {+ onSpeedSpanChange?.(id, span);} else if (audioRegions.some((r) => r.id === id)) {onAudioSpanChange?.(id, span);}},[zoomRegions,+ trimRegions,clipRegions,annotationRegions,+ speedRegions,audioRegions,onZoomSpanChange,+ onTrimSpanChange,onClipSpanChange,onAnnotationSpanChange,+ onSpeedSpanChange,onAudioSpanChange,],);