feat: refine UI with effects panel improvements and visual polish
Major improvements: - Fixed multi-file import (FileList to Array conversion) - Auto-select first track when adding to empty project - Global effects panel folding state (independent of track selection) - Effects panel collapsed/disabled when no track selected - Effect device expansion state persisted per-device - Effect browser with searchable descriptions Visual refinements: - Removed center dot from pan knob for cleaner look - Simplified fader: removed volume fill overlay, dynamic level meter visible through semi-transparent handle - Level meter capped at fader position (realistic mixer behavior) - Solid background instead of gradient for fader track - Subtle volume overlay up to fader handle - Fixed track control width flickering (consistent 4px border) - Effect devices: removed shadows/rounded corners for flatter DAW-style look, added consistent border-radius - Added border between track control and waveform area 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import { useEffectChain } from '@/lib/hooks/useEffectChain';
|
||||
import { useToast } from '@/components/ui/Toast';
|
||||
import { TrackList } from '@/components/tracks/TrackList';
|
||||
import { ImportTrackDialog } from '@/components/tracks/ImportTrackDialog';
|
||||
import { EffectsPanel } from '@/components/effects/EffectsPanel';
|
||||
import { formatDuration } from '@/lib/audio/decoder';
|
||||
import { useHistory } from '@/lib/hooks/useHistory';
|
||||
import { useRecording } from '@/lib/hooks/useRecording';
|
||||
@@ -38,6 +39,8 @@ export function AudioEditor() {
|
||||
const [punchOutTime, setPunchOutTime] = React.useState(0);
|
||||
const [overdubEnabled, setOverdubEnabled] = React.useState(false);
|
||||
const [settingsDialogOpen, setSettingsDialogOpen] = React.useState(false);
|
||||
const [effectsPanelHeight, setEffectsPanelHeight] = React.useState(300);
|
||||
const [effectsPanelVisible, setEffectsPanelVisible] = React.useState(false);
|
||||
|
||||
const { addToast } = useToast();
|
||||
|
||||
@@ -61,13 +64,46 @@ export function AudioEditor() {
|
||||
// Multi-track hooks
|
||||
const {
|
||||
tracks,
|
||||
addTrack,
|
||||
addTrackFromBuffer,
|
||||
addTrack: addTrackOriginal,
|
||||
addTrackFromBuffer: addTrackFromBufferOriginal,
|
||||
removeTrack,
|
||||
updateTrack,
|
||||
clearTracks,
|
||||
} = useMultiTrack();
|
||||
|
||||
// Track whether we should auto-select on next add (when project is empty)
|
||||
const shouldAutoSelectRef = React.useRef(true);
|
||||
|
||||
React.useEffect(() => {
|
||||
// Update auto-select flag based on track count
|
||||
shouldAutoSelectRef.current = tracks.length === 0;
|
||||
}, [tracks.length]);
|
||||
|
||||
// Wrap addTrack to auto-select first track when adding to empty project
|
||||
const addTrack = React.useCallback((name?: string) => {
|
||||
const shouldAutoSelect = shouldAutoSelectRef.current;
|
||||
const track = addTrackOriginal(name);
|
||||
if (shouldAutoSelect) {
|
||||
setSelectedTrackId(track.id);
|
||||
shouldAutoSelectRef.current = false; // Only auto-select once
|
||||
}
|
||||
return track;
|
||||
}, [addTrackOriginal]);
|
||||
|
||||
// Wrap addTrackFromBuffer to auto-select first track when adding to empty project
|
||||
const addTrackFromBuffer = React.useCallback((buffer: AudioBuffer, name?: string) => {
|
||||
console.log(`[AudioEditor] addTrackFromBuffer wrapper called: ${name}, shouldAutoSelect: ${shouldAutoSelectRef.current}`);
|
||||
const shouldAutoSelect = shouldAutoSelectRef.current;
|
||||
const track = addTrackFromBufferOriginal(buffer, name);
|
||||
console.log(`[AudioEditor] Track created: ${track.name} (${track.id})`);
|
||||
if (shouldAutoSelect) {
|
||||
console.log(`[AudioEditor] Auto-selecting track: ${track.id}`);
|
||||
setSelectedTrackId(track.id);
|
||||
shouldAutoSelectRef.current = false; // Only auto-select once
|
||||
}
|
||||
return track;
|
||||
}, [addTrackFromBufferOriginal]);
|
||||
|
||||
// Log tracks to see if they update
|
||||
React.useEffect(() => {
|
||||
console.log('[AudioEditor] Tracks updated:', tracks.map(t => ({
|
||||
@@ -108,6 +144,7 @@ export function AudioEditor() {
|
||||
};
|
||||
|
||||
const handleImportTrack = (buffer: AudioBuffer, name: string) => {
|
||||
console.log(`[AudioEditor] handleImportTrack called: ${name}`);
|
||||
addTrackFromBuffer(buffer, name);
|
||||
};
|
||||
|
||||
@@ -171,6 +208,79 @@ export function AudioEditor() {
|
||||
updateTrack(selectedTrack.id, { effectChain: updatedChain });
|
||||
};
|
||||
|
||||
// Effects Panel handlers
|
||||
const handleAddEffect = React.useCallback((effectType: any) => {
|
||||
if (!selectedTrackId) return;
|
||||
const track = tracks.find((t) => t.id === selectedTrackId);
|
||||
if (!track) return;
|
||||
|
||||
// Import createEffect and EFFECT_NAMES dynamically
|
||||
import('@/lib/audio/effects/chain').then(({ createEffect, EFFECT_NAMES }) => {
|
||||
const newEffect = createEffect(effectType, EFFECT_NAMES[effectType]);
|
||||
const updatedChain = {
|
||||
...track.effectChain,
|
||||
effects: [...track.effectChain.effects, newEffect],
|
||||
};
|
||||
updateTrack(selectedTrackId, { effectChain: updatedChain });
|
||||
});
|
||||
}, [selectedTrackId, tracks, updateTrack]);
|
||||
|
||||
const handleToggleEffect = React.useCallback((effectId: string) => {
|
||||
if (!selectedTrackId) return;
|
||||
const track = tracks.find((t) => t.id === selectedTrackId);
|
||||
if (!track) return;
|
||||
|
||||
const updatedChain = {
|
||||
...track.effectChain,
|
||||
effects: track.effectChain.effects.map((e) =>
|
||||
e.id === effectId ? { ...e, enabled: !e.enabled } : e
|
||||
),
|
||||
};
|
||||
updateTrack(selectedTrackId, { effectChain: updatedChain });
|
||||
}, [selectedTrackId, tracks, updateTrack]);
|
||||
|
||||
const handleRemoveEffect = React.useCallback((effectId: string) => {
|
||||
if (!selectedTrackId) return;
|
||||
const track = tracks.find((t) => t.id === selectedTrackId);
|
||||
if (!track) return;
|
||||
|
||||
const updatedChain = {
|
||||
...track.effectChain,
|
||||
effects: track.effectChain.effects.filter((e) => e.id !== effectId),
|
||||
};
|
||||
updateTrack(selectedTrackId, { effectChain: updatedChain });
|
||||
}, [selectedTrackId, tracks, updateTrack]);
|
||||
|
||||
const handleUpdateEffect = React.useCallback((effectId: string, parameters: any) => {
|
||||
if (!selectedTrackId) return;
|
||||
const track = tracks.find((t) => t.id === selectedTrackId);
|
||||
if (!track) return;
|
||||
|
||||
const updatedChain = {
|
||||
...track.effectChain,
|
||||
effects: track.effectChain.effects.map((e) =>
|
||||
e.id === effectId ? { ...e, parameters } : e
|
||||
),
|
||||
};
|
||||
updateTrack(selectedTrackId, { effectChain: updatedChain });
|
||||
}, [selectedTrackId, tracks, updateTrack]);
|
||||
|
||||
const handleToggleEffectExpanded = React.useCallback((effectId: string) => {
|
||||
if (!selectedTrackId) return;
|
||||
const track = tracks.find((t) => t.id === selectedTrackId);
|
||||
if (!track) return;
|
||||
|
||||
const updatedChain = {
|
||||
...track.effectChain,
|
||||
effects: track.effectChain.effects.map((e) =>
|
||||
e.id === effectId ? { ...e, expanded: !e.expanded } : e
|
||||
),
|
||||
};
|
||||
updateTrack(selectedTrackId, { effectChain: updatedChain });
|
||||
}, [selectedTrackId, tracks, updateTrack]);
|
||||
|
||||
// Preserve effects panel state - don't auto-open/close on track selection
|
||||
|
||||
// Selection handler
|
||||
const handleSelectionChange = (trackId: string, selection: { start: number; end: number } | null) => {
|
||||
updateTrack(trackId, { selection });
|
||||
@@ -706,6 +816,23 @@ export function AudioEditor() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Effects Panel - Global Folding State, Collapsed when no track */}
|
||||
<EffectsPanel
|
||||
track={selectedTrack || null}
|
||||
visible={selectedTrack ? effectsPanelVisible : false}
|
||||
height={effectsPanelHeight}
|
||||
onToggleVisible={() => {
|
||||
if (selectedTrack) {
|
||||
setEffectsPanelVisible(!effectsPanelVisible);
|
||||
}
|
||||
}}
|
||||
onResizeHeight={setEffectsPanelHeight}
|
||||
onAddEffect={handleAddEffect}
|
||||
onToggleEffect={handleToggleEffect}
|
||||
onRemoveEffect={handleRemoveEffect}
|
||||
onUpdateEffect={handleUpdateEffect}
|
||||
onToggleEffectExpanded={handleToggleEffectExpanded}
|
||||
/>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -21,6 +21,28 @@ const EFFECT_CATEGORIES = {
|
||||
'Pitch & Time': ['pitch', 'timestretch'] as EffectType[],
|
||||
};
|
||||
|
||||
const EFFECT_DESCRIPTIONS: Record<EffectType, string> = {
|
||||
'compressor': 'Reduce dynamic range and control peaks',
|
||||
'limiter': 'Prevent audio from exceeding a maximum level',
|
||||
'gate': 'Reduce noise by cutting low-level signals',
|
||||
'lowpass': 'Allow frequencies below cutoff to pass',
|
||||
'highpass': 'Allow frequencies above cutoff to pass',
|
||||
'bandpass': 'Allow frequencies within a range to pass',
|
||||
'notch': 'Remove a specific frequency range',
|
||||
'lowshelf': 'Boost or cut low frequencies',
|
||||
'highshelf': 'Boost or cut high frequencies',
|
||||
'peaking': 'Boost or cut a specific frequency band',
|
||||
'delay': 'Create echoes and rhythmic repeats',
|
||||
'reverb': 'Simulate acoustic space and ambience',
|
||||
'chorus': 'Thicken sound with subtle pitch variations',
|
||||
'flanger': 'Create sweeping comb filter effects',
|
||||
'phaser': 'Create phase-shifted modulation effects',
|
||||
'distortion': 'Add harmonic saturation and grit',
|
||||
'bitcrusher': 'Reduce bit depth for lo-fi effects',
|
||||
'pitch': 'Shift pitch without changing tempo',
|
||||
'timestretch': 'Change tempo without affecting pitch',
|
||||
};
|
||||
|
||||
export function EffectBrowser({ open, onClose, onSelectEffect }: EffectBrowserProps) {
|
||||
const [search, setSearch] = React.useState('');
|
||||
const [selectedCategory, setSelectedCategory] = React.useState<string | null>(null);
|
||||
@@ -40,7 +62,8 @@ export function EffectBrowser({ open, onClose, onSelectEffect }: EffectBrowserPr
|
||||
|
||||
Object.entries(EFFECT_CATEGORIES).forEach(([category, effects]) => {
|
||||
const matchingEffects = effects.filter((effect) =>
|
||||
EFFECT_NAMES[effect].toLowerCase().includes(searchLower)
|
||||
EFFECT_NAMES[effect].toLowerCase().includes(searchLower) ||
|
||||
EFFECT_DESCRIPTIONS[effect].toLowerCase().includes(searchLower)
|
||||
);
|
||||
if (matchingEffects.length > 0) {
|
||||
filtered[category] = matchingEffects;
|
||||
@@ -101,7 +124,7 @@ export function EffectBrowser({ open, onClose, onSelectEffect }: EffectBrowserPr
|
||||
)}
|
||||
>
|
||||
<div className="font-medium text-sm">{EFFECT_NAMES[effect]}</div>
|
||||
<div className="text-xs text-muted-foreground capitalize">{effect}</div>
|
||||
<div className="text-xs text-muted-foreground">{EFFECT_DESCRIPTIONS[effect]}</div>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface EffectDeviceProps {
|
||||
onToggleEnabled?: () => void;
|
||||
onRemove?: () => void;
|
||||
onUpdateParameters?: (parameters: any) => void;
|
||||
onToggleExpanded?: () => void;
|
||||
}
|
||||
|
||||
export function EffectDevice({
|
||||
@@ -19,16 +20,17 @@ export function EffectDevice({
|
||||
onToggleEnabled,
|
||||
onRemove,
|
||||
onUpdateParameters,
|
||||
onToggleExpanded,
|
||||
}: EffectDeviceProps) {
|
||||
const [isExpanded, setIsExpanded] = React.useState(false);
|
||||
const isExpanded = effect.expanded || false;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'flex-shrink-0 flex flex-col h-full transition-all duration-200 rounded-md overflow-hidden',
|
||||
'flex-shrink-0 flex flex-col h-full transition-all duration-200 overflow-hidden rounded-md',
|
||||
effect.enabled
|
||||
? 'bg-card border border-border/50 shadow-md'
|
||||
: 'bg-card/40 border border-border/30 shadow-sm opacity-60',
|
||||
? 'bg-card border-l border-r border-b border-border'
|
||||
: 'bg-card/40 border-l border-r border-b border-border/50 opacity-60 hover:opacity-80',
|
||||
isExpanded ? 'min-w-96' : 'w-10'
|
||||
)}
|
||||
>
|
||||
@@ -39,7 +41,7 @@ export function EffectDevice({
|
||||
<div className={cn('h-0.5 w-full', effect.enabled ? 'bg-primary' : 'bg-muted-foreground/20')} />
|
||||
|
||||
<button
|
||||
onClick={() => setIsExpanded(true)}
|
||||
onClick={onToggleExpanded}
|
||||
className="w-full h-full flex flex-col items-center justify-between py-1 hover:bg-primary/10 transition-colors group"
|
||||
title={`Expand ${effect.name}`}
|
||||
>
|
||||
@@ -72,7 +74,7 @@ export function EffectDevice({
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={() => setIsExpanded(false)}
|
||||
onClick={onToggleExpanded}
|
||||
title="Collapse device"
|
||||
className="h-5 w-5 flex-shrink-0"
|
||||
>
|
||||
|
||||
202
components/effects/EffectsPanel.tsx
Normal file
202
components/effects/EffectsPanel.tsx
Normal file
@@ -0,0 +1,202 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import { ChevronDown, ChevronUp, Plus } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { EffectDevice } from './EffectDevice';
|
||||
import { EffectBrowser } from './EffectBrowser';
|
||||
import type { Track } from '@/types/track';
|
||||
import type { EffectType } from '@/lib/audio/effects/chain';
|
||||
import { cn } from '@/lib/utils/cn';
|
||||
|
||||
export interface EffectsPanelProps {
|
||||
track: Track | null; // Selected track
|
||||
visible: boolean;
|
||||
height: number;
|
||||
onToggleVisible: () => void;
|
||||
onResizeHeight: (height: number) => void;
|
||||
onAddEffect?: (effectType: EffectType) => void;
|
||||
onToggleEffect?: (effectId: string) => void;
|
||||
onRemoveEffect?: (effectId: string) => void;
|
||||
onUpdateEffect?: (effectId: string, parameters: any) => void;
|
||||
onToggleEffectExpanded?: (effectId: string) => void;
|
||||
}
|
||||
|
||||
export function EffectsPanel({
|
||||
track,
|
||||
visible,
|
||||
height,
|
||||
onToggleVisible,
|
||||
onResizeHeight,
|
||||
onAddEffect,
|
||||
onToggleEffect,
|
||||
onRemoveEffect,
|
||||
onUpdateEffect,
|
||||
onToggleEffectExpanded,
|
||||
}: EffectsPanelProps) {
|
||||
const [effectBrowserOpen, setEffectBrowserOpen] = React.useState(false);
|
||||
const [isResizing, setIsResizing] = React.useState(false);
|
||||
const resizeStartRef = React.useRef({ y: 0, height: 0 });
|
||||
|
||||
// Resize handler
|
||||
const handleResizeStart = React.useCallback(
|
||||
(e: React.MouseEvent) => {
|
||||
e.preventDefault();
|
||||
setIsResizing(true);
|
||||
resizeStartRef.current = { y: e.clientY, height };
|
||||
},
|
||||
[height]
|
||||
);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!isResizing) return;
|
||||
|
||||
const handleMouseMove = (e: MouseEvent) => {
|
||||
const delta = resizeStartRef.current.y - e.clientY;
|
||||
const newHeight = Math.max(200, Math.min(600, resizeStartRef.current.height + delta));
|
||||
onResizeHeight(newHeight);
|
||||
};
|
||||
|
||||
const handleMouseUp = () => {
|
||||
setIsResizing(false);
|
||||
};
|
||||
|
||||
window.addEventListener('mousemove', handleMouseMove);
|
||||
window.addEventListener('mouseup', handleMouseUp);
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('mousemove', handleMouseMove);
|
||||
window.removeEventListener('mouseup', handleMouseUp);
|
||||
};
|
||||
}, [isResizing, onResizeHeight]);
|
||||
|
||||
if (!visible) {
|
||||
// Collapsed state - just show header bar
|
||||
return (
|
||||
<div className="h-8 bg-card border-t border-border flex items-center px-3 gap-2 flex-shrink-0">
|
||||
<button
|
||||
onClick={onToggleVisible}
|
||||
className="flex items-center gap-2 flex-1 hover:text-primary transition-colors text-sm font-medium"
|
||||
>
|
||||
<ChevronUp className="h-4 w-4" />
|
||||
<span>Device View</span>
|
||||
{track && (
|
||||
<span className="text-muted-foreground">- {track.name}</span>
|
||||
)}
|
||||
</button>
|
||||
{track && (
|
||||
<div className="flex items-center gap-1">
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{track.effectChain.effects.length} device(s)
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className="bg-card border-t border-border flex flex-col flex-shrink-0 transition-all duration-300 ease-in-out"
|
||||
style={{ height }}
|
||||
>
|
||||
{/* Resize handle */}
|
||||
<div
|
||||
className={cn(
|
||||
'h-1 cursor-ns-resize hover:bg-primary/50 transition-colors group flex items-center justify-center',
|
||||
isResizing && 'bg-primary/50'
|
||||
)}
|
||||
onMouseDown={handleResizeStart}
|
||||
title="Drag to resize panel"
|
||||
>
|
||||
<div className="h-px w-16 bg-border group-hover:bg-primary transition-colors" />
|
||||
</div>
|
||||
|
||||
{/* Header */}
|
||||
<div className="h-10 flex-shrink-0 border-b border-border flex items-center px-3 gap-2 bg-muted/30">
|
||||
<button
|
||||
onClick={onToggleVisible}
|
||||
className="flex items-center gap-2 flex-1 hover:text-primary transition-colors"
|
||||
>
|
||||
<ChevronDown className="h-4 w-4" />
|
||||
<span className="text-sm font-medium">Device View</span>
|
||||
{track && (
|
||||
<>
|
||||
<span className="text-sm text-muted-foreground">-</span>
|
||||
<div
|
||||
className="w-0.5 h-4 rounded-full"
|
||||
style={{ backgroundColor: track.color }}
|
||||
/>
|
||||
<span className="text-sm font-semibold text-foreground">{track.name}</span>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
|
||||
{track && (
|
||||
<>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{track.effectChain.effects.length} device(s)
|
||||
</span>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={() => setEffectBrowserOpen(true)}
|
||||
title="Add effect"
|
||||
className="h-7 w-7"
|
||||
>
|
||||
<Plus className="h-4 w-4" />
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Device Rack */}
|
||||
<div className="flex-1 overflow-x-auto overflow-y-hidden custom-scrollbar bg-background/50 p-3">
|
||||
{!track ? (
|
||||
<div className="h-full flex items-center justify-center text-sm text-muted-foreground">
|
||||
Select a track to view its devices
|
||||
</div>
|
||||
) : track.effectChain.effects.length === 0 ? (
|
||||
<div className="h-full flex flex-col items-center justify-center text-sm text-muted-foreground gap-2">
|
||||
<p>No devices on this track</p>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => setEffectBrowserOpen(true)}
|
||||
>
|
||||
<Plus className="h-4 w-4 mr-1" />
|
||||
Add Device
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex h-full gap-3">
|
||||
{track.effectChain.effects.map((effect) => (
|
||||
<EffectDevice
|
||||
key={effect.id}
|
||||
effect={effect}
|
||||
onToggleEnabled={() => onToggleEffect?.(effect.id)}
|
||||
onRemove={() => onRemoveEffect?.(effect.id)}
|
||||
onUpdateParameters={(params) => onUpdateEffect?.(effect.id, params)}
|
||||
onToggleExpanded={() => onToggleEffectExpanded?.(effect.id)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Effect Browser Dialog */}
|
||||
{track && (
|
||||
<EffectBrowser
|
||||
open={effectBrowserOpen}
|
||||
onClose={() => setEffectBrowserOpen(false)}
|
||||
onSelectEffect={(effectType) => {
|
||||
if (onAddEffect) {
|
||||
onAddEffect(effectType);
|
||||
}
|
||||
setEffectBrowserOpen(false);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -24,28 +24,42 @@ export function ImportTrackDialog({
|
||||
const handleFiles = async (files: FileList) => {
|
||||
setIsLoading(true);
|
||||
|
||||
// Convert FileList to Array to prevent any weird behavior
|
||||
const fileArray = Array.from(files);
|
||||
console.log(`[ImportTrackDialog] Processing ${fileArray.length} files`, fileArray);
|
||||
|
||||
try {
|
||||
// Process files sequentially
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
for (let i = 0; i < fileArray.length; i++) {
|
||||
console.log(`[ImportTrackDialog] Loop iteration ${i}, fileArray.length: ${fileArray.length}`);
|
||||
const file = fileArray[i];
|
||||
console.log(`[ImportTrackDialog] Processing file ${i + 1}/${fileArray.length}: ${file.name}, type: ${file.type}`);
|
||||
|
||||
if (!file.type.startsWith('audio/')) {
|
||||
console.warn(`Skipping non-audio file: ${file.name}`);
|
||||
console.warn(`Skipping non-audio file: ${file.name} (type: ${file.type})`);
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log(`[ImportTrackDialog] Decoding file ${i + 1}/${files.length}: ${file.name}`);
|
||||
const buffer = await decodeAudioFile(file);
|
||||
const trackName = file.name.replace(/\.[^/.]+$/, ''); // Remove extension
|
||||
console.log(`[ImportTrackDialog] Importing track: ${trackName}`);
|
||||
onImportTrack(buffer, trackName);
|
||||
console.log(`[ImportTrackDialog] Track imported: ${trackName}`);
|
||||
} catch (error) {
|
||||
console.error(`Failed to import ${file.name}:`, error);
|
||||
}
|
||||
console.log(`[ImportTrackDialog] Finished processing file ${i + 1}`);
|
||||
}
|
||||
|
||||
onClose();
|
||||
console.log('[ImportTrackDialog] Loop completed, all files processed');
|
||||
} catch (error) {
|
||||
console.error('[ImportTrackDialog] Error in handleFiles:', error);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
console.log('[ImportTrackDialog] Closing dialog');
|
||||
onClose();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
'use client';
|
||||
|
||||
import * as React from 'react';
|
||||
import { Volume2, VolumeX, Headphones, Trash2, ChevronDown, ChevronRight, UnfoldHorizontal, Upload, Plus, Mic, Gauge } from 'lucide-react';
|
||||
import { Volume2, VolumeX, Headphones, Trash2, ChevronDown, ChevronRight, UnfoldHorizontal, Upload, Mic, Gauge, Circle } from 'lucide-react';
|
||||
import type { Track as TrackType } from '@/types/track';
|
||||
import { COLLAPSED_TRACK_HEIGHT, MIN_TRACK_HEIGHT, MAX_TRACK_HEIGHT } from '@/types/track';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Slider } from '@/components/ui/Slider';
|
||||
import { cn } from '@/lib/utils/cn';
|
||||
import { EffectBrowser } from '@/components/effects/EffectBrowser';
|
||||
import { EffectDevice } from '@/components/effects/EffectDevice';
|
||||
import { createEffect, type EffectType } from '@/lib/audio/effects/chain';
|
||||
import type { EffectType } from '@/lib/audio/effects/chain';
|
||||
import { VerticalFader } from '@/components/ui/VerticalFader';
|
||||
import { CircularKnob } from '@/components/ui/CircularKnob';
|
||||
import { AutomationLane } from '@/components/automation/AutomationLane';
|
||||
@@ -76,8 +74,6 @@ export function Track({
|
||||
const fileInputRef = React.useRef<HTMLInputElement>(null);
|
||||
const [isEditingName, setIsEditingName] = React.useState(false);
|
||||
const [nameInput, setNameInput] = React.useState(String(track.name || 'Untitled Track'));
|
||||
const [effectBrowserOpen, setEffectBrowserOpen] = React.useState(false);
|
||||
const [showEffects, setShowEffects] = React.useState(false);
|
||||
const [themeKey, setThemeKey] = React.useState(0);
|
||||
const inputRef = React.useRef<HTMLInputElement>(null);
|
||||
const [isResizing, setIsResizing] = React.useState(false);
|
||||
@@ -441,180 +437,200 @@ export function Track({
|
||||
<div
|
||||
ref={containerRef}
|
||||
className={cn(
|
||||
'flex flex-col',
|
||||
isSelected && 'ring-2 ring-primary ring-inset'
|
||||
'flex flex-col transition-all duration-200 relative',
|
||||
isSelected && 'bg-primary/5'
|
||||
)}
|
||||
>
|
||||
{/* Top: Track Row (Control Panel + Waveform) */}
|
||||
<div className="flex" style={{ height: trackHeight }}>
|
||||
{/* Left: Track Control Panel (Fixed Width) - Ableton Style */}
|
||||
<div
|
||||
className="w-48 flex-shrink-0 bg-card border-r border-border border-b border-border p-2 flex flex-col gap-1.5 min-h-0"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{/* Track Name (Full Width) */}
|
||||
<div className="flex items-center gap-1">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={onToggleCollapse}
|
||||
title={track.collapsed ? 'Expand track' : 'Collapse track'}
|
||||
className="flex-shrink-0 h-6 w-6"
|
||||
>
|
||||
{track.collapsed ? (
|
||||
<ChevronRight className="h-3 w-3" />
|
||||
) : (
|
||||
<ChevronDown className="h-3 w-3" />
|
||||
)}
|
||||
</Button>
|
||||
|
||||
<div
|
||||
className="w-1 h-6 rounded-full flex-shrink-0"
|
||||
style={{ backgroundColor: track.color }}
|
||||
/>
|
||||
|
||||
<div className="flex-1 min-w-0">
|
||||
{isEditingName ? (
|
||||
<input
|
||||
ref={inputRef}
|
||||
type="text"
|
||||
value={nameInput}
|
||||
onChange={(e) => setNameInput(e.target.value)}
|
||||
onBlur={handleNameBlur}
|
||||
onKeyDown={handleNameKeyDown}
|
||||
className="w-full px-1 py-0.5 text-xs font-medium bg-background border border-border rounded"
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
onClick={handleNameClick}
|
||||
className="px-1 py-0.5 text-xs font-medium text-foreground truncate cursor-pointer hover:bg-accent rounded"
|
||||
title={String(track.name || 'Untitled Track')}
|
||||
>
|
||||
{String(track.name || 'Untitled Track')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Compact Button Row */}
|
||||
<div className="flex items-center justify-center gap-1">
|
||||
{/* Record Enable Button */}
|
||||
{onToggleRecordEnable && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={onToggleRecordEnable}
|
||||
title="Arm track for recording"
|
||||
className={cn(
|
||||
'h-6 w-6',
|
||||
track.recordEnabled && 'bg-red-500/20 hover:bg-red-500/30',
|
||||
isRecording && 'animate-pulse'
|
||||
)}
|
||||
>
|
||||
<div
|
||||
className={cn(
|
||||
'h-3 w-3 rounded-full border-2',
|
||||
track.recordEnabled ? 'bg-red-500 border-red-500' : 'border-current'
|
||||
)}
|
||||
/>
|
||||
</Button>
|
||||
className={cn(
|
||||
"w-48 flex-shrink-0 border-b border-r-4 p-2 flex flex-col gap-2 min-h-0 transition-all duration-200 cursor-pointer border-border",
|
||||
isSelected
|
||||
? "bg-primary/10 border-r-primary"
|
||||
: "bg-card border-r-transparent hover:bg-accent/30"
|
||||
)}
|
||||
|
||||
{/* Solo Button */}
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={onToggleSolo}
|
||||
title="Solo track"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
if (onSelect) onSelect();
|
||||
}}
|
||||
>
|
||||
{/* Track Name Row - Integrated collapse (DAW style) */}
|
||||
<div
|
||||
className={cn(
|
||||
'h-6 w-6 text-[10px] font-bold',
|
||||
track.solo && 'bg-yellow-500/20 hover:bg-yellow-500/30 text-yellow-500'
|
||||
"group flex items-center gap-1.5 px-1 py-0.5 rounded cursor-pointer transition-colors",
|
||||
isSelected ? "bg-primary/10" : "hover:bg-accent/50"
|
||||
)}
|
||||
onClick={(e) => {
|
||||
if (!isEditingName) {
|
||||
e.stopPropagation();
|
||||
onToggleCollapse();
|
||||
}
|
||||
}}
|
||||
title={track.collapsed ? 'Expand track' : 'Collapse track'}
|
||||
>
|
||||
S
|
||||
</Button>
|
||||
|
||||
{/* Mute Button */}
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={onToggleMute}
|
||||
title="Mute track"
|
||||
className={cn(
|
||||
'h-6 w-6 text-[10px] font-bold',
|
||||
track.mute && 'bg-red-500/20 hover:bg-red-500/30 text-red-500'
|
||||
)}
|
||||
>
|
||||
M
|
||||
</Button>
|
||||
|
||||
{/* Remove Button */}
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={onRemove}
|
||||
title="Remove track"
|
||||
className="h-6 w-6 text-destructive hover:text-destructive hover:bg-destructive/10"
|
||||
>
|
||||
<Trash2 className="h-3 w-3" />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* Track Controls - Only show when not collapsed */}
|
||||
{!track.collapsed && (
|
||||
<div className="flex-1 flex flex-col items-center justify-between py-1 min-h-0 overflow-hidden">
|
||||
{/* Pan Knob */}
|
||||
<div className="flex-shrink-0">
|
||||
<CircularKnob
|
||||
value={track.pan}
|
||||
onChange={onPanChange}
|
||||
min={-1}
|
||||
max={1}
|
||||
step={0.01}
|
||||
size={40}
|
||||
label="PAN"
|
||||
/>
|
||||
{/* Small triangle indicator */}
|
||||
<div className={cn(
|
||||
"flex-shrink-0 transition-colors",
|
||||
isSelected ? "text-primary" : "text-muted-foreground group-hover:text-foreground"
|
||||
)}>
|
||||
{track.collapsed ? (
|
||||
<ChevronRight className="h-3 w-3" />
|
||||
) : (
|
||||
<ChevronDown className="h-3 w-3" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Vertical Volume Fader with integrated meter */}
|
||||
<div className="flex-1 flex items-center justify-center min-h-0 max-h-[140px]">
|
||||
<VerticalFader
|
||||
value={track.volume}
|
||||
level={track.recordEnabled || isRecording ? recordingLevel : playbackLevel}
|
||||
onChange={onVolumeChange}
|
||||
min={0}
|
||||
max={1}
|
||||
step={0.01}
|
||||
showDb={true}
|
||||
/>
|
||||
{/* Color stripe (thicker when selected) */}
|
||||
<div
|
||||
className={cn(
|
||||
"h-5 rounded-full flex-shrink-0 transition-all",
|
||||
isSelected ? "w-1" : "w-0.5"
|
||||
)}
|
||||
style={{ backgroundColor: track.color }}
|
||||
/>
|
||||
|
||||
{/* Track name (editable) */}
|
||||
<div className="flex-1 min-w-0">
|
||||
{isEditingName ? (
|
||||
<input
|
||||
ref={inputRef}
|
||||
type="text"
|
||||
value={nameInput}
|
||||
onChange={(e) => setNameInput(e.target.value)}
|
||||
onBlur={handleNameBlur}
|
||||
onKeyDown={handleNameKeyDown}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className="w-full px-1 py-0.5 text-xs font-semibold bg-background border border-border rounded"
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleNameClick();
|
||||
}}
|
||||
className="px-1 py-0.5 text-xs font-semibold text-foreground truncate"
|
||||
title={String(track.name || 'Untitled Track')}
|
||||
>
|
||||
{String(track.name || 'Untitled Track')}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Track Controls - Only show when not collapsed */}
|
||||
{!track.collapsed && (
|
||||
<div className="flex-1 flex flex-col items-center justify-between min-h-0 overflow-hidden">
|
||||
{/* Pan Knob */}
|
||||
<div className="flex-shrink-0">
|
||||
<CircularKnob
|
||||
value={track.pan}
|
||||
onChange={onPanChange}
|
||||
min={-1}
|
||||
max={1}
|
||||
step={0.01}
|
||||
size={48}
|
||||
label="PAN"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Vertical Volume Fader with integrated meter */}
|
||||
<div className="flex-1 flex items-center justify-center min-h-0">
|
||||
<VerticalFader
|
||||
value={track.volume}
|
||||
level={track.recordEnabled || isRecording ? recordingLevel : playbackLevel}
|
||||
onChange={onVolumeChange}
|
||||
min={0}
|
||||
max={1}
|
||||
step={0.01}
|
||||
showDb={true}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Inline Button Row - Below fader */}
|
||||
<div className="flex-shrink-0 w-full">
|
||||
{/* R/S/M inline row with icons */}
|
||||
<div className="flex items-center gap-1 justify-center">
|
||||
{/* Record Arm */}
|
||||
{onToggleRecordEnable && (
|
||||
<button
|
||||
onClick={onToggleRecordEnable}
|
||||
className={cn(
|
||||
'h-6 w-6 rounded flex items-center justify-center transition-all',
|
||||
track.recordEnabled
|
||||
? 'bg-red-500 text-white shadow-md shadow-red-500/30'
|
||||
: 'bg-card hover:bg-accent text-muted-foreground border border-border/50',
|
||||
isRecording && 'animate-pulse'
|
||||
)}
|
||||
title="Arm track for recording"
|
||||
>
|
||||
<Circle className="h-3 w-3 fill-current" />
|
||||
</button>
|
||||
)}
|
||||
|
||||
{/* Solo Button */}
|
||||
<button
|
||||
onClick={onToggleSolo}
|
||||
className={cn(
|
||||
'h-6 w-6 rounded flex items-center justify-center transition-all',
|
||||
track.solo
|
||||
? 'bg-yellow-500 text-black shadow-md shadow-yellow-500/30'
|
||||
: 'bg-card hover:bg-accent text-muted-foreground border border-border/50'
|
||||
)}
|
||||
title="Solo track"
|
||||
>
|
||||
<Headphones className="h-3 w-3" />
|
||||
</button>
|
||||
|
||||
{/* Mute Button */}
|
||||
<button
|
||||
onClick={onToggleMute}
|
||||
className={cn(
|
||||
'h-6 w-6 rounded flex items-center justify-center transition-all',
|
||||
track.mute
|
||||
? 'bg-blue-500 text-white shadow-md shadow-blue-500/30'
|
||||
: 'bg-card hover:bg-accent text-muted-foreground border border-border/50'
|
||||
)}
|
||||
title="Mute track"
|
||||
>
|
||||
{track.mute ? <VolumeX className="h-3 w-3" /> : <Volume2 className="h-3 w-3" />}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Right: Waveform Area (Flexible Width) */}
|
||||
<div
|
||||
className="flex-1 relative bg-waveform-bg border-b border-border"
|
||||
onClick={onSelect}
|
||||
className="flex-1 relative bg-waveform-bg border-b border-l border-border"
|
||||
>
|
||||
{track.audioBuffer ? (
|
||||
<div className="absolute inset-2 bg-card/30 border border-primary/20 rounded-sm shadow-sm overflow-hidden transition-colors hover:border-primary/40">
|
||||
{/* Clip Header */}
|
||||
<div className="absolute top-0 left-0 right-0 h-4 bg-gradient-to-b from-foreground/5 to-transparent pointer-events-none z-10 px-2 flex items-center">
|
||||
<span className="text-[9px] text-foreground/60 font-medium truncate">
|
||||
{track.name}
|
||||
</span>
|
||||
</div>
|
||||
{/* Delete Button - Top Right Overlay */}
|
||||
<button
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onRemove();
|
||||
}}
|
||||
className={cn(
|
||||
'absolute top-2 right-2 z-20 h-6 w-6 rounded flex items-center justify-center transition-all',
|
||||
'bg-card/80 hover:bg-destructive/90 text-muted-foreground hover:text-white',
|
||||
'border border-border/50 hover:border-destructive',
|
||||
'backdrop-blur-sm shadow-sm hover:shadow-md'
|
||||
)}
|
||||
title="Remove track"
|
||||
>
|
||||
<Trash2 className="h-3 w-3" />
|
||||
</button>
|
||||
|
||||
{track.audioBuffer ? (
|
||||
<>
|
||||
{/* Waveform Canvas */}
|
||||
<canvas
|
||||
ref={canvasRef}
|
||||
className="absolute inset-0 w-full h-full cursor-crosshair"
|
||||
onMouseDown={handleCanvasMouseDown}
|
||||
onMouseMove={handleCanvasMouseMove}
|
||||
onMouseUp={handleCanvasMouseUp}
|
||||
className="absolute inset-0 w-full h-full"
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
!track.collapsed && (
|
||||
<>
|
||||
@@ -648,82 +664,6 @@ export function Track({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Bottom: Effects Section (Collapsible, Full Width) - Ableton Style */}
|
||||
{!track.collapsed && (
|
||||
<div className="bg-gradient-to-b from-muted/80 to-muted/60 border-b border-border shadow-inner">
|
||||
{/* Effects Header - clickable to toggle */}
|
||||
<div
|
||||
className="flex items-center gap-2 px-3 py-1.5 cursor-pointer hover:bg-accent/30 transition-colors border-b border-border/30"
|
||||
onClick={() => setShowEffects(!showEffects)}
|
||||
>
|
||||
{showEffects ? (
|
||||
<ChevronDown className="h-3.5 w-3.5 text-muted-foreground flex-shrink-0" />
|
||||
) : (
|
||||
<ChevronRight className="h-3.5 w-3.5 text-muted-foreground flex-shrink-0" />
|
||||
)}
|
||||
|
||||
{/* Show mini effect chain when collapsed */}
|
||||
{!showEffects && track.effectChain.effects.length > 0 ? (
|
||||
<div className="flex-1 flex items-center gap-1 overflow-x-auto custom-scrollbar">
|
||||
{track.effectChain.effects.map((effect) => (
|
||||
<div
|
||||
key={effect.id}
|
||||
className={cn(
|
||||
'px-2 py-0.5 rounded text-[10px] font-medium flex-shrink-0',
|
||||
effect.enabled
|
||||
? 'bg-primary/20 text-primary border border-primary/30'
|
||||
: 'bg-muted/30 text-muted-foreground border border-border'
|
||||
)}
|
||||
>
|
||||
{effect.name}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<span className="text-xs font-medium text-muted-foreground">
|
||||
Devices ({track.effectChain.effects.length})
|
||||
</span>
|
||||
)}
|
||||
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setEffectBrowserOpen(true);
|
||||
}}
|
||||
title="Add effect"
|
||||
className="h-5 w-5 flex-shrink-0"
|
||||
>
|
||||
<Plus className="h-3 w-3" />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* Horizontal scrolling device rack - expanded state */}
|
||||
{showEffects && (
|
||||
<div className="h-44 overflow-x-auto custom-scrollbar bg-background/50 p-2">
|
||||
<div className="flex h-full gap-2">
|
||||
{track.effectChain.effects.length === 0 ? (
|
||||
<div className="text-xs text-muted-foreground text-center py-8 w-full">
|
||||
No devices. Click + to add an effect.
|
||||
</div>
|
||||
) : (
|
||||
track.effectChain.effects.map((effect) => (
|
||||
<EffectDevice
|
||||
key={effect.id}
|
||||
effect={effect}
|
||||
onToggleEnabled={() => onToggleEffect?.(effect.id)}
|
||||
onRemove={() => onRemoveEffect?.(effect.id)}
|
||||
onUpdateParameters={(params) => onUpdateEffect?.(effect.id, params)}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Automation Lanes */}
|
||||
{!track.collapsed && track.automation?.showAutomation && (
|
||||
<div className="bg-background/30">
|
||||
@@ -791,26 +731,15 @@ export function Track({
|
||||
{!track.collapsed && (
|
||||
<div
|
||||
className={cn(
|
||||
'absolute bottom-0 left-0 right-0 h-1 cursor-ns-resize hover:bg-primary/50 transition-colors z-20 group',
|
||||
isResizing && 'bg-primary/50'
|
||||
'absolute bottom-0 left-0 right-0 h-1 cursor-ns-resize hover:bg-primary/50 transition-all duration-200 z-20 group',
|
||||
isResizing && 'bg-primary/50 h-1.5'
|
||||
)}
|
||||
onMouseDown={handleResizeStart}
|
||||
title="Drag to resize track height"
|
||||
>
|
||||
<div className="absolute inset-x-0 bottom-0 h-px bg-border group-hover:bg-primary" />
|
||||
<div className="absolute inset-x-0 bottom-0 h-px bg-border group-hover:bg-primary transition-colors duration-200" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Effect Browser Dialog */}
|
||||
<EffectBrowser
|
||||
open={effectBrowserOpen}
|
||||
onClose={() => setEffectBrowserOpen(false)}
|
||||
onSelectEffect={(effectType) => {
|
||||
if (onAddEffect) {
|
||||
onAddEffect(effectType);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -167,11 +167,6 @@ export function CircularKnob({
|
||||
{/* Indicator line */}
|
||||
<div className="absolute top-1 left-1/2 w-0.5 h-2 bg-primary rounded-full -translate-x-1/2" />
|
||||
</div>
|
||||
|
||||
{/* Center dot (for zero position) */}
|
||||
{value === 0 && (
|
||||
<div className="absolute top-1/2 left-1/2 w-1 h-1 bg-primary rounded-full -translate-x-1/2 -translate-y-1/2" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Value Display */}
|
||||
|
||||
@@ -107,35 +107,29 @@ export function VerticalFader({
|
||||
<div
|
||||
ref={trackRef}
|
||||
onMouseDown={handleMouseDown}
|
||||
className="relative w-8 flex-1 min-h-[80px] max-h-[140px] bg-muted rounded cursor-pointer select-none overflow-hidden"
|
||||
className="relative w-8 flex-1 min-h-[80px] max-h-[140px] bg-background/50 border border-border rounded cursor-pointer select-none overflow-hidden"
|
||||
>
|
||||
{/* Level Meter Background (green/yellow/red gradient) */}
|
||||
{/* Volume Level Overlay - subtle fill up to fader handle */}
|
||||
<div
|
||||
className="absolute inset-0 opacity-40"
|
||||
style={{
|
||||
background: 'linear-gradient(to top, rgb(34, 197, 94) 0%, rgb(34, 197, 94) 70%, rgb(234, 179, 8) 85%, rgb(239, 68, 68) 100%)',
|
||||
}}
|
||||
className="absolute bottom-0 left-0 right-0 bg-primary/10"
|
||||
style={{ height: `${valuePercentage}%` }}
|
||||
/>
|
||||
|
||||
{/* Level Meter (actual level) */}
|
||||
{/* Level Meter (actual level) - capped at fader handle position */}
|
||||
<div
|
||||
className="absolute bottom-0 left-0 right-0 transition-all duration-75"
|
||||
style={{
|
||||
height: `${level * 100}%`,
|
||||
height: `${Math.min(level * 100, valuePercentage)}%`,
|
||||
background: 'linear-gradient(to top, rgb(34, 197, 94) 0%, rgb(34, 197, 94) 70%, rgb(234, 179, 8) 85%, rgb(239, 68, 68) 100%)',
|
||||
opacity: 0.6,
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* Volume Value Fill */}
|
||||
<div
|
||||
className="absolute bottom-0 left-0 right-0 bg-primary/30 border-t-2 border-primary"
|
||||
style={{ height: `${valuePercentage}%` }}
|
||||
/>
|
||||
{/* Volume Value Fill - Removed to show gradient spectrum */}
|
||||
|
||||
{/* Fader Handle */}
|
||||
<div
|
||||
className="absolute left-0 right-0 h-3 -ml-1 -mr-1 bg-primary rounded-sm shadow-lg cursor-grab active:cursor-grabbing"
|
||||
className="absolute left-0 right-0 h-3 -ml-1 -mr-1 bg-primary/70 border-2 border-primary rounded-sm shadow-lg cursor-grab active:cursor-grabbing backdrop-blur-sm"
|
||||
style={{
|
||||
bottom: `calc(${valuePercentage}% - 6px)`,
|
||||
width: 'calc(100% + 8px)',
|
||||
|
||||
@@ -72,6 +72,7 @@ export interface ChainEffect {
|
||||
type: EffectType;
|
||||
name: string;
|
||||
enabled: boolean;
|
||||
expanded?: boolean; // UI state for effect device expansion
|
||||
parameters?: EffectParameters;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ export const TRACK_COLORS: Record<TrackColor, string> = {
|
||||
gray: 'rgb(156, 163, 175)',
|
||||
};
|
||||
|
||||
export const DEFAULT_TRACK_HEIGHT = 240; // Increased from 180 to accommodate vertical controls
|
||||
export const MIN_TRACK_HEIGHT = 120; // Increased from 60 for vertical fader/knob layout
|
||||
export const MAX_TRACK_HEIGHT = 400; // Increased from 300 for better waveform viewing
|
||||
export const DEFAULT_TRACK_HEIGHT = 300; // Knob + fader with labels + R/S/M buttons
|
||||
export const MIN_TRACK_HEIGHT = 220; // Minimum to fit knob + fader with labels + buttons
|
||||
export const MAX_TRACK_HEIGHT = 500; // Increased for better waveform viewing
|
||||
export const COLLAPSED_TRACK_HEIGHT = 48; // Extracted constant for collapsed state
|
||||
|
||||
Reference in New Issue
Block a user