Fixes #69. The subtitle modal lets the user edit the caption text, but the edits only traveled through the in-browser Remotion path; the FFmpeg path (taken by every karaoke style and by any clip with server burns, i.e. all clips with default captions) sent style params only, so the server regenerated from the stored transcript and silently discarded the edits. /api/subtitle now accepts an optional 'words' list (clip-relative ms, the same shape the /transcript endpoint serves) and builds a synthetic transcript from it, so both the SRT and karaoke ASS generators burn the edited words verbatim. Words get Whisper's leading-space convention so the block collector keeps their boundaries. The modal sends them only when the text actually differs, and never on bulk apply-to-all (edits are per-clip). Verified live: an edited 5-word line burned exactly as typed, correctly grouped into blocks.
507 lines
28 KiB
JavaScript
507 lines
28 KiB
JavaScript
import React, { useState, useEffect } from 'react';
|
|
import { Loader2 } from 'lucide-react';
|
|
import { apiFetch } from '../lib/api';
|
|
import RemotionPreview from './RemotionPreview';
|
|
import Modal from './ui/Modal';
|
|
import SegmentedControl from './ui/SegmentedControl';
|
|
|
|
const FONT_OPTIONS = [
|
|
{ value: 'Verdana', label: 'Verdana' },
|
|
{ value: 'Arial', label: 'Arial' },
|
|
{ value: 'Impact', label: 'Impact' },
|
|
{ value: 'Helvetica', label: 'Helvetica' },
|
|
{ value: 'Georgia', label: 'Georgia' },
|
|
{ value: 'Courier New', label: 'Courier New' },
|
|
];
|
|
|
|
const COLOR_PRESETS = [
|
|
{ color: '#FFFFFF', label: 'White' },
|
|
{ color: '#FFFF00', label: 'Yellow' },
|
|
{ color: '#00FFFF', label: 'Cyan' },
|
|
{ color: '#00FF00', label: 'Green' },
|
|
{ color: '#FF0000', label: 'Red' },
|
|
{ color: '#FF69B4', label: 'Pink' },
|
|
];
|
|
|
|
const HIGHLIGHT_PRESETS = [
|
|
{ color: '#FFDD00', label: 'Gold' },
|
|
{ color: '#FF4444', label: 'Red' },
|
|
{ color: '#00FF88', label: 'Green' },
|
|
{ color: '#00BBFF', label: 'Blue' },
|
|
{ color: '#FF69B4', label: 'Pink' },
|
|
];
|
|
|
|
const ANIMATION_OPTIONS = [
|
|
{ value: 'pop', label: 'Pop' },
|
|
{ value: 'word-highlight', label: 'Glow' },
|
|
{ value: 'karaoke', label: 'Karaoke' },
|
|
{ value: 'none', label: 'None' },
|
|
];
|
|
|
|
const POSITION_OPTIONS = [
|
|
{ value: 'top', label: 'top' },
|
|
{ value: 'middle', label: 'middle' },
|
|
{ value: 'bottom', label: 'bottom' },
|
|
];
|
|
|
|
// Ready-made caption looks burned server-side as karaoke ASS (word highlight):
|
|
// dimmed base text + strong active word, optional glow/pop/box effect.
|
|
const CAPTION_PRESETS = [
|
|
{ id: 'tiktok', label: 'TikTok', style: 'karaoke', effect: 'none', highlightColor: '#FE2C55', baseOpacity: 0.75, uppercase: false, fontName: 'Verdana', borderWidth: 2 },
|
|
{ id: 'reels', label: 'Reels', style: 'karaoke', effect: 'none', highlightColor: '#E1306C', baseOpacity: 0.7, uppercase: false, fontName: 'Verdana', borderWidth: 2 },
|
|
{ id: 'shorts', label: 'Shorts Pop', style: 'karaoke', effect: 'pop', highlightColor: '#FF0000', baseOpacity: 0.7, uppercase: false, fontName: 'Verdana', borderWidth: 2 },
|
|
{ id: 'gold', label: 'Gold Glow', style: 'karaoke', effect: 'glow', highlightColor: '#FFD700', baseOpacity: 0.6, uppercase: false, fontName: 'Verdana', borderWidth: 2 },
|
|
{ id: 'neon', label: 'Neon', style: 'karaoke', effect: 'glow', highlightColor: '#00FF88', baseOpacity: 0.55, uppercase: false, fontName: 'Verdana', borderWidth: 2 },
|
|
{ id: 'cyber', label: 'Cyber', style: 'karaoke', effect: 'glow', highlightColor: '#00FFFF', baseOpacity: 0.5, uppercase: false, fontName: 'Verdana', borderWidth: 2 },
|
|
{ id: 'karaoke', label: 'Karaoke', style: 'karaoke', effect: 'none', highlightColor: '#FF6B6B', baseOpacity: 0.6, uppercase: false, fontName: 'Verdana', borderWidth: 2 },
|
|
{ id: 'minimal', label: 'Minimal', style: 'karaoke', effect: 'none', highlightColor: '#FFFFFF', baseOpacity: 0.65, uppercase: false, fontName: 'Verdana', borderWidth: 1 },
|
|
{ id: 'beast', label: 'Beast', style: 'karaoke', effect: 'pop', highlightColor: '#FFD700', baseOpacity: 1.0, uppercase: true, fontName: 'Impact', borderWidth: 3 },
|
|
{ id: 'boxed', label: 'Boxed', style: 'karaoke', effect: 'box', highlightColor: '#7C3AED', baseOpacity: 0.85, uppercase: false, fontName: 'Verdana', borderWidth: 2 },
|
|
{ id: 'classic', label: 'Classic', style: 'classic', effect: 'none', highlightColor: '#FFD700', baseOpacity: 1.0, uppercase: false, fontName: 'Verdana', borderWidth: 2 },
|
|
];
|
|
|
|
const swatchClass = (selected) =>
|
|
`w-6 h-6 rounded-full transition-all ${selected
|
|
? 'ring-2 ring-[color:var(--color-accent)] ring-offset-2 ring-offset-[color:var(--color-paper-2)]'
|
|
: 'ring-1 ring-[color:var(--color-rule-2)] hover:ring-[color:var(--color-accent)]'}`;
|
|
|
|
export default function SubtitleModal({ isOpen, onClose, onGenerate, onApplyAll, onRemove, isProcessing, videoUrl, jobId, clipIndex, existingHook, bulkCount = 0, bulkProgress }) {
|
|
const [position, setPosition] = useState('bottom');
|
|
const [fontSize] = useState(24);
|
|
const [fontName, setFontName] = useState('Verdana');
|
|
const [fontColor, setFontColor] = useState('#FFFFFF');
|
|
const [highlightColor, setHighlightColor] = useState('#FFDD00');
|
|
const [borderColor, setBorderColor] = useState('#000000');
|
|
const [borderWidth, setBorderWidth] = useState(2);
|
|
const [bgColor, setBgColor] = useState('#000000');
|
|
const [bgOpacity, setBgOpacity] = useState(0.0);
|
|
const [animation, setAnimation] = useState('pop');
|
|
const [showTextEditor, setShowTextEditor] = useState(false);
|
|
|
|
// Karaoke (server-side ASS burn) state
|
|
const [style, setStyle] = useState('classic'); // classic | karaoke
|
|
const [effect, setEffect] = useState('none'); // none | glow | pop | box
|
|
const [baseOpacity, setBaseOpacity] = useState(1.0);
|
|
const [uppercase, setUppercase] = useState(false);
|
|
const [activePreset, setActivePreset] = useState(null);
|
|
|
|
const applyPreset = (p) => {
|
|
setActivePreset(p.id);
|
|
setStyle(p.style);
|
|
setEffect(p.effect);
|
|
setHighlightColor(p.highlightColor);
|
|
setBaseOpacity(p.baseOpacity);
|
|
setUppercase(p.uppercase);
|
|
setFontName(p.fontName);
|
|
setBorderWidth(p.borderWidth);
|
|
setFontColor('#FFFFFF');
|
|
setBgOpacity(0);
|
|
// Keep the Remotion preview roughly in sync with the burned look
|
|
setAnimation(p.style === 'karaoke' ? (p.effect === 'pop' ? 'pop' : p.effect === 'glow' ? 'word-highlight' : 'karaoke') : 'none');
|
|
};
|
|
|
|
// Remotion preview state
|
|
const [captions, setCaptions] = useState([]);
|
|
const [originalCaptions, setOriginalCaptions] = useState([]);
|
|
const [editableText, setEditableText] = useState('');
|
|
const [durationSec, setDurationSec] = useState(30);
|
|
const [captionsLoading, setCaptionsLoading] = useState(false);
|
|
const [useRemotionPreview, setUseRemotionPreview] = useState(false);
|
|
|
|
// Fetch word-level captions when modal opens
|
|
useEffect(() => {
|
|
if (!isOpen || !jobId || clipIndex === undefined) return;
|
|
|
|
setCaptionsLoading(true);
|
|
apiFetch(`/api/clip/${jobId}/${clipIndex}/transcript`)
|
|
.then((res) => res.ok ? res.json() : null)
|
|
.then((data) => {
|
|
if (data && data.captions && data.captions.length > 0) {
|
|
setCaptions(data.captions);
|
|
setOriginalCaptions(data.captions);
|
|
setEditableText(data.captions.map(c => c.text).join(' '));
|
|
setDurationSec(data.durationSec || 30);
|
|
setUseRemotionPreview(true);
|
|
} else {
|
|
setUseRemotionPreview(false);
|
|
}
|
|
})
|
|
.catch(() => setUseRemotionPreview(false))
|
|
.finally(() => setCaptionsLoading(false));
|
|
}, [isOpen, jobId, clipIndex]);
|
|
|
|
// When user edits text, redistribute words across original timestamps
|
|
const handleTextEdit = (newText) => {
|
|
setEditableText(newText);
|
|
const newWords = newText.split(/\s+/).filter(w => w.length > 0);
|
|
if (newWords.length === 0 || originalCaptions.length === 0) {
|
|
setCaptions([]);
|
|
return;
|
|
}
|
|
|
|
// Distribute new words across the time span of original captions
|
|
const totalDurationMs = originalCaptions[originalCaptions.length - 1].endMs - originalCaptions[0].startMs;
|
|
const startMs = originalCaptions[0].startMs;
|
|
const wordDurationMs = totalDurationMs / newWords.length;
|
|
|
|
const newCaptions = newWords.map((word, i) => ({
|
|
text: word,
|
|
startMs: Math.round(startMs + i * wordDurationMs),
|
|
endMs: Math.round(startMs + (i + 1) * wordDurationMs),
|
|
}));
|
|
setCaptions(newCaptions);
|
|
};
|
|
|
|
if (!isOpen) return null;
|
|
|
|
// Build subtitle config for Remotion
|
|
const subtitleConfig = {
|
|
captions,
|
|
position,
|
|
style: {
|
|
fontFamily: fontName,
|
|
fontSize: fontSize * 2.2, // Scale up for 1080p (modal fontSize is for small preview)
|
|
fontColor,
|
|
highlightColor,
|
|
borderColor,
|
|
borderWidth: borderWidth * 1.5,
|
|
bgColor,
|
|
bgOpacity,
|
|
animation,
|
|
// Karaoke look reflected live in the playable preview.
|
|
baseOpacity: style === 'karaoke' ? baseOpacity : 1,
|
|
uppercase: style === 'karaoke' ? uppercase : false,
|
|
},
|
|
};
|
|
|
|
// Fallback: static CSS preview (same as original)
|
|
const bw = Math.max(borderWidth, 0);
|
|
const bc = borderColor;
|
|
const outlineShadow = bw > 0 ? [
|
|
`-${bw}px -${bw}px 0 ${bc}`, `${bw}px -${bw}px 0 ${bc}`,
|
|
`-${bw}px ${bw}px 0 ${bc}`, `${bw}px ${bw}px 0 ${bc}`,
|
|
`0 -${bw}px 0 ${bc}`, `0 ${bw}px 0 ${bc}`,
|
|
`-${bw}px 0 0 ${bc}`, `${bw}px 0 0 ${bc}`,
|
|
].join(', ') : 'none';
|
|
|
|
const fallbackPreviewStyle = {
|
|
fontFamily: fontName,
|
|
color: fontColor,
|
|
fontSize: '20px',
|
|
fontWeight: 'bold',
|
|
maxWidth: '85%',
|
|
padding: '6px 12px',
|
|
borderRadius: '4px',
|
|
textAlign: 'center',
|
|
lineHeight: '1.3',
|
|
...(bgOpacity > 0
|
|
? {
|
|
backgroundColor: `${bgColor}${Math.round(bgOpacity * 255).toString(16).padStart(2, '0')}`,
|
|
textShadow: 'none',
|
|
}
|
|
: { textShadow: outlineShadow }
|
|
),
|
|
};
|
|
|
|
return (
|
|
<Modal isOpen={isOpen} onClose={onClose} size="xl" eyebrow="EDITOR · SUBTITLES" title="subtitles">
|
|
<div className="flex flex-col md:flex-row gap-6">
|
|
{/* Left: Preview */}
|
|
<div className="flex-1 flex flex-col items-center justify-center bg-black rounded-card border border-rule overflow-hidden relative aspect-[9/16] max-h-[600px]">
|
|
{captionsLoading ? (
|
|
<div className="flex items-center gap-2 text-muted">
|
|
<Loader2 size={16} className="animate-spin" />
|
|
<span className="text-sm lowercase">Loading preview...</span>
|
|
</div>
|
|
) : useRemotionPreview ? (
|
|
<RemotionPreview
|
|
videoUrl={videoUrl}
|
|
durationInSeconds={durationSec}
|
|
subtitles={subtitleConfig}
|
|
hook={existingHook || null}
|
|
/>
|
|
) : (
|
|
<>
|
|
<video src={videoUrl} className="w-full h-full object-contain opacity-50" muted playsInline />
|
|
<div className={`absolute w-full px-8 text-center transition-all duration-300 pointer-events-none flex flex-col items-center justify-center
|
|
${position === 'top' ? 'top-20' : ''}
|
|
${position === 'middle' ? 'top-0 bottom-0' : ''}
|
|
${position === 'bottom' ? 'bottom-20' : ''}
|
|
`}>
|
|
<span style={fallbackPreviewStyle}>
|
|
This is how your subtitles<br/>will appear on the video
|
|
</span>
|
|
</div>
|
|
</>
|
|
)}
|
|
</div>
|
|
|
|
{/* Right: Controls */}
|
|
<div className="w-full md:w-80 flex flex-col">
|
|
<div className="space-y-5 flex-1 overflow-y-auto custom-scrollbar pr-1">
|
|
{/* Caption presets (server-side karaoke burn) */}
|
|
<div>
|
|
<p className="eyebrow mb-2">Preset</p>
|
|
<div className="grid grid-cols-3 gap-1.5">
|
|
{CAPTION_PRESETS.map((p) => (
|
|
<button
|
|
key={p.id}
|
|
onClick={() => applyPreset(p)}
|
|
className={`px-2 py-1.5 rounded-input border text-xs transition-colors flex items-center gap-1.5 justify-center
|
|
${activePreset === p.id
|
|
? 'border-[color:var(--color-accent)] text-ink'
|
|
: 'border-rule2 text-muted hover:border-[color:var(--color-accent)]'}`}
|
|
title={p.label}
|
|
>
|
|
<span className="w-2 h-2 rounded-full shrink-0" style={{ backgroundColor: p.highlightColor }} />
|
|
{p.label}
|
|
</button>
|
|
))}
|
|
</div>
|
|
{style === 'karaoke' && (
|
|
<div className="mt-3 space-y-3 animate-fade">
|
|
<div className="flex items-center justify-between">
|
|
<span className="readout">UPPERCASE</span>
|
|
<label className="relative inline-flex items-center cursor-pointer">
|
|
<input type="checkbox" checked={uppercase} onChange={(e) => setUppercase(e.target.checked)} className="sr-only peer" />
|
|
<div className="w-8 h-4 rounded-full bg-paper3 peer-checked:bg-brass transition-colors after:content-[''] after:absolute after:top-0 after:left-0 after:h-4 after:w-4 after:rounded-full after:bg-ink after:transition-all peer-checked:after:translate-x-full"></div>
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<div className="flex justify-between mb-1">
|
|
<span className="readout">Dim inactive words</span>
|
|
<span className="readout">{Math.round(baseOpacity * 100)}%</span>
|
|
</div>
|
|
<input
|
|
type="range"
|
|
min="30"
|
|
max="100"
|
|
value={Math.round(baseOpacity * 100)}
|
|
onChange={(e) => setBaseOpacity(parseInt(e.target.value) / 100)}
|
|
className="w-full accent-[var(--color-accent)]"
|
|
/>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{/* Position Selector */}
|
|
<div>
|
|
<p className="eyebrow mb-2">Position</p>
|
|
<SegmentedControl
|
|
options={POSITION_OPTIONS}
|
|
value={position}
|
|
onChange={setPosition}
|
|
size="sm"
|
|
/>
|
|
</div>
|
|
|
|
{/* Animation Style (new) */}
|
|
<div>
|
|
<p className="eyebrow mb-2">Animation</p>
|
|
<SegmentedControl
|
|
options={ANIMATION_OPTIONS}
|
|
value={animation}
|
|
onChange={setAnimation}
|
|
columns={2}
|
|
size="sm"
|
|
/>
|
|
</div>
|
|
|
|
{/* Editable Transcript (collapsible) */}
|
|
{useRemotionPreview && (
|
|
<div>
|
|
<button
|
|
type="button"
|
|
onClick={() => setShowTextEditor(!showTextEditor)}
|
|
className="w-full flex items-center justify-between mb-2"
|
|
>
|
|
<span className="eyebrow">Edit text ({captions.length} words)</span>
|
|
<span className={`text-muted transition-transform ${showTextEditor ? 'rotate-180' : ''}`}>▾</span>
|
|
</button>
|
|
{showTextEditor && (
|
|
<textarea
|
|
value={editableText}
|
|
onChange={(e) => handleTextEdit(e.target.value)}
|
|
rows={5}
|
|
className="input-field resize-none leading-relaxed animate-fade"
|
|
placeholder="Edit subtitle text..."
|
|
/>
|
|
)}
|
|
</div>
|
|
)}
|
|
|
|
{/* Font Family */}
|
|
<div>
|
|
<p className="eyebrow mb-2">Font</p>
|
|
<select
|
|
value={fontName}
|
|
onChange={(e) => setFontName(e.target.value)}
|
|
className="input-field"
|
|
>
|
|
{FONT_OPTIONS.map((f) => (
|
|
<option key={f.value} value={f.value} style={{ fontFamily: f.value }}>{f.label}</option>
|
|
))}
|
|
</select>
|
|
</div>
|
|
|
|
{/* Text Color */}
|
|
<div>
|
|
<p className="eyebrow mb-2">Text color</p>
|
|
<div className="flex flex-wrap items-center gap-2.5">
|
|
{COLOR_PRESETS.map((c) => (
|
|
<button
|
|
key={c.color}
|
|
onClick={() => setFontColor(c.color)}
|
|
className={swatchClass(fontColor === c.color)}
|
|
style={{ backgroundColor: c.color }}
|
|
title={c.label}
|
|
/>
|
|
))}
|
|
<label className="w-6 h-6 rounded-full border border-dashed border-rule2 cursor-pointer flex items-center justify-center hover:border-brass transition-colors overflow-hidden relative" title="Custom color">
|
|
<span className="text-xs text-muted leading-none">+</span>
|
|
<input type="color" value={fontColor} onChange={(e) => setFontColor(e.target.value)} className="absolute inset-0 opacity-0 cursor-pointer" />
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Highlight Color (new) */}
|
|
<div>
|
|
<p className="eyebrow mb-2">Highlight</p>
|
|
<div className="flex flex-wrap items-center gap-2.5">
|
|
{HIGHLIGHT_PRESETS.map((c) => (
|
|
<button
|
|
key={c.color}
|
|
onClick={() => setHighlightColor(c.color)}
|
|
className={swatchClass(highlightColor === c.color)}
|
|
style={{ backgroundColor: c.color }}
|
|
title={c.label}
|
|
/>
|
|
))}
|
|
</div>
|
|
</div>
|
|
|
|
{/* Border / Outline */}
|
|
<div>
|
|
<p className="eyebrow mb-2">Border</p>
|
|
<div className="flex items-center gap-3">
|
|
<label className="relative w-8 h-8 rounded-input border border-rule2 cursor-pointer overflow-hidden shrink-0" title="Border color">
|
|
<div className="w-full h-full" style={{ backgroundColor: borderColor }} />
|
|
<input type="color" value={borderColor} onChange={(e) => setBorderColor(e.target.value)} className="absolute inset-0 opacity-0 cursor-pointer" />
|
|
</label>
|
|
<div className="flex-1">
|
|
<input
|
|
type="range"
|
|
min="0"
|
|
max="5"
|
|
value={borderWidth}
|
|
onChange={(e) => setBorderWidth(parseInt(e.target.value))}
|
|
className="w-full accent-[var(--color-accent)]"
|
|
/>
|
|
<div className="flex justify-between">
|
|
<span className="readout">None</span>
|
|
<span className="readout">Thick</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Background Box */}
|
|
<div>
|
|
<div className="flex items-center justify-between mb-2">
|
|
<p className="eyebrow">Background</p>
|
|
<label className="relative inline-flex items-center cursor-pointer">
|
|
<input type="checkbox" checked={bgOpacity > 0} onChange={(e) => setBgOpacity(e.target.checked ? 0.5 : 0)} className="sr-only peer" />
|
|
<div className="w-8 h-4 rounded-full bg-paper3 peer-checked:bg-brass transition-colors after:content-[''] after:absolute after:top-0 after:left-0 after:h-4 after:w-4 after:rounded-full after:bg-ink after:transition-all peer-checked:after:translate-x-full"></div>
|
|
</label>
|
|
</div>
|
|
{bgOpacity > 0 && (
|
|
<div className="space-y-3 animate-fade">
|
|
<div className="flex items-center gap-3">
|
|
<label className="relative w-8 h-8 rounded-input border border-rule2 cursor-pointer overflow-hidden shrink-0" title="Background color">
|
|
<div className="w-full h-full" style={{ backgroundColor: bgColor }} />
|
|
<input type="color" value={bgColor} onChange={(e) => setBgColor(e.target.value)} className="absolute inset-0 opacity-0 cursor-pointer" />
|
|
</label>
|
|
<div className="flex-1">
|
|
<input
|
|
type="range"
|
|
min="10"
|
|
max="100"
|
|
value={Math.round(bgOpacity * 100)}
|
|
onChange={(e) => setBgOpacity(parseInt(e.target.value) / 100)}
|
|
className="w-full accent-[var(--color-accent)]"
|
|
/>
|
|
<div className="flex justify-between">
|
|
<span className="readout">Transparent</span>
|
|
<span className="readout">{Math.round(bgOpacity * 100)}%</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
|
|
<div className="mt-5 shrink-0 space-y-2">
|
|
{(() => {
|
|
// Text edits must survive the server render path too
|
|
// (issue #69): send the edited words whenever the text
|
|
// differs from what the transcript produced.
|
|
const textEdited = originalCaptions.length > 0
|
|
&& editableText.trim() !== originalCaptions.map((c) => c.text).join(' ').trim();
|
|
const styleOptions = {
|
|
position, fontSize, fontName, fontColor, borderColor, borderWidth, bgColor, bgOpacity,
|
|
// Karaoke burn (server-side ASS render)
|
|
style, effect, baseOpacity, uppercase, highlightColor,
|
|
// Remotion data
|
|
remotion: useRemotionPreview ? subtitleConfig : null,
|
|
captions: textEdited ? captions : null,
|
|
};
|
|
const bulkRunning = bulkProgress?.running;
|
|
return (
|
|
<>
|
|
<div className="flex gap-2">
|
|
<button onClick={onClose} className="btn-ghost">
|
|
cancel
|
|
</button>
|
|
<button
|
|
onClick={() => onGenerate(styleOptions)}
|
|
disabled={isProcessing}
|
|
className="btn-primary flex-1"
|
|
>
|
|
{(isProcessing && !bulkRunning) && <Loader2 size={16} className="animate-spin text-brassink" />}
|
|
{(isProcessing && !bulkRunning) ? 'generating...' : 'apply to this clip'}
|
|
</button>
|
|
</div>
|
|
{onApplyAll && bulkCount > 1 && (
|
|
<button
|
|
onClick={() => onApplyAll({ ...styleOptions, captions: null })}
|
|
disabled={isProcessing}
|
|
className="btn-ghost w-full flex items-center justify-center gap-2"
|
|
>
|
|
{bulkRunning
|
|
? <><Loader2 size={16} className="animate-spin" />applying to all… {bulkProgress.current}/{bulkProgress.total}</>
|
|
: `apply this style to all ${bulkCount} clips`}
|
|
</button>
|
|
)}
|
|
{/* Clips ship captioned by default, so the way
|
|
out has to be here — otherwise a user who
|
|
doesn't want captions is stuck with them. */}
|
|
{onRemove && (
|
|
<button
|
|
onClick={onRemove}
|
|
disabled={isProcessing}
|
|
className="text-xs text-muted underline underline-offset-2 lowercase hover:text-ink2 disabled:opacity-50"
|
|
>
|
|
remove captions from this clip
|
|
</button>
|
|
)}
|
|
</>
|
|
);
|
|
})()}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</Modal>
|
|
);
|
|
}
|