Reorganize the panel dock to use tabs more efficiently by moving the Color Panel from the always-visible section into the Adjustments tab. Changes: - **Panel Dock Layout**: * Always visible: Layers Panel only (50% height, min 300px) * Tabbed section: Takes up remaining 50% of dock space - **Adjustments Tab**: Now contains (in order): 1. Colors (collapsible, default open) 2. Filters (collapsible, default open) 3. Selection (collapsible, default open) 4. Transform (collapsible, default open) - **Tools Tab**: Contains: 1. Shape Settings (collapsible, default open) - **History Tab**: Contains: 1. History Panel (full height, not collapsible) Benefits: - More flexible space allocation - Layers Panel gets 50% of vertical space (was 400px fixed) - All adjustment features grouped together in one tab - Cleaner organization with collapsible sections - More canvas workspace visible by default - Consistent with professional image editor patterns Build Status: ✓ Successful (1330ms) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
123 lines
4.1 KiB
TypeScript
123 lines
4.1 KiB
TypeScript
'use client';
|
|
|
|
import { useState } from 'react';
|
|
import { ChevronDown, ChevronRight } from 'lucide-react';
|
|
import { LayersPanel } from '@/components/layers/layers-panel';
|
|
import { ColorPanel } from '@/components/colors';
|
|
import { FilterPanel } from '@/components/filters';
|
|
import { SelectionPanel } from '@/components/selection';
|
|
import { TransformPanel } from '@/components/transform';
|
|
import { ShapePanel } from '@/components/shapes';
|
|
import { HistoryPanel } from './history-panel';
|
|
|
|
interface CollapsibleSectionProps {
|
|
title: string;
|
|
children: React.ReactNode;
|
|
defaultOpen?: boolean;
|
|
}
|
|
|
|
function CollapsibleSection({ title, children, defaultOpen = true }: CollapsibleSectionProps) {
|
|
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
|
|
return (
|
|
<div className="border-b border-border">
|
|
<button
|
|
onClick={() => setIsOpen(!isOpen)}
|
|
className="w-full flex items-center justify-between p-3 hover:bg-accent/50 transition-colors"
|
|
>
|
|
<h3 className="text-sm font-semibold text-card-foreground">{title}</h3>
|
|
{isOpen ? (
|
|
<ChevronDown className="h-4 w-4 text-muted-foreground" />
|
|
) : (
|
|
<ChevronRight className="h-4 w-4 text-muted-foreground" />
|
|
)}
|
|
</button>
|
|
{isOpen && <div className="pb-2">{children}</div>}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export function PanelDock() {
|
|
const [activeTab, setActiveTab] = useState<'adjustments' | 'tools' | 'history'>('adjustments');
|
|
|
|
return (
|
|
<div className="w-[280px] border-l border-border bg-card flex flex-col overflow-hidden">
|
|
{/* Always visible: Layers Panel */}
|
|
<div className="border-b border-border" style={{ height: '50%', minHeight: '300px' }}>
|
|
<LayersPanel />
|
|
</div>
|
|
|
|
{/* Tabbed section */}
|
|
<div className="flex-1 flex flex-col overflow-hidden">
|
|
{/* Tab buttons */}
|
|
<div className="flex border-b border-border">
|
|
<button
|
|
onClick={() => setActiveTab('adjustments')}
|
|
className={`flex-1 px-4 py-2 text-sm font-medium transition-colors ${
|
|
activeTab === 'adjustments'
|
|
? 'bg-background text-foreground border-b-2 border-primary'
|
|
: 'text-muted-foreground hover:text-foreground hover:bg-accent/50'
|
|
}`}
|
|
>
|
|
Adjustments
|
|
</button>
|
|
<button
|
|
onClick={() => setActiveTab('tools')}
|
|
className={`flex-1 px-4 py-2 text-sm font-medium transition-colors ${
|
|
activeTab === 'tools'
|
|
? 'bg-background text-foreground border-b-2 border-primary'
|
|
: 'text-muted-foreground hover:text-foreground hover:bg-accent/50'
|
|
}`}
|
|
>
|
|
Tools
|
|
</button>
|
|
<button
|
|
onClick={() => setActiveTab('history')}
|
|
className={`flex-1 px-4 py-2 text-sm font-medium transition-colors ${
|
|
activeTab === 'history'
|
|
? 'bg-background text-foreground border-b-2 border-primary'
|
|
: 'text-muted-foreground hover:text-foreground hover:bg-accent/50'
|
|
}`}
|
|
>
|
|
History
|
|
</button>
|
|
</div>
|
|
|
|
{/* Tab content */}
|
|
<div className="flex-1 overflow-y-auto">
|
|
{activeTab === 'adjustments' && (
|
|
<div>
|
|
<CollapsibleSection title="Colors">
|
|
<ColorPanel />
|
|
</CollapsibleSection>
|
|
<CollapsibleSection title="Filters">
|
|
<FilterPanel />
|
|
</CollapsibleSection>
|
|
<CollapsibleSection title="Selection">
|
|
<SelectionPanel />
|
|
</CollapsibleSection>
|
|
<CollapsibleSection title="Transform">
|
|
<TransformPanel />
|
|
</CollapsibleSection>
|
|
</div>
|
|
)}
|
|
|
|
{activeTab === 'tools' && (
|
|
<div>
|
|
<CollapsibleSection title="Shape Settings">
|
|
<ShapePanel />
|
|
</CollapsibleSection>
|
|
</div>
|
|
)}
|
|
|
|
{activeTab === 'history' && (
|
|
<div className="h-full">
|
|
<HistoryPanel />
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|