OpenReel Video - Professional browser-based video editor. Open source CapCut alternative. 100% browser-based, no installation, no cloud uploads, no watermarks.
TypeScript
fix(editor): unify inspector sections to use accordion pattern
Augustus Otu39643fd22f60
diff --git a/apps/web/src/components/editor/InspectorPanel.tsx b/apps/web/src/components/editor/InspectorPanel.tsxindex 0e936352..9690299f 100644--- a/apps/web/src/components/editor/InspectorPanel.tsx+++ b/apps/web/src/components/editor/InspectorPanel.tsx@@ -621,95 +621,85 @@ export const InspectorPanel: React.FC = () => {</p></div>- {/* Generate Subtitles Section - Video clips only - Prominent position */}{clipType === "video" && (- <div className="mb-4 p-3 bg-primary/10 rounded-lg border border-primary/30">- <div className="flex items-center gap-2 mb-3">- <Captions size={14} className="text-primary" />- <span className="text-xs font-bold text-primary">- AI Auto-Captions- </span>- </div>-- {/* Animation Style Selector */}- <div className="mb-3">- <label className="text-[10px] text-text-secondary block mb-1">- Animation Style- </label>- <Select- value={defaultAnimationStyle}- onValueChange={(v) => setDefaultAnimationStyle(v as CaptionAnimationStyle)}- disabled={isTranscribing}- >- <SelectTrigger className="w-full bg-background-secondary border-border text-text-primary text-[11px]">- <SelectValue />- </SelectTrigger>- <SelectContent className="bg-background-secondary border-border">- {CAPTION_ANIMATION_STYLES.map((style) => (- <SelectItem key={style} value={style}>- {getAnimationStyleDisplayName(style)}- </SelectItem>- ))}- </SelectContent>- </Select>- </div>+ <Section title="AI Auto-Captions" sectionId="auto-captions" defaultOpen={false}>+ <div className="space-y-3">+ <div>+ <label className="text-[10px] text-text-secondary block mb-1">+ Animation Style+ </label>+ <Select+ value={defaultAnimationStyle}+ onValueChange={(v) => setDefaultAnimationStyle(v as CaptionAnimationStyle)}+ disabled={isTranscribing}+ >+ <SelectTrigger className="w-full bg-background-secondary border-border text-text-primary text-[11px]">+ <SelectValue />+ </SelectTrigger>+ <SelectContent className="bg-background-secondary border-border">+ {CAPTION_ANIMATION_STYLES.map((style) => (+ <SelectItem key={style} value={style}>+ {getAnimationStyleDisplayName(style)}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div>- {transcriptionProgress ? (- <div className="space-y-2">- <div className="flex items-center gap-2">- <Loader2- size={12}- className="animate-spin text-primary"- />- <span className="text-[10px] text-text-primary">- {transcriptionProgress.message}- </span>- </div>- <div className="h-1.5 bg-background-tertiary rounded-full overflow-hidden">- <div- className={`h-full transition-all duration-300 ${- transcriptionProgress.phase === "error"- ? "bg-red-500"- : transcriptionProgress.phase === "complete"- ? "bg-green-500"- : "bg-primary"- }`}- style={{ width: `${transcriptionProgress.progress}%` }}- />+ {transcriptionProgress ? (+ <div className="space-y-2">+ <div className="flex items-center gap-2">+ <Loader2+ size={12}+ className="animate-spin text-primary"+ />+ <span className="text-[10px] text-text-primary">+ {transcriptionProgress.message}+ </span>+ </div>+ <div className="h-1.5 bg-background-tertiary rounded-full overflow-hidden">+ <div+ className={`h-full transition-all duration-300 ${+ transcriptionProgress.phase === "error"+ ? "bg-red-500"+ : transcriptionProgress.phase === "complete"+ ? "bg-green-500"+ : "bg-primary"+ }`}+ style={{ width: `${transcriptionProgress.progress}%` }}+ />+ </div></div>- </div>- ) : (- <button- onClick={handleGenerateSubtitles}- disabled={isTranscribing}- className="w-full py-2 bg-primary hover:bg-primary/80 text-black rounded-lg text-[11px] font-medium transition-all flex items-center justify-center gap-2"- >- <Captions size={14} />- Generate Captions- </button>- )}- </div>+ ) : (+ <button+ onClick={handleGenerateSubtitles}+ disabled={isTranscribing}+ className="w-full py-2 bg-primary hover:bg-primary/80 text-black rounded-lg text-[11px] font-medium transition-all flex items-center justify-center gap-2"+ >+ <Captions size={14} />+ Generate Captions+ </button>+ )}+ </div>+ </Section>)}- {/* AI Background Removal - Video clips only */}{clipType === "video" && (- <div className="mb-4">+ <Section title="Background Removal" sectionId="background-removal" defaultOpen={false}><BackgroundRemovalSection clipId={clipId} />- </div>+ </Section>)}- {/* AI Auto Reframe - Video clips only */}{clipType === "video" && (- <div className="mb-4">+ <Section title="Auto Reframe" sectionId="auto-reframe" defaultOpen={false}><AutoReframeSection clipId={clipId} />- </div>+ </Section>)}- {/* AI Auto Cut Silence - Video and Audio clips */}{showAudioEffects && (- <div className="mb-4">+ <Section title="Auto Cut Silence" sectionId="auto-cut-silence" defaultOpen={false}><AutoCutSilenceSection clipId={clipId} />- </div>+ </Section>)}{/* Beat Sync - Sync other clips to this audio's beats */}diff --git a/apps/web/src/components/editor/inspector/AutoCutSilenceSection.tsx b/apps/web/src/components/editor/inspector/AutoCutSilenceSection.tsxindex 7e792f9f..c07cba25 100644--- a/apps/web/src/components/editor/inspector/AutoCutSilenceSection.tsx+++ b/apps/web/src/components/editor/inspector/AutoCutSilenceSection.tsx@@ -114,21 +114,7 @@ export const AutoCutSilenceSection: React.FC<AutoCutSilenceSectionProps> = ({return (<div className="space-y-3">- <div className="flex items-center justify-between p-2 bg-primary/10 rounded-lg border border-primary/30">- <div className="flex items-center gap-2">- <Scissors size={16} className="text-primary" />- <div>- <span className="text-[11px] font-medium text-text-primary">- Auto Cut Silence- </span>- <p className="text-[9px] text-text-muted">- Remove silent sections automatically- </p>- </div>- </div>- </div>-- <div className="space-y-3 p-3 bg-background-tertiary rounded-lg">+ <div className="space-y-3"><div><div className="flex items-center justify-between mb-1"><label className="text-[10px] text-text-secondary flex items-center gap-1">diff --git a/apps/web/src/components/editor/inspector/AutoReframeSection.tsx b/apps/web/src/components/editor/inspector/AutoReframeSection.tsxindex 32a16437..a0b139b3 100644--- a/apps/web/src/components/editor/inspector/AutoReframeSection.tsx+++ b/apps/web/src/components/editor/inspector/AutoReframeSection.tsx@@ -1,6 +1,5 @@import React, { useState, useCallback, useEffect } from "react";import {- Maximize2,Smartphone,Monitor,Square,@@ -198,21 +197,7 @@ export const AutoReframeSection: React.FC<AutoReframeSectionProps> = ({return (<div className="space-y-3">- <div className="flex items-center justify-between p-2 bg-primary/10 rounded-lg border border-primary/30">- <div className="flex items-center gap-2">- <Maximize2 size={16} className="text-primary" />- <div>- <span className="text-[11px] font-medium text-text-primary">- Auto Reframe- </span>- <p className="text-[9px] text-text-muted">- Smart crop for any platform- </p>- </div>- </div>- </div>-- <div className="space-y-3 p-3 bg-background-tertiary rounded-lg">+ <div className="space-y-3"><div><label className="text-[10px] text-text-secondary block mb-2">Platform Presetsdiff --git a/apps/web/src/components/editor/inspector/BackgroundRemovalSection.tsx b/apps/web/src/components/editor/inspector/BackgroundRemovalSection.tsxindex 199c0dab..baeebbd1 100644--- a/apps/web/src/components/editor/inspector/BackgroundRemovalSection.tsx+++ b/apps/web/src/components/editor/inspector/BackgroundRemovalSection.tsx@@ -150,18 +150,7 @@ export const BackgroundRemovalSection: React.FC<return (<div className="space-y-3">- <div className="flex items-center justify-between p-2 bg-primary/10 rounded-lg border border-primary/30">- <div className="flex items-center gap-2">- <User size={16} className="text-primary" />- <div>- <span className="text-[11px] font-medium text-text-primary">- Background Removal- </span>- <p className="text-[9px] text-text-muted">- AI-powered background effects- </p>- </div>- </div>+ <div className="flex justify-end"><buttononClick={handleToggleEnabled}disabled={isInitializing || isProcessing}diff --git a/apps/web/src/components/editor/inspector/MotionPresetsPanel.tsx b/apps/web/src/components/editor/inspector/MotionPresetsPanel.tsxindex 2cc23ee1..c433d818 100644--- a/apps/web/src/components/editor/inspector/MotionPresetsPanel.tsx+++ b/apps/web/src/components/editor/inspector/MotionPresetsPanel.tsx@@ -534,18 +534,6 @@ export const MotionPresetsPanel: React.FC<MotionPresetsPanelProps> = ({return (<div className="space-y-4">- <div className="flex items-center gap-2 p-2 bg-primary/10 rounded-lg border border-primary/30">- <Zap size={16} className="text-primary" />- <div>- <span className="text-[11px] font-medium text-text-primary">- Motion Presets- </span>- <p className="text-[9px] text-text-muted">- Animate clips with presets- </p>- </div>- </div>-{(appliedState.entrance ||appliedState.exit ||appliedState.emphasis) && (diff --git a/apps/web/src/components/editor/inspector/ParticleEffectsSection.tsx b/apps/web/src/components/editor/inspector/ParticleEffectsSection.tsxindex 10378b81..3e6771e4 100644--- a/apps/web/src/components/editor/inspector/ParticleEffectsSection.tsx+++ b/apps/web/src/components/editor/inspector/ParticleEffectsSection.tsx@@ -122,14 +122,9 @@ export const ParticleEffectsSection: React.FC<ParticleEffectsSectionProps> = ({return (<div className="space-y-4">- <div className="flex items-center gap-2 text-text-primary">- <Sparkles size={16} className="text-primary" />- <span className="text-sm font-semibold">Particle Effects</span>- </div>-<div className="flex gap-2"><Select value={selectedPreset} onValueChange={setSelectedPreset}>- <SelectTrigger className="flex-1 h-8 text-xs">+ <SelectTrigger className="flex-1 h-8 text-xs min-w-0 [&>span]:truncate"><SelectValue placeholder="Select effect preset..." /></SelectTrigger><SelectContent>@@ -139,13 +134,8 @@ export const ParticleEffectsSection: React.FC<ParticleEffectsSectionProps> = ({{type}</div>{presets.map((preset) => (- <SelectItem key={preset.id} value={preset.id}>- <div className="flex flex-col">- <span>{preset.name}</span>- <span className="text-[10px] text-text-muted">- {preset.description}- </span>- </div>+ <SelectItem key={preset.id} value={preset.id} textValue={preset.name}>+ {preset.name}</SelectItem>))}</div>