Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

Refine video editor layout and export flow

webadderall636f4fa3939c
diff --git a/src/components/ui/slider.tsx b/src/components/ui/slider.tsx
index 1c7321c1..587f73f6 100644
--- a/src/components/ui/slider.tsx
+++ b/src/components/ui/slider.tsx
@@ -15,10 +15,10 @@ const Slider = React.forwardRef<
)}
{...props}
>
- <SliderPrimitive.Track className="relative h-1.5 w-full grow overflow-hidden rounded-full bg-white/10">
+ <SliderPrimitive.Track className="relative h-2.5 w-full grow overflow-hidden rounded-full bg-white/10">
<SliderPrimitive.Range className="absolute h-full bg-[#2563EB]" />
</SliderPrimitive.Track>
- <SliderPrimitive.Thumb className="block h-4 w-4 rounded-full border-2 border-[#2563EB] bg-[#2563EB] shadow transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#2563EB]/50 disabled:pointer-events-none disabled:opacity-50" />
+ <SliderPrimitive.Thumb className="block h-5 w-5 rounded-full border-2 border-[#2563EB] bg-[#2563EB] shadow transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#2563EB]/50 disabled:pointer-events-none disabled:opacity-50" />
</SliderPrimitive.Root>
))
Slider.displayName = SliderPrimitive.Root.displayName
diff --git a/src/components/video-editor/ExportDialog.tsx b/src/components/video-editor/ExportDialog.tsx
index 94a39b81..2b39c2f8 100644
--- a/src/components/video-editor/ExportDialog.tsx
+++ b/src/components/video-editor/ExportDialog.tsx
@@ -4,6 +4,8 @@ import { Button } from '@/components/ui/button';
import type { ExportProgress } from '@/lib/exporter';
import { toast } from 'sonner'; // Add this import
import { useScopedT } from "../../contexts/I18nContext";
+import { ExportSettingsMenu } from './ExportSettingsMenu';
+import type { ExportFormat, ExportQuality, GifFrameRate, GifSizePreset } from '@/lib/exporter';
interface ExportDialogProps {
@@ -17,6 +19,19 @@ interface ExportDialogProps {
canRetrySave?: boolean;
exportFormat?: 'mp4' | 'gif';
exportedFilePath?: string;
+ exportQuality?: ExportQuality;
+ onExportQualityChange?: (quality: ExportQuality) => void;
+ onExportFormatChange?: (format: ExportFormat) => void;
+ gifFrameRate?: GifFrameRate;
+ onGifFrameRateChange?: (rate: GifFrameRate) => void;
+ gifLoop?: boolean;
+ onGifLoopChange?: (loop: boolean) => void;
+ gifSizePreset?: GifSizePreset;
+ onGifSizePresetChange?: (preset: GifSizePreset) => void;
+ gifOutputDimensions?: { width: number; height: number };
+ onLoadProject?: () => void;
+ onSaveProject?: () => void;
+ onStartExport?: () => void;
}
export function ExportDialog({
@@ -30,6 +45,19 @@ export function ExportDialog({
canRetrySave = false,
exportFormat = 'mp4',
exportedFilePath, // Add this line
+ exportQuality = 'good',
+ onExportQualityChange,
+ onExportFormatChange,
+ gifFrameRate = '10',
+ onGifFrameRateChange,
+ gifLoop = true,
+ onGifLoopChange,
+ gifSizePreset = 'medium',
+ onGifSizePresetChange,
+ gifOutputDimensions = { width: 1280, height: 720 },
+ onLoadProject,
+ onSaveProject,
+ onStartExport,
}: ExportDialogProps) {
const t = useScopedT('dialogs');
const [showSuccess, setShowSuccess] = useState(false);
@@ -48,6 +76,12 @@ export function ExportDialog({
}
}, [isOpen, isExporting, progress]);
+ useEffect(() => {
+ if (!isOpen) {
+ setShowSuccess(false);
+ }
+ }, [isOpen]);
+
useEffect(() => {
if (!isExporting && progress && progress.percentage >= 100 && !error) {
setShowSuccess(true);
@@ -61,6 +95,8 @@ export function ExportDialog({
if (!isOpen) return null;
+ const showSettings = !isExporting && !progress && !error && !showSuccess;
+
const formatLabel = exportFormat === 'gif' ? 'GIF' : 'Video';
// Determine if we're in the compiling phase (frames done but still exporting)
@@ -110,7 +146,43 @@ export function ExportDialog({
className="fixed inset-0 bg-black/80 backdrop-blur-md z-50 animate-in fade-in duration-200"
onClick={isExporting ? undefined : onClose}
/>
- <div className="fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-[60] bg-[#09090b] rounded-2xl shadow-2xl border border-white/10 p-8 w-[90vw] max-w-md animate-in zoom-in-95 duration-200">
+ <div className="fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 z-[60] bg-[#09090b] rounded-2xl border border-white/10 p-8 w-[90vw] max-w-md animate-in zoom-in-95 duration-200">
+ {showSettings ? (
+ <div className="space-y-5">
+ <div className="flex items-start justify-between gap-4">
+ <div>
+ <span className="text-xl font-bold text-slate-200 block">{t('export.exportingFormat', undefined, { format: formatLabel })}</span>
+ <span className="text-sm text-slate-400">Choose format and quality before exporting.</span>
+ </div>
+ <Button
+ variant="ghost"
+ size="icon"
+ onClick={onClose}
+ className="hover:bg-white/10 text-slate-400 hover:text-white rounded-full"
+ >
+ <X className="w-5 h-5" />
+ </Button>
+ </div>
+ <ExportSettingsMenu
+ exportFormat={exportFormat}
+ onExportFormatChange={onExportFormatChange}
+ exportQuality={exportQuality}
+ onExportQualityChange={onExportQualityChange}
+ gifFrameRate={gifFrameRate}
+ onGifFrameRateChange={onGifFrameRateChange}
+ gifLoop={gifLoop}
+ onGifLoopChange={onGifLoopChange}
+ gifSizePreset={gifSizePreset}
+ onGifSizePresetChange={onGifSizePresetChange}
+ gifOutputDimensions={gifOutputDimensions}
+ onLoadProject={onLoadProject}
+ onSaveProject={onSaveProject}
+ onExport={onStartExport}
+ className="border-white/8 bg-[#121216] p-0 shadow-none"
+ />
+ </div>
+ ) : (
+ <div>
<div className="flex items-center justify-between mb-6">
<div className="flex items-center gap-4">
{showSuccess ? (
@@ -226,13 +298,13 @@ export function ExportDialog({
// Show render progress if available, otherwise animated indeterminate bar
renderProgress !== undefined && renderProgress > 0 ? (
<div
- className="h-full bg-[#2563EB] shadow-[0_0_10px_rgba(37,99,235,0.3)] transition-all duration-300 ease-out"
+ className="h-full bg-[#2563EB] transition-all duration-300 ease-out"
style={{ width: `${renderProgress}%` }}
/>
) : (
<div className="h-full w-full relative overflow-hidden">
<div
- className="absolute h-full w-1/3 bg-[#2563EB] shadow-[0_0_10px_rgba(37,99,235,0.3)]"
+ className="absolute h-full w-1/3 bg-[#2563EB]"
style={{
animation: 'indeterminate 1.5s ease-in-out infinite',
}}
@@ -247,7 +319,7 @@ export function ExportDialog({
)
) : (
<div
- className="h-full bg-[#2563EB] shadow-[0_0_10px_rgba(37,99,235,0.3)] transition-all duration-300 ease-out"
+ className="h-full bg-[#2563EB] transition-all duration-300 ease-out"
style={{ width: `${Math.min(progress.percentage, 100)}%` }}
/>
)}
@@ -292,6 +364,8 @@ export function ExportDialog({
</p>
</div>
)}
+ </div>
+ )}
</div>
</>
);
diff --git a/src/components/video-editor/ExportSettingsMenu.tsx b/src/components/video-editor/ExportSettingsMenu.tsx
new file mode 100644
index 00000000..93cdfc56
--- /dev/null
+++ b/src/components/video-editor/ExportSettingsMenu.tsx
@@ -0,0 +1,208 @@
+import { Download, Film, FolderOpen, Image, Save } from "lucide-react";
+import { LayoutGroup, motion } from "motion/react";
+import { Button } from "@/components/ui/button";
+import { Switch } from "@/components/ui/switch";
+import { useScopedT } from "@/contexts/I18nContext";
+import type {
+ ExportFormat,
+ ExportQuality,
+ GifFrameRate,
+ GifSizePreset,
+} from "@/lib/exporter";
+import { GIF_FRAME_RATES, GIF_SIZE_PRESETS } from "@/lib/exporter";
+import { cn } from "@/lib/utils";
+
+interface ExportSettingsMenuProps {
+ exportFormat: ExportFormat;
+ onExportFormatChange?: (format: ExportFormat) => void;
+ exportQuality: ExportQuality;
+ onExportQualityChange?: (quality: ExportQuality) => void;
+ gifFrameRate: GifFrameRate;
+ onGifFrameRateChange?: (rate: GifFrameRate) => void;
+ gifLoop: boolean;
+ onGifLoopChange?: (loop: boolean) => void;
+ gifSizePreset: GifSizePreset;
+ onGifSizePresetChange?: (preset: GifSizePreset) => void;
+ gifOutputDimensions: { width: number; height: number };
+ onLoadProject?: () => void;
+ onSaveProject?: () => void;
+ onExport?: () => void;
+ className?: string;
+}
+
+export function ExportSettingsMenu({
+ exportFormat,
+ onExportFormatChange,
+ exportQuality,
+ onExportQualityChange,
+ gifFrameRate,
+ onGifFrameRateChange,
+ gifLoop,
+ onGifLoopChange,
+ gifSizePreset,
+ onGifSizePresetChange,
+ gifOutputDimensions,
+ onLoadProject,
+ onSaveProject,
+ onExport,
+ className,
+}: ExportSettingsMenuProps) {
+ const tSettings = useScopedT("settings");
+
+ return (
+ <div className={cn("w-full rounded-2xl border border-white/10 bg-[#17171a] p-3 text-slate-200", className)}>
+ <div className="mb-2 flex items-center justify-between">
+ <span className="text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-400">
+ Export
+ </span>
+ </div>
+
+ <div className="mb-3 flex items-center gap-2">
+ <LayoutGroup id="header-export-format-toggle">
+ {([
+ { value: "mp4", label: tSettings("export.mp4"), icon: Film },
+ { value: "gif", label: tSettings("export.gif"), icon: Image },
+ ] as const).map((option) => {
+ const Icon = option.icon;
+ const isActive = exportFormat === option.value;
+ return (
+ <button
+ key={option.value}
+ type="button"
+ onClick={() => onExportFormatChange?.(option.value)}
+ className={cn(
+ "relative flex-1 overflow-hidden rounded-xl border py-2 text-xs font-medium transition-colors",
+ isActive
+ ? "border-[#2563EB]/50 text-white"
+ : "border-white/10 bg-white/5 text-slate-400 hover:bg-white/10 hover:text-slate-200",
+ )}
+ >
+ {isActive ? (
+ <motion.span
+ layoutId="header-export-format-pill"
+ className="absolute inset-0 rounded-xl bg-[#2563EB]/10"
+ transition={{ type: "spring", stiffness: 380, damping: 32 }}
+ />
+ ) : null}
+ <span className="relative z-10 flex items-center justify-center gap-1.5">
+ <Icon className="h-3.5 w-3.5" />
+ {option.label}
+ </span>
+ </button>
+ );
+ })}
+ </LayoutGroup>
+ </div>
+
+ {exportFormat === "mp4" ? (
+ <LayoutGroup id="header-export-quality-toggle">
+ <div className="mb-3 grid h-8 w-full grid-cols-4 rounded-xl border border-white/5 bg-white/5 p-0.5">
+ {([
+ { value: "medium", label: tSettings("export.quality.low") },
+ { value: "good", label: tSettings("export.quality.medium") },
+ { value: "high", label: tSettings("export.quality.high") },
+ { value: "source", label: tSettings("export.quality.original") },
+ ] as const).map((option) => {
+ const isActive = exportQuality === option.value;
+ return (
+ <button
+ key={option.value}
+ type="button"
+ onClick={() => onExportQualityChange?.(option.value)}
+ className="relative rounded-lg text-[11px] font-medium transition-colors"
+ >
+ {isActive ? (
+ <motion.span
+ layoutId="header-export-quality-pill"
+ className="absolute inset-0 rounded-lg bg-white"
+ transition={{ type: "spring", stiffness: 420, damping: 34 }}
+ />
+ ) : null}
+ <span className={cn("relative z-10", isActive ? "text-black" : "text-slate-400 hover:text-slate-200")}>
+ {option.label}
+ </span>
+ </button>
+ );
+ })}
+ </div>
+ </LayoutGroup>
+ ) : (
+ <div className="mb-3 space-y-2">
+ <div className="flex items-center gap-2">
+ <LayoutGroup id="header-gif-frame-rate-toggle">
+ <div className="grid h-8 flex-1 grid-cols-4 rounded-xl border border-white/5 bg-white/5 p-0.5">
+ {GIF_FRAME_RATES.map((rate) => {
+ const isActive = gifFrameRate === rate.value;
+ return (
+ <button
+ key={rate.value}
+ type="button"
+ onClick={() => onGifFrameRateChange?.(rate.value)}
+ className="relative rounded-lg text-[11px] font-medium transition-colors"
+ >
+ {isActive ? (
+ <motion.span layoutId="header-gif-frame-rate-pill" className="absolute inset-0 rounded-lg bg-white" transition={{ type: "spring", stiffness: 420, damping: 34 }} />
+ ) : null}
+ <span className={cn("relative z-10", isActive ? "text-black" : "text-slate-400 hover:text-slate-200")}>
+ {rate.value}
+ </span>
+ </button>
+ );
+ })}
+ </div>
+ </LayoutGroup>
+ <LayoutGroup id="header-gif-size-toggle">
+ <div className="grid h-8 flex-1 grid-cols-3 rounded-xl border border-white/5 bg-white/5 p-0.5">
+ {Object.entries(GIF_SIZE_PRESETS).map(([key]) => {
+ const isActive = gifSizePreset === key;
+ return (
+ <button
+ key={key}
+ type="button"
+ onClick={() => onGifSizePresetChange?.(key as GifSizePreset)}
+ className="relative rounded-lg text-[11px] font-medium transition-colors"
+ >
+ {isActive ? (
+ <motion.span layoutId="header-gif-size-pill" className="absolute inset-0 rounded-lg bg-white" transition={{ type: "spring", stiffness: 420, damping: 34 }} />
+ ) : null}
+ <span className={cn("relative z-10", isActive ? "text-black" : "text-slate-400 hover:text-slate-200")}>
+ {key === "original" ? "Orig" : key.charAt(0).toUpperCase() + key.slice(1, 3)}
+ </span>
+ </button>
+ );
+ })}
+ </div>
+ </LayoutGroup>
+ </div>
+ <div className="flex items-center justify-between px-1">
+ <span className="text-[10px] text-slate-500">
+ {gifOutputDimensions.width} × {gifOutputDimensions.height}px
+ </span>
+ <div className="flex items-center gap-2">
+ <span className="text-[10px] text-slate-400">{tSettings("export.loop")}</span>
+ <Switch checked={gifLoop} onCheckedChange={onGifLoopChange} className="scale-75 data-[state=checked]:bg-[#2563EB]" />
+ </div>
+ </div>
+ </div>
+ )}
+
+ <div className="mb-2 grid grid-cols-2 gap-2">
+ <Button type="button" variant="outline" onClick={onLoadProject} className="h-8 gap-1.5 border-white/10 bg-white/5 text-[10px] font-medium text-slate-300 hover:bg-white/10">
+ <FolderOpen className="h-3.5 w-3.5" />
+ {tSettings("export.loadProject")}
+ </Button>
+ <Button type="button" variant="outline" onClick={onSaveProject} className="h-8 gap-1.5 border-white/10 bg-white/5 text-[10px] font-medium text-slate-300 hover:bg-white/10">
+ <Save className="h-3.5 w-3.5" />
+ {tSettings("export.saveProject")}
+ </Button>
+ </div>
+
+ <Button type="button" size="lg" onClick={onExport} className="h-11 w-full gap-2 rounded-lg bg-[#2563EB] text-sm font-semibold text-white transition-colors duration-200 hover:bg-[#2563EB]/90">
+ <Download className="h-4 w-4" />
+ {tSettings("export.exportVideo", undefined, {
+ format: exportFormat === "gif" ? "GIF" : "Video",
+ })}
+ </Button>
+ </div>
+ );
+}
\ No newline at end of file
diff --git a/src/components/video-editor/PlaybackControls.tsx b/src/components/video-editor/PlaybackControls.tsx
index d6afac39..820e13f0 100644
--- a/src/components/video-editor/PlaybackControls.tsx
+++ b/src/components/video-editor/PlaybackControls.tsx
@@ -1,4 +1,4 @@
-import { Pause, Play } from "lucide-react";
+import { Pause, Play, Volume2, VolumeX } from "lucide-react";
import { useScopedT } from "@/contexts/I18nContext";
import { cn } from "@/lib/utils";
import { Button } from "../ui/button";
@@ -9,6 +9,8 @@ interface PlaybackControlsProps {
duration: number;
onTogglePlayPause: () => void;
onSeek: (time: number) => void;
+ volume: number;
+ onVolumeChange: (volume: number) => void;
}
export default function PlaybackControls({
@@ -17,6 +19,8 @@ export default function PlaybackControls({
duration,
onTogglePlayPause,
onSeek,
+ volume,
+ onVolumeChange,
}: PlaybackControlsProps) {
const t = useScopedT("editor");
function formatTime(seconds: number) {
@@ -30,10 +34,14 @@ export default function PlaybackControls({
onSeek(parseFloat(e.target.value));
}
+ function handleVolumeChange(e: React.ChangeEvent<HTMLInputElement>) {
+ onVolumeChange(Number(e.target.value));
+ }
+
const progress = duration > 0 ? (currentTime / duration) * 100 : 0;
return (
- <div className="flex items-center gap-2 px-1 py-0.5 rounded-full bg-black/60 backdrop-blur-md border border-white/10 shadow-xl transition-all duration-300 hover:bg-black/70 hover:border-white/20">
+ <div className="flex items-center gap-2 px-1.5 pr-3 py-0.5 rounded-full bg-black/75 backdrop-blur-md border border-white/10 transition-colors duration-300 hover:bg-black/80 hover:border-white/20">
<Button
onClick={onTogglePlayPause}
size="icon"
@@ -41,7 +49,7 @@ export default function PlaybackControls({
"w-8 h-8 rounded-full transition-all duration-200 border border-white/10",
isPlaying
? "bg-white/10 text-white hover:bg-white/20"
- : "bg-white text-black hover:bg-white/90 hover:scale-105 shadow-[0_0_15px_rgba(255,255,255,0.3)]",
+ : "bg-white text-black hover:bg-white/90",
)}
aria-label={isPlaying ? t("playback.pause") : t("playback.play")}
>
@@ -75,7 +83,7 @@ export default function PlaybackControls({
{/* Custom Thumb (visual only, follows progress) */}
<div
- className="absolute w-2.5 h-2.5 bg-white rounded-full shadow-lg pointer-events-none group-hover:scale-125 transition-transform duration-100"
+ className="absolute w-2.5 h-2.5 bg-white rounded-full pointer-events-none group-hover:scale-125 transition-transform duration-100"
style={{
left: `${progress}%`,
transform: "translateX(-50%)",
@@ -86,6 +94,32 @@ export default function PlaybackControls({
<span className="text-[9px] font-medium text-slate-500 tabular-nums w-[30px]">
{formatTime(duration)}
</span>
+
+ <div className="flex items-center gap-1.5 pl-1">
+ {volume <= 0.001 ? (
+ <VolumeX className="h-3.5 w-3.5 text-slate-400" />
+ ) : (
+ <Volume2 className="h-3.5 w-3.5 text-slate-400" />
+ )}
+ <div className="group relative flex h-6 w-20 items-center">
+ <div className="absolute left-0 right-0 h-0.5 rounded-full bg-white/10 overflow-hidden">
+ <div className="h-full rounded-full bg-white/70" style={{ width: `${volume * 100}%` }} />
+ </div>
+ <input
+ type="range"
+ min="0"
+ max="1"
+ step="0.01"
+ value={volume}
+ onChange={handleVolumeChange}
+ className="absolute inset-0 h-full w-full cursor-pointer opacity-0"
+ />
+ <div
+ className="pointer-events-none absolute h-2.5 w-2.5 rounded-full bg-white transition-transform duration-100 group-hover:scale-125"
+ style={{ left: `${volume * 100}%`, transform: "translateX(-50%)" }}
+ />
+ </div>
+ </div>
</div>
);
}
diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsx
index 7926e0a0..c07d90de 100644
--- a/src/components/video-editor/SettingsPanel.tsx
+++ b/src/components/video-editor/SettingsPanel.tsx
@@ -1,33 +1,17 @@
-import Block from "@uiw/react-color-block";
+import { LayoutGroup } from "motion/react";
import {
- Bug,
Crop,
- Download,
- Film,
- FolderOpen,
- Image,
Palette,
- Save,
- Sparkles,
- Star,
Trash2,
Upload,
X,
} from "lucide-react";
+import { AnimatePresence, motion } from "motion/react";
import { useEffect, useMemo, useRef, useState } from "react";
import { toast } from "sonner";
-import {
- Accordion,
- AccordionContent,
- AccordionItem,
- AccordionTrigger,
-} from "@/components/ui/accordion";
import { Button } from "@/components/ui/button";
import { Switch } from "@/components/ui/switch";
-import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { getAssetPath, getRenderableAssetUrl } from "@/lib/assetPath";
-import type { ExportFormat, ExportQuality, GifFrameRate, GifSizePreset } from "@/lib/exporter";
-import { GIF_FRAME_RATES, GIF_SIZE_PRESETS } from "@/lib/exporter";
import { cn } from "@/lib/utils";
import { BUILT_IN_WALLPAPERS, WALLPAPER_PATHS, WALLPAPER_RELATIVE_PATHS } from "@/lib/wallpapers";
import { type AspectRatio } from "@/utils/aspectRatioUtils";
@@ -89,6 +73,7 @@ const GRADIENTS = [
];
type BackgroundTab = "image" | "color" | "gradient";
+export type EditorEffectSection = "scene" | "cursor" | "webcam" | "zoom" | "frame" | "crop";
function isHexWallpaper(value: string): boolean {
return /^#(?:[0-9a-f]{3}){1,2}$/i.test(value);
@@ -106,7 +91,17 @@ function getBackgroundTabForWallpaper(value: string): BackgroundTab {
return "image";
}
+function SectionLabel({ children }: { children: React.ReactNode }) {
+ return (
+ <p className="text-[10px] font-semibold uppercase tracking-widest text-slate-400">
+ {children}
+ </p>
+ );
+}
+
interface SettingsPanelProps {
+ panelMode?: "editor" | "background";
+ activeEffectSection?: EditorEffectSection;
selected: string;
onWallpaperChange: (path: string) => void;
selectedZoomDepth?: ZoomDepth | null;
@@ -150,21 +145,6 @@ interface SettingsPanelProps {
aspectRatio: AspectRatio;
onAspectRatioChange?: (ratio: AspectRatio) => void;
videoElement?: HTMLVideoElement | null;
- exportQuality?: ExportQuality;
- onExportQualityChange?: (quality: ExportQuality) => void;
- // Export format settings
- exportFormat?: ExportFormat;
- onExportFormatChange?: (format: ExportFormat) => void;
- gifFrameRate?: GifFrameRate;
- onGifFrameRateChange?: (rate: GifFrameRate) => void;
- gifLoop?: boolean;
- onGifLoopChange?: (loop: boolean) => void;
- gifSizePreset?: GifSizePreset;
- onGifSizePresetChange?: (preset: GifSizePreset) => void;
- gifOutputDimensions?: { width: number; height: number };
- onSaveProject?: () => void;
- onLoadProject?: () => void;
- onExport?: () => void;
selectedAnnotationId?: string | null;
annotationRegions?: AnnotationRegion[];
onAnnotationContentChange?: (id: string, content: string) => void;
@@ -190,6 +170,8 @@ const ZOOM_DEPTH_OPTIONS: Array<{ depth: ZoomDepth; label: string }> = [
];
export function SettingsPanel({
+ panelMode = "editor",
+ activeEffectSection: activeEffectSectionProp,
selected,
onWallpaperChange,
selectedZoomDepth,
@@ -233,20 +215,6 @@ export function SettingsPanel({
aspectRatio,
onAspectRatioChange,
videoElement,
- exportQuality = "good",
- onExportQualityChange,
- exportFormat = "mp4",
- onExportFormatChange,
- gifFrameRate = 15,
- onGifFrameRateChange,
- gifLoop = true,
- onGifLoopChange,
- gifSizePreset = "medium",
- onGifSizePresetChange,
- gifOutputDimensions = { width: 1280, height: 720 },
- onSaveProject,
- onLoadProject,
- onExport,
selectedAnnotationId,
annotationRegions = [],
onAnnotationContentChange,
@@ -261,6 +229,7 @@ export function SettingsPanel({
}: SettingsPanelProps) {
const tSettings = useScopedT("settings");
const { t } = useI18n();
+ const isBackgroundPanel = panelMode === "background";
const initialEditorPreferences = useMemo(() => loadEditorPreferences(), []);
const [wallpaperPreviewPaths, setWallpaperPreviewPaths] = useState<string[]>([]);
const [customImages, setCustomImages] = useState<string[]>(
@@ -321,6 +290,10 @@ export function SettingsPanel({
);
const [showCropModal, setShowCropModal] = useState(false);
const cropSnapshotRef = useRef<CropRegion | null>(null);
+ const customColorInputRef = useRef<HTMLInputElement | null>(null);
+ const defaultWebcam = initialEditorPreferences.webcam;
+ const [internalActiveEffectSection] = useState<EditorEffectSection>("scene");
+ const activeEffectSection = activeEffectSectionProp ?? internalActiveEffectSection;
useEffect(() => {
setBackgroundTab(getBackgroundTabForWallpaper(selected));
@@ -361,6 +334,30 @@ export function SettingsPanel({
};
const webcamFileName = webcam?.sourcePath?.split(/[\\/]/).pop() ?? null;
+ const visibleColorPalette = colorPalette.slice(0, 15);
+
+ const getWallpaperTileState = (candidateValue: string, previewPath?: string) => {
+ if (!selected) return false;
+ if (selected === candidateValue || (previewPath && selected === previewPath)) return true;
+ try {
+ const clean = (s: string) => s.replace(/^file:\/\//, "").replace(/^\//, "");
+ if (clean(selected).endsWith(clean(candidateValue))) return true;
+ if (clean(candidateValue).endsWith(clean(selected))) return true;
+ if (previewPath && clean(selected).endsWith(clean(previewPath))) return true;
+ if (previewPath && clean(previewPath).endsWith(clean(selected))) return true;
+ } catch {
+ return false;
+ }
+ return false;
+ };
+
+ const wallpaperTileClass = (isSelected: boolean) =>
+ cn(
+ "group relative aspect-square w-full overflow-hidden rounded-[10px] border transition-colors duration-150",
+ isSelected
+ ? "border-[#2563EB] bg-white/8"
+ : "border-white/10 bg-white/[0.045] hover:border-white/20 hover:bg-white/[0.07]",
+ );
const zoomEnabled = Boolean(selectedZoomDepth);
const trimEnabled = Boolean(selectedTrimId);
@@ -391,6 +388,83 @@ export function SettingsPanel({
setShowCropModal(false);
};
+ const crop = cropRegion ?? {
+ x: 0,
+ y: 0,
+ width: 1,
+ height: 1,
+ };
+ const cropTop = Math.round(crop.y * 100);
+ const cropLeft = Math.round(crop.x * 100);
+ const cropBottom = Math.round((1 - crop.y - crop.height) * 100);
+ const cropRight = Math.round((1 - crop.x - crop.width) * 100);
+ const isCropped = cropTop > 0 || cropLeft > 0 || cropBottom > 0 || cropRight > 0;
+
+ const setCropInset = (side: "top" | "bottom" | "left" | "right", pct: number) => {
+ if (!onCropChange) return;
+
+ const v = pct / 100;
+ let { x, y, width, height } = crop;
+
+ if (side === "top") {
+ const nextY = Math.min(v, 1 - y - height + v);
+ y = nextY;
+ height = Math.max(0.05, height - (nextY - crop.y));
+ }
+
+ if (side === "left") {
+ const nextX = Math.min(v, 1 - x - width + v);
+ x = nextX;
+ width = Math.max(0.05, width - (nextX - crop.x));
+ }
+
+ if (side === "bottom") {
+ height = Math.max(0.05, 1 - crop.y - v);
+ }
+
+ if (side === "right") {
+ width = Math.max(0.05, 1 - crop.x - v);
+ }
+
+ onCropChange({ x, y, width, height });
+ };
+
+ const resetBackgroundSection = () => {
+ onBackgroundBlurChange?.(initialEditorPreferences.backgroundBlur);
+ };
+
+ const resetZoomSection = () => {
+ onZoomMotionBlurChange?.(initialEditorPreferences.zoomMotionBlur);
+ onConnectZoomsChange?.(initialEditorPreferences.connectZooms);
+ };
+
+ const resetCursorSection = () => {
+ onShowCursorChange?.(initialEditorPreferences.showCursor);
+ onLoopCursorChange?.(initialEditorPreferences.loopCursor);
+ onCursorSizeChange?.(initialEditorPreferences.cursorSize);
+ onCursorSmoothingChange?.(initialEditorPreferences.cursorSmoothing);
+ onCursorMotionBlurChange?.(initialEditorPreferences.cursorMotionBlur);
+ onCursorClickBounceChange?.(initialEditorPreferences.cursorClickBounce);
+ onCursorSwayChange?.(initialEditorPreferences.cursorSway);
+ };
+
+ const resetFrameSection = () => {
+ onShadowChange?.(initialEditorPreferences.shadowIntensity);
+ onBorderRadiusChange?.(initialEditorPreferences.borderRadius);
+ onPaddingChange?.(initialEditorPreferences.padding);
+ onAspectRatioChange?.(initialEditorPreferences.aspectRatio);
+ removeBackgroundStateRef.current = null;
+ };
+
+ const resetWebcamSection = () => {
+ if (!onWebcamChange) return;
+ onWebcamChange({ ...defaultWebcam });
+ };
+
+ const resetCropSection = () => {
+ onCropChange?.(initialEditorPreferences.cropRegion);
+ };
+
const updateWebcam = (patch: Partial<WebcamOverlaySettings>) => {
if (!webcam || !onWebcamChange) return;
onWebcamChange({ ...webcam, ...patch });
@@ -448,8 +522,210 @@ export function SettingsPanel({
? annotationRegions.find((a) => a.id === selectedAnnotationId)
: null;
+ const backgroundSettingsContent = (
+ <div className="space-y-4">
+ <section className="flex flex-col gap-2">
+ <div className="flex items-center justify-between gap-3">
+ <SectionLabel>{tSettings("background.title")}</SectionLabel>
+ <button
+ type="button"
+ onClick={resetBackgroundSection}
+ className="text-[10px] text-[#2563EB] transition-opacity hover:opacity-80"
+ >
+ Reset
+ </button>
+ </div>
+ <SliderControl
+ label="Blur"
+ value={backgroundBlur}
+ defaultValue={initialEditorPreferences.backgroundBlur}
+ min={0}
+ max={8}
+ step={0.25}
+ onChange={(v) => onBackgroundBlurChange?.(v)}
+ formatValue={(v) => `${v.toFixed(1)}px`}
+ parseInput={(text) => parseFloat(text.replace(/px$/, ""))}
+ />
+ </section>
+
+ <div className="w-full">
+ <LayoutGroup id="background-picker-switcher">
+ <div className="grid h-8 w-full grid-cols-3 rounded-xl border border-white/10 bg-white/[0.04] p-1">
+ {([
+ { value: "image", label: tSettings("background.image") },
+ { value: "color", label: tSettings("background.color") },
+ { value: "gradient", label: tSettings("background.gradient") },
+ ] as const).map((option) => {
+ const isActive = backgroundTab === option.value;
+ return (
+ <button
+ key={option.value}
+ type="button"
+ onClick={() => setBackgroundTab(option.value)}
+ className="relative rounded-lg text-[10px] font-semibold tracking-wide transition-colors"
+ >
+ {isActive ? (
+ <motion.span
+ layoutId="background-picker-pill"
+ className="absolute inset-0 rounded-lg bg-[#2563EB]"
+ transition={{ type: "spring", stiffness: 420, damping: 34 }}
+ />
+ ) : null}
+ <span className={cn("relative z-10", isActive ? "text-white" : "text-slate-400 hover:text-slate-200")}>{option.label}</span>
+ </button>
+ );
+ })}
+ </div>
+ </LayoutGroup>
+
+ <div className="pt-2">
+ <AnimatePresence mode="wait" initial={false}>
+ <motion.div
+ key={backgroundTab}
+ initial={{ opacity: 0, y: 10, filter: "blur(8px)" }}
+ animate={{ opacity: 1, y: 0, filter: "blur(0px)" }}
+ exit={{ opacity: 0, y: -8, filter: "blur(6px)" }}
+ transition={{ duration: 0.2, ease: "easeOut" }}
+ >
+ {backgroundTab === "image" ? (
+ <div className="mt-0 space-y-2">
+ <input
+ type="file"
+ ref={fileInputRef}
+ onChange={handleImageUpload}
+ accept=".jpg,.jpeg,image/jpeg"
+ className="hidden"
+ />
+ <Button
+ onClick={() => fileInputRef.current?.click()}
+ variant="outline"
+ className="w-full gap-2 bg-white/5 text-slate-200 border-white/10 hover:bg-[#2563EB] hover:text-white hover:border-[#2563EB] transition-all h-7 text-[10px]"
+ >
+ <Upload className="w-3 h-3" />
+ {tSettings("background.uploadCustom")}
+ </Button>
+
+ <div className="grid grid-cols-8 gap-1.5">
+ {customImages.map((imageUrl, idx) => {
+ const isSelected = getWallpaperTileState(imageUrl);
+ return (
+ <div
+ key={`custom-${idx}`}
+ className={wallpaperTileClass(isSelected)}
+ style={{
+ backgroundImage: `url(${imageUrl})`,
+ backgroundSize: "cover",
+ backgroundPosition: "center",
+ }}
+ onClick={() => onWallpaperChange(imageUrl)}
+ role="button"
+ >
+ <button
+ onClick={(e) => handleRemoveCustomImage(imageUrl, e)}
+ className="absolute top-0.5 right-0.5 w-3 h-3 bg-red-500/90 hover:bg-red-500 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-10"
+ >
+ <X className="w-2 h-2 text-white" />
+ </button>
+ </div>
+ );
+ })}
+
+ {(wallpaperPreviewPaths.length > 0
+ ? wallpaperPreviewPaths
+ : WALLPAPER_PATHS
+ ).map((previewPath, index) => {
+ const wallpaper = BUILT_IN_WALLPAPERS[index];
+ const wallpaperValue = WALLPAPER_PATHS[index] ?? previewPath;
+ const isSelected = getWallpaperTileState(wallpaperValue, previewPath);
+ return (
+ <div
+ key={wallpaperValue}
+ className={wallpaperTileClass(isSelected)}
+ aria-label={wallpaper?.label ?? `Wallpaper ${index + 1}`}
+ title={wallpaper?.label ?? `Wallpaper ${index + 1}`}
+ style={{
+ backgroundImage: `url(${previewPath})`,
+ backgroundSize: "cover",
+ backgroundPosition: "center",
+ }}
+ onClick={() => onWallpaperChange(wallpaperValue)}
+ role="button"
+ />
+ );
+ })}
+ </div>
+ </div>
+ ) : backgroundTab === "color" ? (
+ <div className="mt-0 space-y-2">
+ <input
+ ref={customColorInputRef}
+ type="color"
+ value={selectedColor}
+ onChange={(event) => {
+ setSelectedColor(event.target.value);
+ onWallpaperChange(event.target.value);
+ }}
+ className="sr-only"
+ />
+ <div className="grid grid-cols-8 gap-1.5">
+ {visibleColorPalette.map((color) => {
+ const isSelected = selected.toLowerCase() === color.toLowerCase();
+ return (
+ <button
+ key={color}
+ type="button"
+ onClick={() => {
+ setSelectedColor(color);
+ onWallpaperChange(color);
+ }}
+ className={wallpaperTileClass(isSelected)}
+ style={{ background: color }}
+ aria-label={`Color ${color}`}
+ />
+ );
+ })}
+ <button
+ type="button"
+ onClick={() => customColorInputRef.current?.click()}
+ className={wallpaperTileClass(isHexWallpaper(selected) && !visibleColorPalette.some((color) => color.toLowerCase() === selected.toLowerCase()))}
+ style={{
+ background: `linear-gradient(135deg, ${selectedColor} 0%, ${selectedColor} 58%, rgba(255,255,255,0.92) 58%, rgba(255,255,255,0.92) 100%)`,
+ }}
+ aria-label="Custom color picker"
+ >
+ <div className="absolute inset-0 flex items-center justify-center text-[9px] font-semibold uppercase tracking-[0.18em] text-white/90">
+ Pick
+ </div>
+ </button>
+ </div>
+ </div>
+ ) : (
+ <div className="mt-0 grid grid-cols-8 gap-1.5">
+ {GRADIENTS.map((g, idx) => (
+ <div
+ key={g}
+ className={wallpaperTileClass(gradient === g)}
+ style={{ background: g }}
+ aria-label={`Gradient ${idx + 1}`}
+ onClick={() => {
+ setGradient(g);
+ onWallpaperChange(g);
+ }}
+ role="button"
+ />
+ ))}
+ </div>
+ )}
+ </motion.div>
+ </AnimatePresence>
+ </div>
+ </div>
+ </div>
+ );
+
// If an annotation is selected, show annotation settings instead
if (
+ !isBackgroundPanel &&
selectedAnnotation &&
onAnnotationContentChange &&
onAnnotationTypeChange &&
@@ -472,613 +748,207 @@ export function SettingsPanel({
);
}
- return (
- <div className="flex-[2] min-w-0 bg-[#09090b] border border-white/5 rounded-2xl flex flex-col shadow-xl h-full overflow-hidden">
- <div className="flex-1 overflow-y-auto custom-scrollbar p-4 pb-0">
- <div className="mb-4">
- <div className="flex items-center justify-between mb-3">
- <span className="text-sm font-medium text-slate-200">{tSettings("zoom.level")}</span>
- <div className="flex items-center gap-2">
- {zoomEnabled && selectedZoomDepth && (
- <span className="text-[10px] uppercase tracking-wider font-medium text-[#2563EB] bg-[#2563EB]/10 px-2 py-0.5 rounded-full">
- {ZOOM_DEPTH_OPTIONS.find((o) => o.depth === selectedZoomDepth)?.label}
- </span>
- )}
- <KeyboardShortcutsHelp />
- </div>
- </div>
- <div className="grid grid-cols-6 gap-1.5">
- {ZOOM_DEPTH_OPTIONS.map((option) => {
- const isActive = selectedZoomDepth === option.depth;
- return (
- <Button
- key={option.depth}
- type="button"
- disabled={!zoomEnabled}
- onClick={() => onZoomDepthChange?.(option.depth)}
- className={cn(
- "h-auto w-full rounded-lg border px-1 py-2 text-center shadow-sm transition-all",
- "duration-200 ease-out",
- zoomEnabled ? "opacity-100 cursor-pointer" : "opacity-40 cursor-not-allowed",
- isActive
- ? "border-[#2563EB] bg-[#2563EB] text-white shadow-[#2563EB]/20"
- : "border-white/5 bg-white/5 text-slate-400 hover:bg-white/10 hover:border-white/10 hover:text-slate-200",
- )}
- >
- <span className="text-xs font-semibold">{option.label}</span>
- </Button>
- );
- })}
+ if (isBackgroundPanel) {
+ return (
+ <div className="flex-[2] min-w-[280px] max-w-[332px] bg-[#161619] border border-white/10 rounded-2xl flex flex-col shadow-xl h-full overflow-hidden">
+ <div className="flex-1 overflow-y-auto custom-scrollbar p-4">
+ <div className="mb-4 flex items-center gap-2">
+ <Palette className="w-4 h-4 text-[#2563EB]" />
+ <span className="text-sm font-medium text-slate-200">
+ {tSettings("background.title")}
+ </span>
</div>
- {!zoomEnabled && (
- <p className="text-[10px] text-slate-500 mt-2 text-center">
- {tSettings("zoom.selectRegion")}
- </p>
- )}
- {zoomEnabled && (
- <Button
- onClick={handleDeleteClick}
- variant="destructive"
- size="sm"
- className="mt-2 w-full gap-2 bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 hover:border-red-500/30 transition-all h-8 text-xs"
- >
- <Trash2 className="w-3 h-3" />
- {tSettings("zoom.deleteZoom")}
- </Button>
- )}
+ {backgroundSettingsContent}
</div>
+ </div>
+ );
+ }
- {trimEnabled && (
- <div className="mb-4">
- <Button
- onClick={handleTrimDeleteClick}
- variant="destructive"
- size="sm"
- className="w-full gap-2 bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 hover:border-red-500/30 transition-all h-8 text-xs"
- >
- <Trash2 className="w-3 h-3" />
- {tSettings("trim.deleteRegion")}
- </Button>
- </div>
- )}
+ const zoomSectionContent = (
+ <section className="flex flex-col gap-2">
+ <div className="flex items-center justify-between gap-3">
+ <div className="flex items-center gap-3">
+ <SectionLabel>Zoom</SectionLabel>
+ <button
+ type="button"
+ onClick={resetZoomSection}
+ className="text-[10px] text-[#2563EB] transition-opacity hover:opacity-80"
+ >
+ Reset
+ </button>
+ </div>
+ <div className="flex items-center gap-2 text-[10px] text-slate-400">
+ <span>Connect</span>
+ <Switch
+ checked={connectZooms}
+ onCheckedChange={onConnectZoomsChange}
+ className="data-[state=checked]:bg-[#2563EB] scale-75"
+ />
+ </div>
+ </div>
+ <SliderControl
+ label="Motion Blur"
+ value={zoomMotionBlur}
+ defaultValue={DEFAULT_ZOOM_MOTION_BLUR}
+ min={0}
+ max={2}
+ step={0.05}
+ onChange={(v) => onZoomMotionBlurChange?.(v)}
+ formatValue={(v) => `${v.toFixed(2)}×`}
+ parseInput={(text) => parseFloat(text.replace(/×$/, ""))}
+ />
+ </section>
+ );
- <div className="mb-4">
- <div className="flex items-center justify-between mb-3">
- <span className="text-sm font-medium text-slate-200">
- {tSettings("speed.playbackSpeed")}
- </span>
- {selectedSpeedId && selectedSpeedValue && (
- <span className="text-[10px] uppercase tracking-wider font-medium text-[#d97706] bg-[#d97706]/10 px-2 py-0.5 rounded-full">
- {SPEED_OPTIONS.find((o) => o.speed === selectedSpeedValue)?.label ??
- `${selectedSpeedValue}×`}
- </span>
- )}
+ const frameSectionContent = (
+ <section className="flex flex-col gap-2">
+ <div className="flex items-center justify-between gap-3">
+ <SectionLabel>Frame</SectionLabel>
+ <button type="button" onClick={resetFrameSection} className="text-[10px] text-[#2563EB] transition-opacity hover:opacity-80">Reset</button>
+ </div>
+ <div className="flex flex-col gap-1.5">
+ <SliderControl label="Shadow" value={shadowIntensity} defaultValue={initialEditorPreferences.shadowIntensity} min={0} max={1} step={0.01} onChange={(v) => onShadowChange?.(v)} formatValue={(v) => `${Math.round(v * 100)}%`} parseInput={(text) => parseFloat(text.replace(/%$/, "")) / 100} />
+ <SliderControl label="Radius" value={borderRadius} defaultValue={initialEditorPreferences.borderRadius} min={0} max={50} step={0.5} onChange={(v) => onBorderRadiusChange?.(v)} formatValue={(v) => `${v}px`} parseInput={(text) => parseFloat(text.replace(/px$/, ""))} />
+ <SliderControl label="Padding" value={padding} defaultValue={initialEditorPreferences.padding} min={0} max={100} step={1} onChange={(v) => onPaddingChange?.(v)} formatValue={(v) => `${v}%`} parseInput={(text) => parseFloat(text.replace(/%$/, ""))} />
+ <div className="flex items-center justify-between rounded-lg bg-white/[0.03] px-2.5 py-1.5">
+ <span className="text-[10px] text-slate-400">Remove Background</span>
+ <Switch checked={removeBackgroundEnabled} onCheckedChange={handleRemoveBackgroundToggle} className="data-[state=checked]:bg-[#2563EB] scale-75" />
+ </div>
+ </div>
+ </section>
+ );
+
+ const cropSectionContent = (
+ <section className="flex flex-col gap-2">
+ <div className="flex items-center justify-between gap-3">
+ <SectionLabel>Crop</SectionLabel>
+ {isCropped ? <button type="button" onClick={resetCropSection} className="text-[10px] text-[#2563EB] transition-opacity hover:opacity-80">Reset</button> : null}
+ </div>
+ <div className="flex flex-col gap-1.5">
+ <SliderControl label="Top" value={cropTop} defaultValue={0} min={0} max={50} step={1} onChange={(v) => setCropInset("top", v)} formatValue={(v) => `${Math.round(v)}%`} parseInput={(text) => parseFloat(text.replace(/%$/, ""))} />
+ <SliderControl label="Bottom" value={cropBottom} defaultValue={0} min={0} max={50} step={1} onChange={(v) => setCropInset("bottom", v)} formatValue={(v) => `${Math.round(v)}%`} parseInput={(text) => parseFloat(text.replace(/%$/, ""))} />
+ <SliderControl label="Left" value={cropLeft} defaultValue={0} min={0} max={50} step={1} onChange={(v) => setCropInset("left", v)} formatValue={(v) => `${Math.round(v)}%`} parseInput={(text) => parseFloat(text.replace(/%$/, ""))} />
+ <SliderControl label="Right" value={cropRight} defaultValue={0} min={0} max={50} step={1} onChange={(v) => setCropInset("right", v)} formatValue={(v) => `${Math.round(v)}%`} parseInput={(text) => parseFloat(text.replace(/%$/, ""))} />
+ </div>
+ <Button onClick={handleCropToggle} variant="outline" className="w-full gap-1.5 bg-white/5 text-slate-200 border-white/10 hover:bg-white/10 hover:border-white/20 hover:text-white text-[10px] h-8 transition-all"><Crop className="w-3 h-3" />Open Crop Editor</Button>
+ </section>
+ );
+
+ const effectSectionContent = (() => {
+ switch (activeEffectSection) {
+ case "scene":
+ case "zoom":
+ case "frame":
+ case "crop":
+ return (
+ <div className="space-y-5">
+ {backgroundSettingsContent}
+ {zoomSectionContent}
+ {frameSectionContent}
+ {cropSectionContent}
</div>
- <div className="grid grid-cols-7 gap-1.5">
- {SPEED_OPTIONS.map((option) => {
- const isActive = selectedSpeedValue === option.speed;
- return (
- <Button
- key={option.speed}
+ );
+ case "cursor":
+ return (
+ <section className="flex flex-col gap-2">
+ <div className="flex items-center justify-between gap-3">
+ <div className="flex items-center gap-3">
+ <SectionLabel>Cursor</SectionLabel>
+ <button
type="button"
- disabled={!selectedSpeedId}
- onClick={() => onSpeedChange?.(option.speed)}
- className={cn(
- "h-auto w-full rounded-lg border px-1 py-2 text-center shadow-sm transition-all",
- "duration-200 ease-out",
- selectedSpeedId
- ? "opacity-100 cursor-pointer"
- : "opacity-40 cursor-not-allowed",
- isActive
- ? "border-[#d97706] bg-[#d97706] text-white shadow-[#d97706]/20"
- : "border-white/5 bg-white/5 text-slate-400 hover:bg-white/10 hover:border-white/10 hover:text-slate-200",
- )}
+ onClick={resetCursorSection}
+ className="text-[10px] text-[#2563EB] transition-opacity hover:opacity-80"
>
- <span className="text-xs font-semibold">{option.label}</span>
- </Button>
- );
- })}
- </div>
- {!selectedSpeedId && (
- <p className="text-[10px] text-slate-500 mt-2 text-center">
- {tSettings("speed.selectRegion")}
- </p>
- )}
- {selectedSpeedId && (
- <Button
- onClick={() => selectedSpeedId && onSpeedDelete?.(selectedSpeedId)}
- variant="destructive"
- size="sm"
- className="mt-2 w-full gap-2 bg-red-500/10 text-red-400 border border-red-500/20 hover:bg-red-500/20 hover:border-red-500/30 transition-all h-8 text-xs"
- >
- <Trash2 className="w-3 h-3" />
- {tSettings("speed.deleteRegion")}
- </Button>
- )}
- </div>
-
- <Accordion type="multiple" defaultValue={["effects", "background"]} className="space-y-1">
- <AccordionItem value="effects" className="border-white/5 rounded-xl bg-white/[0.02] px-3">
- <AccordionTrigger className="py-2.5 hover:no-underline">
- <div className="flex items-center gap-2">
- <Sparkles className="w-4 h-4 text-[#2563EB]" />
- <span className="text-xs font-medium">{tSettings("effects.title")}</span>
+ Reset
+ </button>
</div>
- </AccordionTrigger>
- <AccordionContent className="pb-3">
- <div className="grid grid-cols-2 gap-2 mb-3">
- <div className="flex items-center justify-between p-2 rounded-lg bg-white/5 border border-white/5">
- <div className="text-[10px] font-medium text-slate-300">
- {tSettings("effects.showCursor")}
- </div>
+ <div className="flex items-center gap-3">
+ <label className="flex items-center gap-1.5 text-[10px] text-slate-400">
+ <span>Show</span>
<Switch
checked={showCursor}
onCheckedChange={onShowCursorChange}
- className="data-[state=checked]:bg-[#2563EB] scale-90"
+ className="data-[state=checked]:bg-[#2563EB] scale-75"
/>
- </div>
- <div className="flex items-center justify-between p-2 rounded-lg bg-white/5 border border-white/5">
- <div>
- <div className="text-[10px] font-medium text-slate-300">
- {tSettings("effects.loopCursor")}
- </div>
- </div>
+ </label>
+ <label className="flex items-center gap-1.5 text-[10px] text-slate-400">
+ <span>Loop</span>
<Switch
checked={loopCursor}
onCheckedChange={onLoopCursorChange}
- className="data-[state=checked]:bg-[#2563EB] scale-90"
- />
- </div>
- <div className="p-2 rounded-lg bg-white/5 border border-white/5">
- <SliderControl
- label={tSettings("effects.backgroundBlur")}
- value={backgroundBlur}
- defaultValue={0}
- min={0}
- max={8}
- step={0.25}
- onChange={(v) => onBackgroundBlurChange?.(v)}
- formatValue={(v) => `${v.toFixed(1)}px`}
- parseInput={(t) => parseFloat(t.replace(/px$/, ""))}
- />
- </div>
- </div>
-
- <div className="grid grid-cols-2 gap-2 mb-3">
- <div className="p-2 rounded-lg bg-white/5 border border-white/5">
- <SliderControl
- label={tSettings("effects.zoomMotionBlur")}
- value={zoomMotionBlur}
- defaultValue={DEFAULT_ZOOM_MOTION_BLUR}
- min={0}
- max={2}
- step={0.05}
- onChange={(v) => onZoomMotionBlurChange?.(v)}
- formatValue={(v) => `${v.toFixed(2)}×`}
- parseInput={(t) => parseFloat(t.replace(/×$/, ""))}
- />
- </div>
-
- <div className="flex items-center justify-between p-2 rounded-lg bg-white/5 border border-white/5">
- <div className="text-[10px] font-medium text-slate-300">
- {tSettings("effects.connectZooms")}
- </div>
- <Switch
- checked={connectZooms}
- onCheckedChange={onConnectZoomsChange}
- className="data-[state=checked]:bg-[#2563EB] scale-90"
- />
- </div>
- </div>
-
- <div className="grid grid-cols-2 gap-2 mb-3">
- <div className="p-2 rounded-lg bg-white/5 border border-white/5">
- <SliderControl
- label={tSettings("effects.cursorSize")}
- value={cursorSize}
- defaultValue={DEFAULT_CURSOR_SIZE}
- min={0.5}
- max={10}
- step={0.05}
- onChange={(v) => onCursorSizeChange?.(v)}
- formatValue={(v) => `${v.toFixed(2)}×`}
- parseInput={(t) => parseFloat(t.replace(/×$/, ""))}
- />
- </div>
- <div className="p-2 rounded-lg bg-white/5 border border-white/5">
- <SliderControl
- label={tSettings("effects.cursorSmoothing")}
- value={cursorSmoothing}
- defaultValue={DEFAULT_CURSOR_SMOOTHING}
- min={0}
- max={2}
- step={0.01}
- onChange={(v) => onCursorSmoothingChange?.(v)}
- formatValue={(v) => (v <= 0 ? "Off" : v.toFixed(2))}
- parseInput={(t) => parseFloat(t)}
- />
- </div>
- </div>
-
- <div className="grid grid-cols-2 gap-2 mb-3">
- <div className="p-2 rounded-lg bg-white/5 border border-white/5">
- <SliderControl
- label={tSettings("effects.cursorMotionBlur")}
- value={cursorMotionBlur}
- defaultValue={DEFAULT_CURSOR_MOTION_BLUR}
- min={0}
- max={2}
- step={0.05}
- onChange={(v) => onCursorMotionBlurChange?.(v)}
- formatValue={(v) => `${v.toFixed(2)}×`}
- parseInput={(t) => parseFloat(t.replace(/×$/, ""))}
- />
- </div>
- <div className="p-2 rounded-lg bg-white/5 border border-white/5">
- <SliderControl
- label={tSettings("effects.cursorClickBounce")}
- value={cursorClickBounce}
- defaultValue={DEFAULT_CURSOR_CLICK_BOUNCE}
- min={0}
- max={5}
- step={0.05}
- onChange={(v) => onCursorClickBounceChange?.(v)}
- formatValue={(v) => `${v.toFixed(2)}×`}
- parseInput={(t) => parseFloat(t.replace(/×$/, ""))}
+ className="data-[state=checked]:bg-[#2563EB] scale-75"
/>
- </div>
+ </label>
</div>
-
- <div className="grid grid-cols-2 gap-2">
- <div className="p-2 rounded-lg bg-white/5 border border-white/5">
- <SliderControl
- label={tSettings("effects.cursorSway")}
- value={toCursorSwaySliderValue(cursorSway)}
- defaultValue={toCursorSwaySliderValue(DEFAULT_CURSOR_SWAY)}
- min={0}
- max={toCursorSwaySliderValue(2)}
- step={toCursorSwaySliderValue(0.05)}
- onChange={(v) => onCursorSwayChange?.(fromCursorSwaySliderValue(v))}
- formatValue={(v) => (v <= 0 ? "Off" : `${v.toFixed(2)}×`)}
- parseInput={(t) => {
- const normalized = t.trim().toLowerCase();
- if (normalized === "off") {
- return 0;
- }
-
- return parseFloat(t.replace(/×$/, ""));
- }}
- />
- </div>
- <div className="p-2 rounded-lg bg-white/5 border border-white/5">
- <SliderControl
- label={tSettings("effects.shadow")}
- value={shadowIntensity}
- defaultValue={0}
- min={0}
- max={1}
- step={0.01}
- onChange={(v) => onShadowChange?.(v)}
- formatValue={(v) => `${Math.round(v * 100)}%`}
- parseInput={(t) => parseFloat(t.replace(/%$/, "")) / 100}
- />
- </div>
- <div className="p-2 rounded-lg bg-white/5 border border-white/5">
- <SliderControl
- label={tSettings("effects.webcamSize")}
- value={webcam?.size ?? DEFAULT_WEBCAM_SIZE}
- defaultValue={DEFAULT_WEBCAM_SIZE}
- min={10}
- max={100}
- step={1}
- onChange={(v) => updateWebcam({ size: v })}
- formatValue={(v) => `${Math.round(v)}%`}
- parseInput={(t) => parseFloat(t.replace(/%$/, ""))}
- />
- </div>
- <div className="p-2 rounded-lg bg-white/5 border border-white/5">
- <SliderControl
- label={tSettings("effects.webcamRoundness")}
- value={webcam?.cornerRadius ?? DEFAULT_WEBCAM_CORNER_RADIUS}
- defaultValue={DEFAULT_WEBCAM_CORNER_RADIUS}
- min={0}
- max={80}
- step={1}
- onChange={(v) => updateWebcam({ cornerRadius: v })}
- formatValue={(v) => `${Math.round(v)}px`}
- parseInput={(t) => parseFloat(t.replace(/px$/, ""))}
- />
- </div>
- <div className="p-2 rounded-lg bg-white/5 border border-white/5">
- <SliderControl
- label={tSettings("effects.webcamShadow")}
- value={webcam?.shadow ?? DEFAULT_WEBCAM_SHADOW}
- defaultValue={DEFAULT_WEBCAM_SHADOW}
- min={0}
- max={1}
- step={0.01}
- onChange={(v) => updateWebcam({ shadow: v })}
- formatValue={(v) => `${Math.round(v * 100)}%`}
- parseInput={(t) => parseFloat(t.replace(/%$/, "")) / 100}
- />
- </div>
- <div className="flex items-center justify-between p-2 rounded-lg bg-white/5 border border-white/5">
- <div className="text-[10px] font-medium text-slate-300">
- {tSettings("effects.webcamReactToZoom")}
- </div>
- <Switch
- checked={webcam?.reactToZoom ?? DEFAULT_WEBCAM_REACT_TO_ZOOM}
- onCheckedChange={(reactToZoom) => updateWebcam({ reactToZoom })}
- className="data-[state=checked]:bg-[#2563EB] scale-90"
- />
- </div>
- <div className="flex items-center justify-between p-2 rounded-lg bg-white/5 border border-white/5">
- <div className="text-[10px] font-medium text-slate-300">
- {tSettings("effects.webcam")}
+ </div>
+ <div className="flex flex-col gap-1.5">
+ <SliderControl label="Size" value={cursorSize} defaultValue={DEFAULT_CURSOR_SIZE} min={0.5} max={10} step={0.05} onChange={(v) => onCursorSizeChange?.(v)} formatValue={(v) => `${v.toFixed(2)}×`} parseInput={(text) => parseFloat(text.replace(/×$/, ""))} />
+ <SliderControl label="Smooth" value={cursorSmoothing} defaultValue={DEFAULT_CURSOR_SMOOTHING} min={0} max={2} step={0.01} onChange={(v) => onCursorSmoothingChange?.(v)} formatValue={(v) => (v <= 0 ? "Off" : v.toFixed(2))} parseInput={(text) => parseFloat(text)} />
+ <SliderControl label="Motion Blur" value={cursorMotionBlur} defaultValue={DEFAULT_CURSOR_MOTION_BLUR} min={0} max={2} step={0.05} onChange={(v) => onCursorMotionBlurChange?.(v)} formatValue={(v) => `${v.toFixed(2)}×`} parseInput={(text) => parseFloat(text.replace(/×$/, ""))} />
+ <SliderControl label="Bounce" value={cursorClickBounce} defaultValue={DEFAULT_CURSOR_CLICK_BOUNCE} min={0} max={5} step={0.05} onChange={(v) => onCursorClickBounceChange?.(v)} formatValue={(v) => `${v.toFixed(2)}×`} parseInput={(text) => parseFloat(text.replace(/×$/, ""))} />
+ <SliderControl
+ label="Sway"
+ value={toCursorSwaySliderValue(cursorSway)}
+ defaultValue={toCursorSwaySliderValue(DEFAULT_CURSOR_SWAY)}
+ min={0}
+ max={toCursorSwaySliderValue(2)}
+ step={toCursorSwaySliderValue(0.05)}
+ onChange={(v) => onCursorSwayChange?.(fromCursorSwaySliderValue(v))}
+ formatValue={(v) => (v <= 0 ? "Off" : `${v.toFixed(2)}×`)}
+ parseInput={(text) => {
+ const normalized = text.trim().toLowerCase();
+ if (normalized === "off") return 0;
+ return parseFloat(text.replace(/×$/, ""));
+ }}
+ />
+ </div>
+ </section>
+ );
+ case "webcam":
+ return (
+ <section className="flex flex-col gap-2">
+ <div className="flex items-center justify-between gap-3">
+ <SectionLabel>Webcam</SectionLabel>
+ <button type="button" onClick={resetWebcamSection} className="text-[10px] text-[#2563EB] transition-opacity hover:opacity-80">Reset</button>
+ </div>
+ <div className="flex flex-col gap-1.5">
+ <div className="flex items-center justify-between rounded-lg bg-white/[0.03] px-2.5 py-1.5"><span className="text-[10px] text-slate-400">Show</span><Switch checked={webcam?.enabled ?? false} onCheckedChange={(enabled) => updateWebcam({ enabled })} className="data-[state=checked]:bg-[#2563EB] scale-75" /></div>
+ <div className="flex items-center justify-between rounded-lg bg-white/[0.03] px-2.5 py-1.5"><span className="text-[10px] text-slate-400">React To Zoom</span><Switch checked={webcam?.reactToZoom ?? DEFAULT_WEBCAM_REACT_TO_ZOOM} onCheckedChange={(reactToZoom) => updateWebcam({ reactToZoom })} className="data-[state=checked]:bg-[#2563EB] scale-75" /></div>
+ <SliderControl label="Size" value={webcam?.size ?? DEFAULT_WEBCAM_SIZE} defaultValue={DEFAULT_WEBCAM_SIZE} min={10} max={100} step={1} onChange={(v) => updateWebcam({ size: v })} formatValue={(v) => `${Math.round(v)}%`} parseInput={(text) => parseFloat(text.replace(/%$/, ""))} />
+ <SliderControl label="Roundness" value={webcam?.cornerRadius ?? DEFAULT_WEBCAM_CORNER_RADIUS} defaultValue={DEFAULT_WEBCAM_CORNER_RADIUS} min={0} max={80} step={1} onChange={(v) => updateWebcam({ cornerRadius: v })} formatValue={(v) => `${Math.round(v)}px`} parseInput={(text) => parseFloat(text.replace(/px$/, ""))} />
+ <SliderControl label="Shadow" value={webcam?.shadow ?? DEFAULT_WEBCAM_SHADOW} defaultValue={DEFAULT_WEBCAM_SHADOW} min={0} max={1} step={0.01} onChange={(v) => updateWebcam({ shadow: v })} formatValue={(v) => `${Math.round(v * 100)}%`} parseInput={(text) => parseFloat(text.replace(/%$/, "")) / 100} />
+ <div className="rounded-lg bg-white/[0.03] px-2.5 py-2">
+ <div className="flex items-center justify-between gap-2">
+ <div>
+ <div className="text-[10px] text-slate-300">Footage</div>
+ <div className="mt-0.5 text-[10px] text-slate-500">{webcamFileName ?? tSettings("effects.webcamFootageDescription")}</div>
</div>
- <Switch
- checked={webcam?.enabled ?? false}
- onCheckedChange={(enabled) => updateWebcam({ enabled })}
- className="data-[state=checked]:bg-[#2563EB] scale-90"
- />
- </div>
- <div className="col-span-2 rounded-lg border border-white/5 bg-white/5 p-2">
- <div className="flex items-center justify-between gap-2">
- <div>
- <div className="text-[10px] font-medium text-slate-300">
- {tSettings("effects.webcamFootage")}
- </div>
- <div className="mt-0.5 text-[10px] text-slate-500">
- {webcamFileName ?? tSettings("effects.webcamFootageDescription")}
- </div>
- </div>
- <div className="flex items-center gap-1.5">
- <Button
- type="button"
- variant="outline"
- onClick={onUploadWebcam}
- className="h-7 gap-1.5 border-white/10 bg-white/5 px-2 text-[10px] text-slate-200 hover:bg-white/10 hover:text-white"
- >
- <Upload className="h-3 w-3" />
- {webcam?.sourcePath
- ? tSettings("effects.replaceWebcamFootage")
- : tSettings("effects.uploadWebcamFootage")}
- </Button>
- {webcam?.sourcePath ? (
- <Button
- type="button"
- variant="outline"
- onClick={onClearWebcam}
- className="h-7 gap-1.5 border-white/10 bg-white/5 px-2 text-[10px] text-slate-200 hover:bg-white/10 hover:text-white"
- >
- <Trash2 className="h-3 w-3" />
- {tSettings("effects.removeWebcamFootage")}
- </Button>
- ) : null}
- </div>
+ <div className="flex items-center gap-1.5">
+ <Button type="button" variant="outline" onClick={onUploadWebcam} className="h-7 gap-1.5 border-white/10 bg-white/5 px-2 text-[10px] text-slate-200 hover:bg-white/10 hover:text-white"><Upload className="h-3 w-3" />{webcam?.sourcePath ? "Replace" : "Upload"}</Button>
+ {webcam?.sourcePath ? <Button type="button" variant="outline" onClick={onClearWebcam} className="h-7 gap-1.5 border-white/10 bg-white/5 px-2 text-[10px] text-slate-200 hover:bg-white/10 hover:text-white"><Trash2 className="h-3 w-3" />Remove</Button> : null}
</div>
</div>
- <div className="p-2 rounded-lg bg-white/5 border border-white/5">
- <SliderControl
- label={tSettings("effects.roundness")}
- value={borderRadius}
- defaultValue={12.5}
- min={0}
- max={25}
- step={0.5}
- onChange={(v) => onBorderRadiusChange?.(v)}
- formatValue={(v) => `${v}px`}
- parseInput={(t) => parseFloat(t.replace(/px$/, ""))}
- />
- </div>
- <div className="p-2 rounded-lg bg-white/5 border border-white/5">
- <SliderControl
- label={tSettings("effects.padding")}
- value={padding}
- defaultValue={50}
- min={0}
- max={100}
- step={1}
- onChange={(v) => onPaddingChange?.(v)}
- formatValue={(v) => `${v}%`}
- parseInput={(t) => parseFloat(t.replace(/%$/, ""))}
- />
- </div>
- <div className="col-span-2 flex items-center justify-between p-2 rounded-lg bg-white/5 border border-white/5">
- <div className="text-[10px] font-medium text-slate-300">{tSettings("effects.removeBackground")}</div>
- <Switch
- checked={removeBackgroundEnabled}
- onCheckedChange={handleRemoveBackgroundToggle}
- className="data-[state=checked]:bg-[#2563EB] scale-90"
- />
- </div>
</div>
+ </div>
+ </section>
+ );
+ }
+ })();
- <Button
- onClick={handleCropToggle}
- variant="outline"
- className="w-full mt-2 gap-1.5 bg-white/5 text-slate-200 border-white/10 hover:bg-white/10 hover:border-white/20 hover:text-white text-[10px] h-8 transition-all"
- >
- <Crop className="w-3 h-3" />
- {tSettings("crop.title")}
- </Button>
- </AccordionContent>
- </AccordionItem>
-
- <AccordionItem
- value="background"
- className="border-white/5 rounded-xl bg-white/[0.02] px-3"
- >
- <AccordionTrigger className="py-2.5 hover:no-underline">
- <div className="flex items-center gap-2">
- <Palette className="w-4 h-4 text-[#2563EB]" />
- <span className="text-xs font-medium">{tSettings("background.title")}</span>
- </div>
- </AccordionTrigger>
- <AccordionContent className="pb-3">
- <Tabs
- value={backgroundTab}
- onValueChange={(value) => setBackgroundTab(value as BackgroundTab)}
- className="w-full"
- >
- <TabsList className="mb-2 bg-white/5 border border-white/5 p-0.5 w-full grid grid-cols-3 h-7 rounded-lg">
- <TabsTrigger
- value="image"
- className="data-[state=active]:bg-[#2563EB] data-[state=active]:text-white text-slate-400 text-[10px] py-1 rounded-md transition-all"
- >
- {tSettings("background.image")}
- </TabsTrigger>
- <TabsTrigger
- value="color"
- className="data-[state=active]:bg-[#2563EB] data-[state=active]:text-white text-slate-400 text-[10px] py-1 rounded-md transition-all"
- >
- {tSettings("background.color")}
- </TabsTrigger>
- <TabsTrigger
- value="gradient"
- className="data-[state=active]:bg-[#2563EB] data-[state=active]:text-white text-slate-400 text-[10px] py-1 rounded-md transition-all"
- >
- {tSettings("background.gradient")}
- </TabsTrigger>
- </TabsList>
-
- <div className="max-h-[min(200px,25vh)] overflow-y-auto custom-scrollbar">
- <TabsContent value="image" className="mt-0 space-y-2">
- <input
- type="file"
- ref={fileInputRef}
- onChange={handleImageUpload}
- accept=".jpg,.jpeg,image/jpeg"
- className="hidden"
- />
- <Button
- onClick={() => fileInputRef.current?.click()}
- variant="outline"
- className="w-full gap-2 bg-white/5 text-slate-200 border-white/10 hover:bg-[#2563EB] hover:text-white hover:border-[#2563EB] transition-all h-7 text-[10px]"
- >
- <Upload className="w-3 h-3" />
- {tSettings("background.uploadCustom")}
- </Button>
-
- <div className="grid grid-cols-7 gap-1.5">
- {customImages.map((imageUrl, idx) => {
- const isSelected = selected === imageUrl;
- return (
- <div
- key={`custom-${idx}`}
- className={cn(
- "aspect-square w-9 h-9 rounded-md border-2 overflow-hidden cursor-pointer transition-all duration-200 relative group shadow-sm",
- isSelected
- ? "border-[#2563EB] ring-1 ring-[#2563EB]/30"
- : "border-white/10 hover:border-[#2563EB]/40 opacity-80 hover:opacity-100 bg-white/5",
- )}
- style={{
- backgroundImage: `url(${imageUrl})`,
- backgroundSize: "cover",
- backgroundPosition: "center",
- }}
- onClick={() => onWallpaperChange(imageUrl)}
- role="button"
- >
- <button
- onClick={(e) => handleRemoveCustomImage(imageUrl, e)}
- className="absolute top-0.5 right-0.5 w-3 h-3 bg-red-500/90 hover:bg-red-500 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity z-10"
- >
- <X className="w-2 h-2 text-white" />
- </button>
- </div>
- );
- })}
-
- {(wallpaperPreviewPaths.length > 0
- ? wallpaperPreviewPaths
- : WALLPAPER_PATHS
- ).map((previewPath, index) => {
- const wallpaper = BUILT_IN_WALLPAPERS[index];
- const wallpaperValue = WALLPAPER_PATHS[index] ?? previewPath;
- const isSelected = (() => {
- if (!selected) return false;
- if (selected === wallpaperValue || selected === previewPath) return true;
- try {
- const clean = (s: string) =>
- s.replace(/^file:\/\//, "").replace(/^\//, "");
- if (clean(selected).endsWith(clean(wallpaperValue))) return true;
- if (clean(wallpaperValue).endsWith(clean(selected))) return true;
- if (clean(selected).endsWith(clean(previewPath))) return true;
- if (clean(previewPath).endsWith(clean(selected))) return true;
- } catch {
- return false;
- }
- return false;
- })();
- return (
- <div
- key={wallpaperValue}
- className={cn(
- "aspect-square w-9 h-9 rounded-md border-2 overflow-hidden cursor-pointer transition-all duration-200 shadow-sm",
- isSelected
- ? "border-[#2563EB] ring-1 ring-[#2563EB]/30"
- : "border-white/10 hover:border-[#2563EB]/40 opacity-80 hover:opacity-100 bg-white/5",
- )}
- aria-label={wallpaper?.label ?? `Wallpaper ${index + 1}`}
- title={wallpaper?.label ?? `Wallpaper ${index + 1}`}
- style={{
- backgroundImage: `url(${previewPath})`,
- backgroundSize: "cover",
- backgroundPosition: "center",
- }}
- onClick={() => onWallpaperChange(wallpaperValue)}
- role="button"
- />
- );
- })}
- </div>
- </TabsContent>
-
- <TabsContent value="color" className="mt-0">
- <div className="p-1">
- <Block
- color={selectedColor}
- colors={colorPalette}
- onChange={(color) => {
- setSelectedColor(color.hex);
- onWallpaperChange(color.hex);
- }}
- style={{
- width: "100%",
- borderRadius: "8px",
- }}
- />
- </div>
- </TabsContent>
-
- <TabsContent value="gradient" className="mt-0">
- <div className="grid grid-cols-7 gap-1.5">
- {GRADIENTS.map((g, idx) => (
- <div
- key={g}
- className={cn(
- "aspect-square w-9 h-9 rounded-md border-2 overflow-hidden cursor-pointer transition-all duration-200 shadow-sm",
- gradient === g
- ? "border-[#2563EB] ring-1 ring-[#2563EB]/30"
- : "border-white/10 hover:border-[#2563EB]/40 opacity-80 hover:opacity-100 bg-white/5",
- )}
- style={{ background: g }}
- aria-label={`Gradient ${idx + 1}`}
- onClick={() => {
- setGradient(g);
- onWallpaperChange(g);
- }}
- role="button"
- />
- ))}
- </div>
- </TabsContent>
- </div>
- </Tabs>
- </AccordionContent>
- </AccordionItem>
- </Accordion>
+ return (
+ <div className="flex-[2] min-w-[280px] max-w-[332px] bg-[#161619] border border-white/10 rounded-2xl flex flex-col shadow-xl h-full overflow-hidden">
+ <div className="flex-1 min-h-0 overflow-y-auto custom-scrollbar p-4 pb-0">
+ <AnimatePresence mode="wait" initial={false}>
+ <motion.div
+ key={activeEffectSection}
+ initial={{ opacity: 0, y: 8 }}
+ animate={{ opacity: 1, y: 0 }}
+ exit={{ opacity: 0, y: -8 }}
+ transition={{ duration: 0.18, ease: "easeOut" }}
+ >
+ {effectSectionContent}
+ </motion.div>
+ </AnimatePresence>
</div>
{showCropModal && cropRegion && onCropChange && (
@@ -1104,8 +974,8 @@ export function SettingsPanel({
</div>
<CropControl
videoElement={videoElement || null}
- cropRegion={cropRegion}
- onCropChange={onCropChange}
+ cropRegion={cropRegion!}
+ onCropChange={onCropChange!}
aspectRatio={aspectRatio}
/>
<div className="mt-6 flex justify-end">
@@ -1121,191 +991,94 @@ export function SettingsPanel({
</>
)}
- <div className="flex-shrink-0 p-4 pt-3 border-t border-white/5 bg-[#09090b]">
- <div className="flex items-center gap-2 mb-3">
- <button
- onClick={() => onExportFormatChange?.("mp4")}
- className={cn(
- "flex-1 flex items-center justify-center gap-1.5 py-2 rounded-lg border transition-all text-xs font-medium",
- exportFormat === "mp4"
- ? "bg-[#2563EB]/10 border-[#2563EB]/50 text-white"
- : "bg-white/5 border-white/10 text-slate-400 hover:bg-white/10 hover:text-slate-200",
- )}
- >
- <Film className="w-3.5 h-3.5" />
- {tSettings("export.mp4")}
- </button>
- <button
- onClick={() => onExportFormatChange?.("gif")}
- className={cn(
- "flex-1 flex items-center justify-center gap-1.5 py-2 rounded-lg border transition-all text-xs font-medium",
- exportFormat === "gif"
- ? "bg-[#2563EB]/10 border-[#2563EB]/50 text-white"
- : "bg-white/5 border-white/10 text-slate-400 hover:bg-white/10 hover:text-slate-200",
- )}
- >
- <Image className="w-3.5 h-3.5" />
- {tSettings("export.gif")}
- </button>
- </div>
-
- {exportFormat === "mp4" && (
- <div className="mb-3 grid h-7 w-full grid-cols-4 rounded-lg border border-white/5 bg-white/5 p-0.5">
- <button
- onClick={() => onExportQualityChange?.("medium")}
- className={cn(
- "rounded-md transition-all text-[10px] font-medium",
- exportQuality === "medium"
- ? "bg-white text-black"
- : "text-slate-400 hover:text-slate-200",
- )}
- >
- {tSettings("export.quality.low")}
- </button>
- <button
- onClick={() => onExportQualityChange?.("good")}
- className={cn(
- "rounded-md transition-all text-[10px] font-medium",
- exportQuality === "good"
- ? "bg-white text-black"
- : "text-slate-400 hover:text-slate-200",
- )}
- >
- {tSettings("export.quality.medium")}
- </button>
- <button
- onClick={() => onExportQualityChange?.("high")}
- className={cn(
- "rounded-md transition-all text-[10px] font-medium",
- exportQuality === "high"
- ? "bg-white text-black"
- : "text-slate-400 hover:text-slate-200",
- )}
- >
- {tSettings("export.quality.high")}
- </button>
- <button
- onClick={() => onExportQualityChange?.("source")}
- className={cn(
- "rounded-md transition-all text-[10px] font-medium",
- exportQuality === "source"
- ? "bg-white text-black"
- : "text-slate-400 hover:text-slate-200",
- )}
- >
- {tSettings("export.quality.original")}
- </button>
- </div>
- )}
-
- {exportFormat === "gif" && (
- <div className="mb-3 space-y-2">
+ <div className="flex-shrink-0 border-t border-white/10 bg-[#151518] p-4 pt-3">
+ <div className="mb-4">
+ <div className="mb-3 flex items-center justify-between">
+ <span className="text-sm font-medium text-slate-200">{tSettings("zoom.level")}</span>
<div className="flex items-center gap-2">
- <div className="flex-1 bg-white/5 border border-white/5 p-0.5 grid grid-cols-4 h-7 rounded-lg">
- {GIF_FRAME_RATES.map((rate) => (
- <button
- key={rate.value}
- onClick={() => onGifFrameRateChange?.(rate.value)}
- className={cn(
- "rounded-md transition-all text-[10px] font-medium",
- gifFrameRate === rate.value
- ? "bg-white text-black"
- : "text-slate-400 hover:text-slate-200",
- )}
- >
- {rate.value}
- </button>
- ))}
- </div>
- <div className="flex-1 bg-white/5 border border-white/5 p-0.5 grid grid-cols-3 h-7 rounded-lg">
- {Object.entries(GIF_SIZE_PRESETS).map(([key, _preset]) => (
- <button
- key={key}
- onClick={() => onGifSizePresetChange?.(key as GifSizePreset)}
- className={cn(
- "rounded-md transition-all text-[10px] font-medium",
- gifSizePreset === key
- ? "bg-white text-black"
- : "text-slate-400 hover:text-slate-200",
- )}
- >
- {key === "original" ? "Orig" : key.charAt(0).toUpperCase() + key.slice(1, 3)}
- </button>
- ))}
- </div>
- </div>
- <div className="flex items-center justify-between">
- <span className="text-[10px] text-slate-500">
- {gifOutputDimensions.width} × {gifOutputDimensions.height}px
- </span>
- <div className="flex items-center gap-2">
- <span className="text-[10px] text-slate-400">{tSettings("export.loop")}</span>
- <Switch
- checked={gifLoop}
- onCheckedChange={onGifLoopChange}
- className="data-[state=checked]:bg-[#2563EB] scale-75"
- />
- </div>
+ {zoomEnabled && selectedZoomDepth && (
+ <span className="rounded-full bg-[#2563EB]/10 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-[#2563EB]">
+ {ZOOM_DEPTH_OPTIONS.find((o) => o.depth === selectedZoomDepth)?.label}
+ </span>
+ )}
+ <KeyboardShortcutsHelp />
</div>
</div>
- )}
-
- <div className="grid grid-cols-2 gap-2 mb-2">
- <Button
- type="button"
- variant="outline"
- onClick={onLoadProject}
- className="h-8 text-[10px] font-medium gap-1.5 bg-white/5 border-white/10 text-slate-300 hover:bg-white/10"
- >
- <FolderOpen className="w-3.5 h-3.5" />
- {tSettings("export.loadProject")}
- </Button>
- <Button
- type="button"
- variant="outline"
- onClick={onSaveProject}
- className="h-8 text-[10px] font-medium gap-1.5 bg-white/5 border-white/10 text-slate-300 hover:bg-white/10"
- >
- <Save className="w-3.5 h-3.5" />
- {tSettings("export.saveProject")}
- </Button>
+ <div className="grid grid-cols-6 gap-1.5">
+ {ZOOM_DEPTH_OPTIONS.map((option) => {
+ const isActive = selectedZoomDepth === option.depth;
+ return (
+ <Button
+ key={option.depth}
+ type="button"
+ disabled={!zoomEnabled}
+ onClick={() => onZoomDepthChange?.(option.depth)}
+ className={cn(
+ "h-auto w-full rounded-lg border px-1 py-2 text-center shadow-sm transition-all duration-200 ease-out",
+ zoomEnabled ? "opacity-100 cursor-pointer" : "opacity-40 cursor-not-allowed",
+ isActive
+ ? "border-[#2563EB] bg-[#2563EB] text-white"
+ : "border-white/5 bg-white/5 text-slate-400 hover:bg-white/10 hover:border-white/10 hover:text-slate-200",
+ )}
+ >
+ <span className="text-xs font-semibold">{option.label}</span>
+ </Button>
+ );
+ })}
+ </div>
+ {!zoomEnabled && <p className="mt-2 text-center text-[10px] text-slate-500">{tSettings("zoom.selectRegion")}</p>}
+ {zoomEnabled && (
+ <Button onClick={handleDeleteClick} variant="destructive" size="sm" className="mt-2 h-8 w-full gap-2 border border-red-500/20 bg-red-500/10 text-xs text-red-400 transition-all hover:border-red-500/30 hover:bg-red-500/20">
+ <Trash2 className="h-3 w-3" />
+ {tSettings("zoom.deleteZoom")}
+ </Button>
+ )}
+ {trimEnabled && (
+ <Button onClick={handleTrimDeleteClick} variant="destructive" size="sm" className="mt-2 h-8 w-full gap-2 border border-red-500/20 bg-red-500/10 text-xs text-red-400 transition-all hover:border-red-500/30 hover:bg-red-500/20">
+ <Trash2 className="h-3 w-3" />
+ {tSettings("trim.deleteRegion")}
+ </Button>
+ )}
</div>
- <Button
- type="button"
- size="lg"
- onClick={onExport}
- className="w-full py-5 text-sm font-semibold flex items-center justify-center gap-2 bg-[#2563EB] text-white rounded-xl shadow-lg shadow-[#2563EB]/20 hover:bg-[#2563EB]/90 hover:scale-[1.02] active:scale-[0.98] transition-all duration-200"
- >
- <Download className="w-4 h-4" />
- {tSettings("export.exportVideo", undefined, {
- format: exportFormat === "gif" ? "GIF" : "Video",
- })}
- </Button>
-
- <div className="flex gap-2 mt-3">
- <button
- type="button"
- onClick={() => {
- window.electronAPI?.openExternalUrl(
- "https://github.com/webadderall/Recordly/issues/new/choose",
+ <div>
+ <div className="mb-3 flex items-center justify-between">
+ <span className="text-sm font-medium text-slate-200">{tSettings("speed.playbackSpeed")}</span>
+ {selectedSpeedId && selectedSpeedValue && (
+ <span className="rounded-full bg-[#d97706]/10 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wider text-[#d97706]">
+ {SPEED_OPTIONS.find((o) => o.speed === selectedSpeedValue)?.label ?? `${selectedSpeedValue}×`}
+ </span>
+ )}
+ </div>
+ <div className="grid grid-cols-7 gap-1.5">
+ {SPEED_OPTIONS.map((option) => {
+ const isActive = selectedSpeedValue === option.speed;
+ return (
+ <Button
+ key={option.speed}
+ type="button"
+ disabled={!selectedSpeedId}
+ onClick={() => onSpeedChange?.(option.speed)}
+ className={cn(
+ "h-auto w-full rounded-lg border px-1 py-2 text-center shadow-sm transition-all duration-200 ease-out",
+ selectedSpeedId ? "opacity-100 cursor-pointer" : "opacity-40 cursor-not-allowed",
+ isActive
+ ? "border-[#d97706] bg-[#d97706] text-white"
+ : "border-white/5 bg-white/5 text-slate-400 hover:bg-white/10 hover:border-white/10 hover:text-slate-200",
+ )}
+ >
+ <span className="text-xs font-semibold">{option.label}</span>
+ </Button>
);
- }}
- className="flex-1 flex items-center justify-center gap-1.5 text-[10px] text-slate-500 hover:text-slate-300 py-1.5 transition-colors"
- >
- <Bug className="w-3 h-3 text-[#2563EB]" />
- {tSettings("export.reportBug")}
- </button>
- <button
- type="button"
- onClick={() => {
- window.electronAPI?.openExternalUrl("https://github.com/webadderall/Recordly");
- }}
- className="flex-1 flex items-center justify-center gap-1.5 text-[10px] text-slate-500 hover:text-slate-300 py-1.5 transition-colors"
- >
- <Star className="w-3 h-3 text-yellow-400" />
- {tSettings("export.starOnGithub")}
- </button>
+ })}
+ </div>
+ {!selectedSpeedId && <p className="mt-2 text-center text-[10px] text-slate-500">{tSettings("speed.selectRegion")}</p>}
+ {selectedSpeedId && (
+ <Button onClick={() => selectedSpeedId && onSpeedDelete?.(selectedSpeedId)} variant="destructive" size="sm" className="mt-2 h-8 w-full gap-2 border border-red-500/20 bg-red-500/10 text-xs text-red-400 transition-all hover:border-red-500/30 hover:bg-red-500/20">
+ <Trash2 className="h-3 w-3" />
+ {tSettings("speed.deleteRegion")}
+ </Button>
+ )}
</div>
</div>
</div>
diff --git a/src/components/video-editor/SliderControl.tsx b/src/components/video-editor/SliderControl.tsx
index 7025bc65..358658a8 100644
--- a/src/components/video-editor/SliderControl.tsx
+++ b/src/components/video-editor/SliderControl.tsx
@@ -1,6 +1,4 @@
-import { useState, useRef, useEffect } from "react";
-import { Slider } from "@/components/ui/slider";
-import { RotateCcw } from "lucide-react";
+import { cn } from "@/lib/utils";
interface SliderControlProps {
label: string;
@@ -18,92 +16,51 @@ interface SliderControlProps {
export function SliderControl({
label,
value,
- defaultValue,
+ defaultValue: _defaultValue,
min,
max,
step,
onChange,
formatValue,
- parseInput,
+ parseInput: _parseInput,
accentColor = "blue",
}: SliderControlProps) {
- const [editing, setEditing] = useState(false);
- const [editText, setEditText] = useState("");
- const inputRef = useRef<HTMLInputElement>(null);
- const isModified = value !== defaultValue;
-
- useEffect(() => {
- if (editing && inputRef.current) {
- inputRef.current.focus();
- inputRef.current.select();
- }
- }, [editing]);
-
- const commitEdit = () => {
- const parsed = parseInput(editText);
- if (parsed != null && !isNaN(parsed)) {
- onChange(Math.min(max, Math.max(min, parsed)));
- }
- setEditing(false);
- };
-
- const cancelEdit = () => {
- setEditing(false);
- };
+ const pct = Math.min(100, Math.max(0, ((value - min) / (max - min || 1)) * 100));
+ const dividerClass =
+ accentColor === "purple"
+ ? "bg-white/95 shadow-[0_0_10px_rgba(139,92,246,0.28)]"
+ : "bg-white/95 shadow-[0_0_10px_rgba(37,99,235,0.28)]";
return (
- <>
- <div className="flex items-center justify-between mb-1">
- <div className="flex items-center gap-1">
- <div className="text-[10px] font-medium text-slate-300">{label}</div>
- {isModified && (
- <button
- type="button"
- onClick={() => onChange(defaultValue)}
- className="text-slate-500 hover:text-slate-300 transition-colors"
- title="Reset to default"
- >
- <RotateCcw className="w-2.5 h-2.5" />
- </button>
- )}
- </div>
- {editing ? (
- <input
- ref={inputRef}
- type="text"
- value={editText}
- onChange={(e) => setEditText(e.target.value)}
- onBlur={commitEdit}
- onKeyDown={(e) => {
- if (e.key === "Enter") commitEdit();
- if (e.key === "Escape") cancelEdit();
- }}
- className="w-14 text-[10px] text-right font-mono bg-white/10 border border-white/20 rounded px-1 py-0 text-slate-200 outline-none focus:border-white/40"
- />
- ) : (
- <span
- className="text-[10px] text-slate-500 font-mono cursor-text hover:text-slate-300 transition-colors"
- onClick={() => {
- setEditText(formatValue(value));
- setEditing(true);
- }}
- >
- {formatValue(value)}
- </span>
+ <div className="relative flex h-10 w-full select-none items-center overflow-hidden rounded-xl bg-black/60 px-1.5">
+ <div
+ className="absolute inset-y-[3px] left-[3px] right-auto rounded-[10px] bg-white/[0.08] shadow-[0_4px_10px_0_rgba(0,0,0,0.18)] transition-none"
+ style={{
+ width: pct > 0 ? `max(calc(${pct}% - 6px), 2.1rem)` : 0,
+ }}
+ />
+ <div
+ className={cn(
+ "pointer-events-none absolute bottom-[18%] top-[18%] z-10 w-[2px] rounded-full transition-none",
+ dividerClass,
)}
- </div>
- <Slider
- value={[value]}
- onValueChange={(values) => onChange(values[0])}
+ style={{ left: `calc(${pct}% - 8px)` }}
+ />
+ <span className="pointer-events-none relative z-10 flex-1 pl-3 text-[12px] font-medium text-slate-300">
+ {label}
+ </span>
+ <span className="pointer-events-none relative z-10 pr-3 text-[12px] font-medium tabular-nums text-slate-100">
+ {formatValue(value)}
+ </span>
+ <input
+ type="range"
min={min}
max={max}
step={step}
- className={
- accentColor === "purple"
- ? "w-full [&_[role=slider]]:bg-[#8b5cf6] [&_[role=slider]]:border-[#8b5cf6] [&_[role=slider]]:h-3 [&_[role=slider]]:w-3"
- : "w-full [&_[role=slider]]:bg-[#2563EB] [&_[role=slider]]:border-[#2563EB] [&_[role=slider]]:h-3 [&_[role=slider]]:w-3"
- }
+ value={value}
+ onChange={(e) => onChange(Number(e.target.value))}
+ className="absolute inset-0 h-full w-full cursor-ew-resize opacity-0"
/>
- </>
+ </div>
);
}
diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsx
index 214b78da..55095024 100644
--- a/src/components/video-editor/VideoEditor.tsx
+++ b/src/components/video-editor/VideoEditor.tsx
@@ -1,8 +1,10 @@
import type { Span } from "dnd-timeline";
-import { FolderOpen, Languages } from "lucide-react";
+import { Camera, Download, FolderOpen, Languages, MousePointer2, Save, Sparkles } from "lucide-react";
+import { AnimatePresence, LayoutGroup, motion } from "motion/react";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
import { toast } from "sonner";
+import { Button } from "@/components/ui/button";
import { Toaster } from "@/components/ui/sonner";
import { useI18n } from "@/contexts/I18nContext";
import { useShortcuts } from "@/contexts/ShortcutsContext";
@@ -35,9 +37,10 @@ import {
toFileUrl,
validateProjectData,
} from "./projectPersistence";
-import { SettingsPanel } from "./SettingsPanel";
+import { type EditorEffectSection, SettingsPanel } from "./SettingsPanel";
import TimelineEditor from "./timeline/TimelineEditor";
import {
+ detectInteractionCandidates,
normalizeCursorTelemetry,
} from "./timeline/zoomSuggestionUtils";
import {
@@ -71,6 +74,16 @@ import { findDominantRegion } from "./videoPlayback/zoomRegionUtils";
const LOOP_CURSOR_END_WINDOW_MS = 670;
+const EDITOR_SECTION_BUTTONS: Array<{
+ id: EditorEffectSection;
+ label: string;
+ icon: React.ComponentType<{ className?: string }>;
+}> = [
+ { id: "scene", label: "Scene", icon: Sparkles },
+ { id: "cursor", label: "Cursor", icon: MousePointer2 },
+ { id: "webcam", label: "Webcam", icon: Camera },
+];
+
type EditorHistorySnapshot = {
zoomRegions: ZoomRegion[];
trimRegions: TrimRegion[];
@@ -160,7 +173,9 @@ export default function VideoEditor() {
const [exportProgress, setExportProgress] = useState<ExportProgress | null>(null);
const [exportError, setExportError] = useState<string | null>(null);
const [showExportDialog, setShowExportDialog] = useState(false);
+ const [previewVolume, setPreviewVolume] = useState(1);
const [aspectRatio, setAspectRatio] = useState<AspectRatio>(initialEditorPreferences.aspectRatio);
+ const [activeEffectSection, setActiveEffectSection] = useState<EditorEffectSection>("scene");
const [exportQuality, setExportQuality] = useState<ExportQuality>(
initialEditorPreferences.exportQuality,
);
@@ -188,6 +203,7 @@ export default function VideoEditor() {
const nextAnnotationIdRef = useRef(1);
const nextAnnotationZIndexRef = useRef(1); // Track z-index for stacking order
const exporterRef = useRef<VideoExporter | null>(null);
+ const autoSuggestedVideoPathRef = useRef<string | null>(null);
const historyPastRef = useRef<EditorHistorySnapshot[]>([]);
const historyFutureRef = useRef<EditorHistorySnapshot[]>([]);
const historyCurrentRef = useRef<EditorHistorySnapshot | null>(null);
@@ -209,6 +225,23 @@ export default function VideoEditor() {
};
}, []);
+ const gifOutputDimensions = useMemo(
+ () =>
+ calculateOutputDimensions(
+ videoPlaybackRef.current?.video?.videoWidth || 1920,
+ videoPlaybackRef.current?.video?.videoHeight || 1080,
+ gifSizePreset,
+ GIF_SIZE_PRESETS,
+ ),
+ [gifSizePreset, videoPath],
+ );
+
+ const projectDisplayName = useMemo(() => {
+ const fileName = currentProjectPath?.split(/[\\/]/).pop() ?? "";
+ const withoutExtension = fileName.replace(/\.recordly$/i, "").replace(/\.[^.]+$/, "");
+ return withoutExtension || "Untitled";
+ }, [currentProjectPath]);
+
const buildHistorySnapshot = useCallback((): EditorHistorySnapshot => {
return {
zoomRegions,
@@ -908,6 +941,84 @@ export default function VideoEditor() {
return [...zoomRegions.filter((region) => region.id !== loopEndRegion.id), loopEndRegion];
}, [loopCursor, zoomRegions, displayedTimelineWindow, connectZooms]);
+ useEffect(() => {
+ if (
+ !videoPath ||
+ duration <= 0 ||
+ zoomRegions.length > 0 ||
+ normalizedCursorTelemetry.length < 2
+ ) {
+ return;
+ }
+
+ if (autoSuggestedVideoPathRef.current === videoPath) {
+ return;
+ }
+
+ const totalMs = Math.max(0, Math.round(duration * 1000));
+ if (totalMs <= 0) {
+ return;
+ }
+
+ const candidates = detectInteractionCandidates(normalizedCursorTelemetry);
+ if (candidates.length === 0) {
+ autoSuggestedVideoPathRef.current = videoPath;
+ return;
+ }
+
+ const DEFAULT_DURATION_MS = 1100;
+ const MIN_SPACING_MS = 1800;
+ const sortedCandidates = [...candidates].sort((a, b) => b.strength - a.strength);
+ const acceptedCenters: number[] = [];
+
+ setZoomRegions((prev) => {
+ if (prev.length > 0) {
+ return prev;
+ }
+
+ const reservedSpans: Array<{ start: number; end: number }> = [];
+ const additions: ZoomRegion[] = [];
+ let nextId = nextZoomIdRef.current;
+
+ sortedCandidates.forEach((candidate) => {
+ const tooCloseToAccepted = acceptedCenters.some(
+ (center) => Math.abs(center - candidate.centerTimeMs) < MIN_SPACING_MS,
+ );
+ if (tooCloseToAccepted) {
+ return;
+ }
+
+ const centeredStart = Math.round(candidate.centerTimeMs - DEFAULT_DURATION_MS / 2);
+ const startMs = Math.max(0, Math.min(centeredStart, totalMs - DEFAULT_DURATION_MS));
+ const endMs = Math.min(totalMs, startMs + DEFAULT_DURATION_MS);
+
+ const hasOverlap = reservedSpans.some((span) => endMs > span.start && startMs < span.end);
+ if (hasOverlap) {
+ return;
+ }
+
+ additions.push({
+ id: `zoom-${nextId++}`,
+ startMs,
+ endMs,
+ depth: DEFAULT_ZOOM_DEPTH,
+ focus: clampFocusToDepth(candidate.focus, DEFAULT_ZOOM_DEPTH),
+ });
+ reservedSpans.push({ start: startMs, end: endMs });
+ acceptedCenters.push(candidate.centerTimeMs);
+ });
+
+ if (additions.length === 0) {
+ return prev;
+ }
+
+ nextZoomIdRef.current = nextId;
+ return [...prev, ...additions];
+ });
+
+ autoSuggestedVideoPathRef.current = videoPath;
+ }, [videoPath, duration, normalizedCursorTelemetry, zoomRegions.length]);
+
// Initialize default wallpaper with resolved asset path
useEffect(() => {
let mounted = true;
@@ -1824,14 +1935,25 @@ export default function VideoEditor() {
setExportError("Save dialog canceled. Click Save Again to save without re-rendering.");
return;
}
+ setShowExportDialog(true);
+ setExportProgress(null);
+ setExportError(null);
+ }, [
+ videoPath,
+ hasPendingExportSave,
+ ]);
+ const handleStartExportFromDialog = useCallback(() => {
const video = videoPlaybackRef.current?.video;
+ if (!videoPath) {
+ toast.error("No video loaded");
+ return;
+ }
if (!video) {
toast.error("Video not ready");
return;
}
- // Build export settings from current state
const sourceWidth = video.videoWidth || 1920;
const sourceHeight = video.videoHeight || 1080;
const gifDimensions = calculateOutputDimensions(
@@ -1856,21 +1978,9 @@ export default function VideoEditor() {
: undefined,
};
- setShowExportDialog(true);
setExportError(null);
-
- // Start export immediately
handleExport(settings);
- }, [
- videoPath,
- hasPendingExportSave,
- exportFormat,
- exportQuality,
- gifFrameRate,
- gifLoop,
- gifSizePreset,
- handleExport,
- ]);
+ }, [videoPath, exportFormat, exportQuality, gifFrameRate, gifLoop, gifSizePreset, handleExport]);
const handleCancelExport = useCallback(() => {
if (exporterRef.current) {
@@ -1886,6 +1996,8 @@ export default function VideoEditor() {
const handleExportDialogClose = useCallback(() => {
setShowExportDialog(false);
+ setExportProgress(null);
+ setExportError(null);
setExportedFilePath(undefined);
}, []);
@@ -1957,46 +2069,113 @@ export default function VideoEditor() {
}
return (
- <div className="flex flex-col h-screen bg-[#09090b] text-slate-200 overflow-hidden selection:bg-[#2563EB]/30">
+ <div className="flex flex-col h-screen bg-[#111113] text-slate-200 overflow-hidden selection:bg-[#2563EB]/30">
<div
- className="relative h-10 flex-shrink-0 bg-[#09090b]/80 backdrop-blur-md border-b border-white/5 flex items-center justify-center px-6 z-50"
+ className="relative h-11 flex-shrink-0 bg-[#151518]/88 backdrop-blur-md border-b border-white/10 flex items-center justify-center px-8 z-50"
style={{ WebkitAppRegion: "drag" } as React.CSSProperties}
>
- <span className="text-sm font-semibold tracking-tight text-white/90">Recordly</span>
+ <div className="flex items-baseline gap-1.5">
+ <span className="text-sm font-semibold tracking-tight text-white/90">{projectDisplayName}</span>
+ <span className="text-xs font-medium tracking-tight text-slate-500">.recordly</span>
+ </div>
<div
- className="absolute right-4 flex items-center gap-1"
+ className="absolute left-[88px] flex items-center gap-2"
+ style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}
+ >
+ <Button
+ type="button"
+ onClick={handleLoadProject}
+ className="inline-flex h-8 min-w-[96px] items-center justify-center gap-1.5 rounded-lg bg-white px-4 text-black transition-colors hover:bg-white/92"
+ >
+ <FolderOpen className="h-4 w-4" />
+ <span className="text-sm font-semibold tracking-tight">Load</span>
+ </Button>
+ <Button
+ type="button"
+ onClick={handleSaveProject}
+ className="inline-flex h-8 min-w-[96px] items-center justify-center gap-1.5 rounded-lg bg-white px-4 text-black transition-colors hover:bg-white/92"
+ >
+ <Save className="h-4 w-4" />
+ <span className="text-sm font-semibold tracking-tight">Save</span>
+ </Button>
+ </div>
+ <div
+ className="absolute right-5 flex items-center gap-2 pr-3"
style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}
>
<LanguageSwitcher />
<button
type="button"
onClick={() => void openRecordingsFolder()}
- className="inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-white/90 transition hover:bg-white/8 hover:text-white cursor-pointer"
+ className="inline-flex h-7 items-center justify-center rounded-md px-2 text-white/90 transition hover:bg-white/8 hover:text-white cursor-pointer"
title={t("common.app.manageRecordings", "Open recordings folder")}
aria-label={t("common.app.manageRecordings", "Open recordings folder")}
>
<FolderOpen className="h-4 w-4" />
- <span className="text-xs font-normal">
- {t("common.app.manageRecordings", "Manage recordings")}
- </span>
</button>
+ <Button
+ type="button"
+ onClick={handleOpenExportDialog}
+ className="inline-flex h-8 min-w-[112px] items-center justify-center gap-2 rounded-lg bg-[#2563EB] px-4.5 text-white transition-colors hover:bg-[#2563EB]/92"
+ >
+ <Download className="h-4 w-4" />
+ <span className="text-sm font-semibold tracking-tight">Export</span>
+ </Button>
</div>
</div>
- <div className="flex-1 p-5 gap-4 flex min-h-0 relative">
+ <div className="relative flex min-h-0 flex-1 gap-3 p-4">
{/* Left Column - Video & Timeline */}
- <div className="flex-[7] flex flex-col gap-3 min-w-0 h-full">
+ <div className="order-2 flex h-full min-w-0 flex-[7] flex-col gap-3">
<PanelGroup direction="vertical" className="gap-3">
{/* Top section: video preview and controls */}
- <Panel defaultSize={70} minSize={40}>
- <div className="w-full h-full flex flex-col items-center justify-center bg-black/40 rounded-2xl border border-white/5 shadow-2xl overflow-hidden">
+ <Panel defaultSize={67} minSize={40}>
+ <div className="relative flex h-full flex-col overflow-hidden">
{/* Video preview */}
<div
- className="w-full flex justify-center items-center"
+ className="flex w-full min-h-0 flex-1 items-stretch"
style={{ flex: "1 1 auto", margin: "6px 0 0" }}
>
- <div
- className="relative"
+ <div className="flex w-11 flex-shrink-0 items-center justify-center pl-1">
+ <LayoutGroup id="preview-icon-rail">
+ <div className="flex flex-col items-center gap-3">
+ {EDITOR_SECTION_BUTTONS.map((section) => {
+ const Icon = section.icon;
+ const isActive = activeEffectSection === section.id;
+ return (
+ <motion.button
+ key={section.id}
+ type="button"
+ onClick={() => setActiveEffectSection(section.id)}
+ title={section.label}
+ className="group relative flex h-8 w-8 items-center justify-center text-white/75 outline-none transition-colors hover:text-white focus:outline-none focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0"
+ animate={{ scale: isActive ? 1.06 : 1, opacity: isActive ? 1 : 0.82 }}
+ transition={{ type: "spring", stiffness: 420, damping: 28 }}
+ >
+ <motion.span animate={{ color: isActive ? "#2563EB" : "rgba(255,255,255,0.75)" }} transition={{ duration: 0.16 }}>
+ <Icon className="h-4 w-4" />
+ </motion.span>
+ <AnimatePresence initial={false}>
+ {isActive ? (
+ <motion.span
+ layoutId="preview-active-dot"
+ className="absolute -left-1 h-1.5 w-1.5 rounded-full bg-[#2563EB]"
+ initial={{ opacity: 0, scale: 0.6 }}
+ animate={{ opacity: 1, scale: 1 }}
+ exit={{ opacity: 0, scale: 0.6 }}
+ transition={{ type: "spring", stiffness: 500, damping: 32 }}
+ />
+ ) : null}
+ </AnimatePresence>
+ </motion.button>
+ );
+ })}
+ </div>
+ </LayoutGroup>
+ </div>
+ <div className="flex min-w-0 flex-1 items-center justify-center pl-2 pr-1">
+ <div
+ className="relative overflow-hidden rounded-[30px]"
style={{
width: "auto",
height: "100%",
@@ -2055,7 +2234,9 @@ export default function VideoEditor() {
cursorMotionBlur={cursorMotionBlur}
cursorClickBounce={cursorClickBounce}
cursorSway={cursorSway}
+ volume={previewVolume}
/>
+ </div>
</div>
</div>
{/* Playback controls */}
@@ -2075,19 +2256,21 @@ export default function VideoEditor() {
duration={duration}
onTogglePlayPause={togglePlayPause}
onSeek={handleSeek}
+ volume={previewVolume}
+ onVolumeChange={setPreviewVolume}
/>
</div>
</div>
</div>
</Panel>
- <PanelResizeHandle className="h-3 bg-[#09090b]/80 hover:bg-[#09090b] transition-colors rounded-full mx-4 flex items-center justify-center">
+ <PanelResizeHandle className="h-3 bg-transparent transition-colors mx-4 flex items-center justify-center">
<div className="w-8 h-1 bg-white/20 rounded-full"></div>
</PanelResizeHandle>
{/* Timeline section */}
- <Panel defaultSize={30} minSize={20}>
- <div className="h-full min-h-0 bg-[#09090b] rounded-2xl border border-white/5 shadow-lg overflow-auto flex flex-col">
+ <Panel defaultSize={33} minSize={20}>
+ <div className="h-full min-h-0 bg-[#17171a] rounded-2xl border border-white/10 shadow-lg overflow-auto flex flex-col">
<TimelineEditor
videoDuration={duration}
currentTime={currentTime}
@@ -2132,8 +2315,11 @@ export default function VideoEditor() {
</PanelGroup>
</div>
- {/* Right section: settings panel */}
- <SettingsPanel
+ {/* Left section: settings panel */}
+ <div className="order-1 flex">
+ <SettingsPanel
+ panelMode="editor"
+ activeEffectSection={activeEffectSection}
selected={wallpaper}
onWallpaperChange={setWallpaper}
selectedZoomDepth={
@@ -2179,23 +2365,6 @@ export default function VideoEditor() {
aspectRatio={aspectRatio}
onAspectRatioChange={setAspectRatio}
videoElement={videoPlaybackRef.current?.video || null}
- exportQuality={exportQuality}
- onExportQualityChange={setExportQuality}
- exportFormat={exportFormat}
- onExportFormatChange={setExportFormat}
- gifFrameRate={gifFrameRate}
- onGifFrameRateChange={setGifFrameRate}
- gifLoop={gifLoop}
- onGifLoopChange={setGifLoop}
- gifSizePreset={gifSizePreset}
- onGifSizePresetChange={setGifSizePreset}
- gifOutputDimensions={calculateOutputDimensions(
- videoPlaybackRef.current?.video?.videoWidth || 1920,
- videoPlaybackRef.current?.video?.videoHeight || 1080,
- gifSizePreset,
- GIF_SIZE_PRESETS,
- )}
- onExport={handleOpenExportDialog}
selectedAnnotationId={selectedAnnotationId}
annotationRegions={annotationRegions}
onAnnotationContentChange={handleAnnotationContentChange}
@@ -2203,8 +2372,6 @@ export default function VideoEditor() {
onAnnotationStyleChange={handleAnnotationStyleChange}
onAnnotationFigureDataChange={handleAnnotationFigureDataChange}
onAnnotationDelete={handleAnnotationDelete}
- onSaveProject={handleSaveProject}
- onLoadProject={handleLoadProject}
selectedSpeedId={selectedSpeedId}
selectedSpeedValue={
selectedSpeedId
@@ -2213,7 +2380,8 @@ export default function VideoEditor() {
}
onSpeedChange={handleSpeedChange}
onSpeedDelete={handleSpeedDelete}
- />
+ />
+ </div>
</div>
<Toaster theme="dark" className="pointer-events-auto" />
@@ -2229,6 +2397,19 @@ export default function VideoEditor() {
canRetrySave={hasPendingExportSave}
exportFormat={exportFormat}
exportedFilePath={exportedFilePath}
+ exportQuality={exportQuality}
+ onExportQualityChange={setExportQuality}
+ onExportFormatChange={setExportFormat}
+ gifFrameRate={gifFrameRate}
+ onGifFrameRateChange={setGifFrameRate}
+ gifLoop={gifLoop}
+ onGifLoopChange={setGifLoop}
+ gifSizePreset={gifSizePreset}
+ onGifSizePresetChange={setGifSizePreset}
+ gifOutputDimensions={gifOutputDimensions}
+ onLoadProject={handleLoadProject}
+ onSaveProject={handleSaveProject}
+ onStartExport={handleStartExportFromDialog}
/>
</div>
);
diff --git a/src/components/video-editor/VideoPlayback.tsx b/src/components/video-editor/VideoPlayback.tsx
index de3c58a0..5ac210a0 100644
--- a/src/components/video-editor/VideoPlayback.tsx
+++ b/src/components/video-editor/VideoPlayback.tsx
@@ -137,6 +137,7 @@ interface VideoPlaybackProps {
cursorMotionBlur?: number;
cursorClickBounce?: number;
cursorSway?: number;
+ volume?: number;
}
export interface VideoPlaybackRef {
@@ -190,6 +191,7 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
cursorMotionBlur = DEFAULT_CURSOR_MOTION_BLUR,
cursorClickBounce = DEFAULT_CURSOR_CLICK_BOUNCE,
cursorSway = DEFAULT_CURSOR_SWAY,
+ volume = 1,
},
ref,
) => {
@@ -385,6 +387,15 @@ const VideoPlayback = forwardRef<VideoPlaybackRef, VideoPlaybackProps>(
}
}, [updateOverlayForRegion, cropRegion, borderRadius, padding, applyWebcamBubbleLayout]);
+ useEffect(() => {
+ const video = videoRef.current;
+ if (!video) return;
+
+ const nextVolume = Math.max(0, Math.min(1, volume));
+ video.volume = nextVolume;
+ video.muted = nextVolume <= 0.001;
+ }, [volume, videoPath]);
+
useEffect(() => {
layoutVideoContentRef.current = layoutVideoContent;
}, [layoutVideoContent]);
diff --git a/src/components/video-editor/timeline/Item.tsx b/src/components/video-editor/timeline/Item.tsx
index 50670f4c..cc387ea9 100644
--- a/src/components/video-editor/timeline/Item.tsx
+++ b/src/components/video-editor/timeline/Item.tsx
@@ -84,8 +84,8 @@ export default function Item({
[span.start, span.end],
);
- const MIN_ITEM_PX = 6;
- const safeItemStyle = { ...itemStyle, minWidth: MIN_ITEM_PX };
+ const MIN_ITEM_PX = 6;
+ const safeItemStyle = { ...itemStyle, minWidth: MIN_ITEM_PX, height: "100%" };
return (
<div
@@ -94,16 +94,16 @@ export default function Item({
{...listeners}
{...attributes}
onPointerDownCapture={() => onSelect?.()}
- className="group"
+ className="group h-full"
>
- <div style={{ ...itemContentStyle, minWidth: 24 }}>
+ <div className="h-full" style={{ ...itemContentStyle, minWidth: 24, height: "100%" }}>
<div
className={cn(
glassClass,
"w-full h-full overflow-hidden flex items-center justify-center gap-1.5 cursor-grab active:cursor-grabbing relative",
isSelected && glassStyles.selected
)}
- style={{ height: 40, color: '#fff', minWidth: 24 }}
+ style={{ height: "100%", minHeight: 22, color: '#fff', minWidth: 24 }}
onClick={(event) => {
event.stopPropagation();
onSelect?.();
diff --git a/src/components/video-editor/timeline/ItemGlass.module.css b/src/components/video-editor/timeline/ItemGlass.module.css
index 9c96ea22..95cfe5e3 100644
--- a/src/components/video-editor/timeline/ItemGlass.module.css
+++ b/src/components/video-editor/timeline/ItemGlass.module.css
@@ -5,7 +5,7 @@
background: rgba(37, 99, 235, 0.15);
border: 1px solid rgba(37, 99, 235, 0.3);
box-shadow: 0 2px 12px 0 rgba(37, 99, 235, 0.1) inset;
- margin: 2px 0;
+ margin: 1px 0;
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
@@ -31,7 +31,7 @@
background: rgba(239, 68, 68, 0.15);
border: 1px solid rgba(239, 68, 68, 0.3);
box-shadow: 0 2px 12px 0 rgba(239, 68, 68, 0.1) inset;
- margin: 2px 0;
+ margin: 1px 0;
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
@@ -57,7 +57,7 @@
background: rgba(180, 160, 70, 0.15);
border: 1px solid rgba(180, 160, 70, 0.3);
box-shadow: 0 2px 12px 0 rgba(180, 160, 70, 0.1) inset;
- margin: 2px 0;
+ margin: 1px 0;
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
@@ -83,7 +83,7 @@
background: rgba(245, 158, 11, 0.15);
border: 1px solid rgba(245, 158, 11, 0.3);
box-shadow: 0 2px 12px 0 rgba(245, 158, 11, 0.1) inset;
- margin: 2px 0;
+ margin: 1px 0;
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
@@ -109,7 +109,7 @@
background: rgba(168, 85, 247, 0.15);
border: 1px solid rgba(168, 85, 247, 0.3);
box-shadow: 0 2px 12px 0 rgba(168, 85, 247, 0.1) inset;
- margin: 2px 0;
+ margin: 1px 0;
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
diff --git a/src/components/video-editor/timeline/Row.tsx b/src/components/video-editor/timeline/Row.tsx
index 2e22621d..434aab29 100644
--- a/src/components/video-editor/timeline/Row.tsx
+++ b/src/components/video-editor/timeline/Row.tsx
@@ -14,8 +14,8 @@ export default function Row({ id, children, label, hint, isEmpty, labelColor = '
return (
<div
- className="border-b border-[#18181b] bg-[#18181b] relative"
- style={{ ...rowWrapperStyle, minHeight: 48, marginBottom: 4 }}
+ className="border-b border-[#18181b] bg-[#18181b] relative flex-1 min-h-[26px]"
+ style={{ ...rowWrapperStyle, marginBottom: 2 }}
>
{label && (
<div
@@ -30,7 +30,7 @@ export default function Row({ id, children, label, hint, isEmpty, labelColor = '
<span className="text-[11px] text-white/15 font-medium">{hint}</span>
</div>
)}
- <div ref={setNodeRef} style={rowStyle}>
+ <div ref={setNodeRef} className="relative h-full min-h-0" style={rowStyle}>
{children}
</div>
</div>
diff --git a/src/components/video-editor/timeline/Subrow.tsx b/src/components/video-editor/timeline/Subrow.tsx
index ffc78605..18695536 100644
--- a/src/components/video-editor/timeline/Subrow.tsx
+++ b/src/components/video-editor/timeline/Subrow.tsx
@@ -5,7 +5,7 @@ interface SubrowProps {
export default function Subrow({ children }: SubrowProps) {
return (
- <div className={cn("flex items-center min-h-[32px] gap-1 px-2 py-0.5 bg-[#23232a] rounded-md text-slate-300")}>
+ <div className={cn("flex items-center min-h-[24px] gap-1 px-1.5 py-0 bg-[#23232a] rounded-md text-slate-300")}>
{children}
</div>
);
diff --git a/src/components/video-editor/timeline/TimelineEditor.tsx b/src/components/video-editor/timeline/TimelineEditor.tsx
index 36977b0e..c49e75ae 100644
--- a/src/components/video-editor/timeline/TimelineEditor.tsx
+++ b/src/components/video-editor/timeline/TimelineEditor.tsx
@@ -385,7 +385,7 @@ function TimelineAxis({
return (
<div
- className="h-8 bg-[#09090b] border-b border-white/5 relative overflow-hidden select-none"
+ className="h-8 bg-[#161619] border-b border-white/10 relative overflow-hidden select-none"
style={{
[sideProperty === "right" ? "marginRight" : "marginLeft"]: `${sidebarWidth}px`,
}}
@@ -513,7 +513,7 @@ function Timeline({
<div
ref={setRefs}
style={style}
- className="select-none bg-[#09090b] min-h-[140px] relative cursor-pointer group"
+ className="select-none bg-[#17171a] h-full min-h-0 relative cursor-pointer group flex flex-col"
onClick={handleTimelineClick}
>
<div className="absolute inset-0 bg-[linear-gradient(to_right,#ffffff03_1px,transparent_1px)] bg-[length:20px_100%] pointer-events-none" />
@@ -526,91 +526,93 @@ function Timeline({
keyframes={keyframes}
/>
- <Row id={ZOOM_ROW_ID} isEmpty={zoomItems.length === 0} hint="Press Z to add zoom">
- {zoomItems.map((item) => (
- <Item
- id={item.id}
- key={item.id}
- rowId={item.rowId}
- span={item.span}
- isSelected={item.id === selectedZoomId}
- onSelect={() => onSelectZoom?.(item.id)}
- zoomDepth={item.zoomDepth}
- variant="zoom"
- >
- {item.label}
- </Item>
- ))}
- </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={item.id === selectedTrimId}
- onSelect={() => onSelectTrim?.(item.id)}
- variant="trim"
- >
- {item.label}
- </Item>
- ))}
- </Row>
-
- <Row
- id={ANNOTATION_ROW_ID}
- isEmpty={annotationItems.length === 0}
- hint="Press A to add annotation"
- >
- {annotationItems.map((item) => (
- <Item
- id={item.id}
- key={item.id}
- rowId={item.rowId}
- span={item.span}
- isSelected={item.id === selectedAnnotationId}
- onSelect={() => onSelectAnnotation?.(item.id)}
- variant="annotation"
- >
- {item.label}
- </Item>
- ))}
- </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={item.id === selectedSpeedId}
- onSelect={() => onSelectSpeed?.(item.id)}
- variant="speed"
- speedValue={item.speedValue}
- >
- {item.label}
- </Item>
- ))}
- </Row>
-
- <Row id={AUDIO_ROW_ID} isEmpty={audioItems.length === 0} hint="Click music icon to add audio">
- {audioItems.map((item) => (
- <Item
- id={item.id}
- key={item.id}
- rowId={item.rowId}
- span={item.span}
- isSelected={item.id === selectedAudioId}
- onSelect={() => onSelectAudio?.(item.id)}
- variant="audio"
- >
- {item.label}
- </Item>
- ))}
- </Row>
+ <div className="relative z-10 flex flex-1 min-h-0 flex-col">
+ <Row id={ZOOM_ROW_ID} isEmpty={zoomItems.length === 0} hint="Press Z to add zoom">
+ {zoomItems.map((item) => (
+ <Item
+ id={item.id}
+ key={item.id}
+ rowId={item.rowId}
+ span={item.span}
+ isSelected={item.id === selectedZoomId}
+ onSelect={() => onSelectZoom?.(item.id)}
+ zoomDepth={item.zoomDepth}
+ variant="zoom"
+ >
+ {item.label}
+ </Item>
+ ))}
+ </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={item.id === selectedTrimId}
+ onSelect={() => onSelectTrim?.(item.id)}
+ variant="trim"
+ >
+ {item.label}
+ </Item>
+ ))}
+ </Row>
+
+ <Row
+ id={ANNOTATION_ROW_ID}
+ isEmpty={annotationItems.length === 0}
+ hint="Press A to add annotation"
+ >
+ {annotationItems.map((item) => (
+ <Item
+ id={item.id}
+ key={item.id}
+ rowId={item.rowId}
+ span={item.span}
+ isSelected={item.id === selectedAnnotationId}
+ onSelect={() => onSelectAnnotation?.(item.id)}
+ variant="annotation"
+ >
+ {item.label}
+ </Item>
+ ))}
+ </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={item.id === selectedSpeedId}
+ onSelect={() => onSelectSpeed?.(item.id)}
+ variant="speed"
+ speedValue={item.speedValue}
+ >
+ {item.label}
+ </Item>
+ ))}
+ </Row>
+
+ <Row id={AUDIO_ROW_ID} isEmpty={audioItems.length === 0} hint="Click music icon to add audio">
+ {audioItems.map((item) => (
+ <Item
+ id={item.id}
+ key={item.id}
+ rowId={item.rowId}
+ span={item.span}
+ isSelected={item.id === selectedAudioId}
+ onSelect={() => onSelectAudio?.(item.id)}
+ variant="audio"
+ >
+ {item.label}
+ </Item>
+ ))}
+ </Row>
+ </div>
</div>
);
}
@@ -675,6 +677,10 @@ export default function TimelineEditor({
const timelineContainerRef = useRef<HTMLDivElement>(null);
const { shortcuts: keyShortcuts, isMac } = useShortcuts();
+ useEffect(() => {
+ setRange(createInitialRange(totalMs));
+ }, [totalMs]);
+
useEffect(() => {
if (aspectRatio === 'native') {
return;
@@ -1340,7 +1346,7 @@ export default function TimelineEditor({
if (!videoDuration || videoDuration === 0) {
return (
- <div className="flex-1 flex flex-col items-center justify-center rounded-lg bg-[#09090b] gap-3">
+ <div className="flex-1 flex flex-col items-center justify-center rounded-lg bg-[#17171a] gap-3">
<div className="w-12 h-12 rounded-full bg-white/5 flex items-center justify-center">
<Plus className="w-6 h-6 text-slate-600" />
</div>
@@ -1353,8 +1359,8 @@ export default function TimelineEditor({
}
return (
- <div className="flex-1 min-h-0 flex flex-col bg-[#09090b] overflow-auto">
- <div className="flex items-center gap-2 px-4 py-2 border-b border-white/5 bg-[#09090b]">
+ <div className="flex-1 min-h-0 flex flex-col bg-[#17171a] overflow-auto">
+ <div className="flex items-center gap-2 px-4 py-2 border-b border-white/10 bg-[#161619]">
<div className="flex items-center gap-1">
<Button
onClick={handleAddZoom}
@@ -1423,7 +1429,7 @@ export default function TimelineEditor({
<ChevronDown className="w-3 h-3" />
</Button>
</DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="bg-[#1a1a1a] border-white/10">
+ <DropdownMenuContent align="end" className="bg-[#1a1a1c] border-white/10">
{ASPECT_RATIOS.map((ratio) => (
<DropdownMenuItem
key={ratio}
@@ -1489,7 +1495,7 @@ export default function TimelineEditor({
</div>
<div
ref={timelineContainerRef}
- className="flex-1 min-h-0 overflow-auto bg-[#09090b] relative"
+ className="flex-1 min-h-0 overflow-auto bg-[#17171a] relative"
onClick={() => setSelectedKeyframeId(null)}
onWheel={handleTimelineWheel}
>
diff --git a/src/components/video-editor/timeline/TimelineWrapper.tsx b/src/components/video-editor/timeline/TimelineWrapper.tsx
index cb53a65b..a40f9a14 100644
--- a/src/components/video-editor/timeline/TimelineWrapper.tsx
+++ b/src/components/video-editor/timeline/TimelineWrapper.tsx
@@ -297,7 +297,7 @@ export default function TimelineWrapper({
onDragEnd={onDragEndWithTooltip}
autoScroll={{ enabled: false }}
>
- <div className="relative">
+ <div className="relative h-full min-h-0">
{children}
{/* Floating tooltip shown during drag/resize */}
<div