feat: implement horizontal device rack with collapsible effect cards
- Created EffectDevice component with expand/collapse state - Each device shows name, type, enabled/disabled toggle, and remove button - When expanded, devices show parameter details - Replaced vertical effect list with horizontal scrolling rack - Effects display in 192px wide cards with visual feedback - Power button toggles effect enabled/disabled state - Parameters display shown when expanded (controls coming soon) This matches the Ableton Live/Bitwig workflow where effects are arranged horizontally with collapsible UI for each device. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ 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';
|
||||
|
||||
export interface TrackProps {
|
||||
@@ -55,7 +56,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 [showDevices, setShowDevices] = React.useState(true);
|
||||
const [effectBrowserOpen, setEffectBrowserOpen] = React.useState(false);
|
||||
const inputRef = React.useRef<HTMLInputElement>(null);
|
||||
|
||||
@@ -390,19 +390,11 @@ export function Track({
|
||||
</div>
|
||||
|
||||
{/* Devices/Effects Section */}
|
||||
<div className="pt-2">
|
||||
<div className="pt-2 border-t border-border">
|
||||
<div className="flex items-center justify-between mb-2">
|
||||
<button
|
||||
onClick={() => setShowDevices(!showDevices)}
|
||||
className="flex items-center gap-1 text-xs font-medium text-foreground hover:text-primary transition-colors"
|
||||
>
|
||||
<span>Devices ({track.effectChain.effects.length})</span>
|
||||
{showDevices ? (
|
||||
<ChevronDown className="h-3.5 w-3.5" />
|
||||
) : (
|
||||
<ChevronRight className="h-3.5 w-3.5" />
|
||||
)}
|
||||
</button>
|
||||
<span className="text-xs font-medium text-muted-foreground uppercase">
|
||||
Devices ({track.effectChain.effects.length})
|
||||
</span>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
@@ -414,45 +406,25 @@ export function Track({
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{showDevices && (
|
||||
<div className="space-y-1">
|
||||
{/* Horizontal scrolling device rack */}
|
||||
<div className="overflow-x-auto custom-scrollbar">
|
||||
<div className="flex gap-2 pb-2">
|
||||
{track.effectChain.effects.length === 0 ? (
|
||||
<div className="text-xs text-muted-foreground text-center py-2">
|
||||
No devices
|
||||
<div className="text-xs text-muted-foreground text-center py-4 w-full">
|
||||
No devices. Click + to add an effect.
|
||||
</div>
|
||||
) : (
|
||||
track.effectChain.effects.map((effect) => (
|
||||
<div
|
||||
<EffectDevice
|
||||
key={effect.id}
|
||||
className={cn(
|
||||
'flex items-center justify-between px-2 py-1.5 rounded text-xs',
|
||||
effect.enabled
|
||||
? 'bg-accent/50 text-foreground'
|
||||
: 'bg-muted/50 text-muted-foreground'
|
||||
)}
|
||||
>
|
||||
<span className="truncate">{effect.name}</span>
|
||||
<div className="flex items-center gap-1">
|
||||
<button
|
||||
onClick={() => onToggleEffect?.(effect.id)}
|
||||
className="hover:text-primary"
|
||||
title={effect.enabled ? 'Disable' : 'Enable'}
|
||||
>
|
||||
{effect.enabled ? '●' : '○'}
|
||||
</button>
|
||||
<button
|
||||
onClick={() => onRemoveEffect?.(effect.id)}
|
||||
className="hover:text-destructive"
|
||||
title="Remove"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
effect={effect}
|
||||
onToggleEnabled={() => onToggleEffect?.(effect.id)}
|
||||
onRemove={() => onRemoveEffect?.(effect.id)}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user