Skip to content

Commit 3d36b03

Browse files
AmirMohammad CheraghaliAmirMohammad Cheraghali
authored andcommitted
Fix: Wire up Studio tool buttons with onClick handlers
1 parent 2039355 commit 3d36b03

1 file changed

Lines changed: 36 additions & 7 deletions

File tree

src/components/StudioLayout.tsx

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const StudioLayout: React.FC<StudioLayoutProps> = ({ recorder, onExit, ex
5353
const [isTrimMode, setIsTrimMode] = useState(false);
5454
const [tempTrimStart, setTempTrimStart] = useState<number>(0);
5555
const [tempTrimEnd, setTempTrimEnd] = useState<number>(0);
56+
const [activeTool, setActiveTool] = useState<'default' | 'settings' | 'tracks' | 'audio' | 'text'>('default');
5657

5758
// Segment/Range Edit Modes
5859
const [speedFactor, setSpeedFactor] = useState(2);
@@ -188,10 +189,30 @@ export const StudioLayout: React.FC<StudioLayoutProps> = ({ recorder, onExit, ex
188189
<div className="flex-1 flex min-h-0">
189190
{/* LEFT TOOLBAR */}
190191
<div className="w-16 bg-neutral-900/95 backdrop-blur border-r border-white/10 flex flex-col items-center py-4 gap-4 pointer-events-auto">
191-
<ToolButton icon={<Settings className="w-5 h-5" />} label="Settings" />
192-
<ToolButton icon={<Layers className="w-5 h-5" />} label="Tracks" active />
193-
<ToolButton icon={<Music className="w-5 h-5" />} label="Audio" />
194-
<ToolButton icon={<Type className="w-5 h-5" />} label="Text" />
192+
<ToolButton
193+
icon={<Settings className="w-5 h-5" />}
194+
label="Settings"
195+
active={activeTool === 'settings'}
196+
onClick={() => setActiveTool('settings')}
197+
/>
198+
<ToolButton
199+
icon={<Layers className="w-5 h-5" />}
200+
label="Tracks"
201+
active={activeTool === 'tracks'}
202+
onClick={() => setActiveTool('tracks')}
203+
/>
204+
<ToolButton
205+
icon={<Music className="w-5 h-5" />}
206+
label="Audio"
207+
active={activeTool === 'audio'}
208+
onClick={() => setActiveTool('audio')}
209+
/>
210+
<ToolButton
211+
icon={<Type className="w-5 h-5" />}
212+
label="Text"
213+
active={activeTool === 'text'}
214+
onClick={() => setActiveTool('text')}
215+
/>
195216
</div>
196217

197218
{/* VISUAL AREA (The hole) */}
@@ -228,7 +249,11 @@ export const StudioLayout: React.FC<StudioLayoutProps> = ({ recorder, onExit, ex
228249
<div className="w-80 bg-neutral-900/95 backdrop-blur border-l border-white/10 flex flex-col pointer-events-auto">
229250
<div className="p-4 border-b border-white/10">
230251
<h2 className="text-xs font-bold text-white/50 uppercase tracking-wider">
231-
{selectedSegmentIds.length > 0 ? 'Clip Properties' : 'Project Properties'}
252+
{activeTool === 'settings' && 'Studio Settings'}
253+
{activeTool === 'tracks' && 'Timeline Tracks'}
254+
{activeTool === 'audio' && 'Audio Mixer'}
255+
{activeTool === 'text' && 'Text Overlays'}
256+
{activeTool === 'default' && (selectedSegmentIds.length > 0 ? 'Clip Properties' : 'Project Properties')}
232257
</h2>
233258
</div>
234259

@@ -610,8 +635,12 @@ export const StudioLayout: React.FC<StudioLayoutProps> = ({ recorder, onExit, ex
610635
);
611636
};
612637

613-
const ToolButton = ({ icon, label, active = false }: { icon: React.ReactNode, label: string, active?: boolean }) => (
614-
<button className={`w-10 h-10 rounded-xl flex items-center justify-center transition-all ${active ? 'bg-blue-600 text-white shadow-lg shadow-blue-900/20' : 'text-white/40 hover:bg-white/5 hover:text-white'}`} title={label}>
638+
const ToolButton = ({ icon, label, active = false, onClick }: { icon: React.ReactNode, label: string, active?: boolean, onClick?: () => void }) => (
639+
<button
640+
onClick={onClick}
641+
className={`w-10 h-10 rounded-xl flex items-center justify-center transition-all ${active ? 'bg-blue-600 text-white shadow-lg shadow-blue-900/20' : 'text-white/40 hover:bg-white/5 hover:text-white'}`}
642+
title={label}
643+
>
615644
{icon}
616645
</button>
617646
);

0 commit comments

Comments
 (0)