Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 40 additions & 44 deletions src/components/TerminalsView/components/CustomTabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type { CustomTab, ActiveTab } from '../types';
interface CustomTabBarProps {
tabs: CustomTab[];
activeTab: ActiveTab;
canCreateTab: boolean;
onSelectTab: (tabId: string) => void;
onCreateTab: (name: string) => void;
onDeleteTab: (tabId: string) => void;
Expand All @@ -18,7 +17,6 @@ interface CustomTabBarProps {
export default function CustomTabBar({
tabs,
activeTab,
canCreateTab,
onSelectTab,
onCreateTab,
onDeleteTab,
Expand Down Expand Up @@ -181,50 +179,48 @@ export default function CustomTabBar({
))}

{/* Create tab button + dialog */}
{canCreateTab && (
<div className="relative shrink-0">
<button
onClick={() => { setShowCreateDialog(true); setCreateName(''); }}
className="flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-primary/5 transition-colors"
title="Create new board (max 5)"
>
<Plus className="w-3.5 h-3.5" />
</button>
<div className="relative shrink-0">
<button
onClick={() => { setShowCreateDialog(true); setCreateName(''); }}
className="flex items-center gap-1 px-2 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-primary/5 transition-colors"
title="Create new board"
>
<Plus className="w-3.5 h-3.5" />
</button>

{showCreateDialog && (
<div
ref={createDialogRef}
className="absolute top-full left-0 mt-1 bg-card border border-border shadow-xl z-50 p-3 min-w-[220px]"
>
<p className="text-xs text-muted-foreground mb-2">Board name</p>
<input
ref={createInputRef}
value={createName}
onChange={e => setCreateName(e.target.value)}
onKeyDown={handleCreateKeyDown}
placeholder="e.g. Frontend, Backend..."
className="w-full px-2 py-1.5 bg-secondary border border-border text-xs text-foreground placeholder:text-muted-foreground outline-none focus:border-white/30 mb-2"
maxLength={20}
/>
<div className="flex gap-2 justify-end">
<button
onClick={() => { setShowCreateDialog(false); setCreateName(''); }}
className="px-2.5 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-secondary transition-colors"
>
Cancel
</button>
<button
onClick={handleCreateSubmit}
disabled={!createName.trim()}
className="px-2.5 py-1 text-xs bg-foreground text-background font-medium hover:bg-foreground/90 transition-colors disabled:opacity-30 disabled:cursor-not-allowed"
>
Create
</button>
</div>
{showCreateDialog && (
<div
ref={createDialogRef}
className="absolute top-full left-0 mt-1 bg-card border border-border shadow-xl z-50 p-3 min-w-[220px]"
>
<p className="text-xs text-muted-foreground mb-2">Board name</p>
<input
ref={createInputRef}
value={createName}
onChange={e => setCreateName(e.target.value)}
onKeyDown={handleCreateKeyDown}
placeholder="e.g. Frontend, Backend..."
className="w-full px-2 py-1.5 bg-secondary border border-border text-xs text-foreground placeholder:text-muted-foreground outline-none focus:border-white/30 mb-2"
maxLength={20}
/>
<div className="flex gap-2 justify-end">
<button
onClick={() => { setShowCreateDialog(false); setCreateName(''); }}
className="px-2.5 py-1 text-xs text-muted-foreground hover:text-foreground hover:bg-secondary transition-colors"
>
Cancel
</button>
<button
onClick={handleCreateSubmit}
disabled={!createName.trim()}
className="px-2.5 py-1 text-xs bg-foreground text-background font-medium hover:bg-foreground/90 transition-colors disabled:opacity-30 disabled:cursor-not-allowed"
>
Create
</button>
</div>
)}
</div>
)}
</div>
)}
</div>
</div>
);
}
4 changes: 0 additions & 4 deletions src/components/TerminalsView/hooks/useTabManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { LAYOUT_PRESETS, getAutoLayout } from '../constants';
import { deleteTabLayouts } from './useGridLayoutStorage';

const STORAGE_KEY = 'terminals-tab-manager';
const MAX_TABS = 6;

interface TabManagerState {
customTabs: CustomTab[];
Expand Down Expand Up @@ -87,7 +86,6 @@ export function useTabManager({ existingAgentIds, isLoading }: UseTabManagerOpti

const createTab = useCallback((name: string) => {
setState(prev => {
if (prev.customTabs.length >= MAX_TABS) return prev;
const newTab: CustomTab = {
id: crypto.randomUUID(),
name: name || `Tab ${prev.customTabs.length + 1}`,
Expand Down Expand Up @@ -208,7 +206,6 @@ export function useTabManager({ existingAgentIds, isLoading }: UseTabManagerOpti

const isCustomTabActive = state.activeTab.type === 'custom';
const isProjectTabActive = state.activeTab.type === 'project';
const canCreateTab = state.customTabs.length < MAX_TABS;

return {
customTabs: state.customTabs,
Expand All @@ -225,6 +222,5 @@ export function useTabManager({ existingAgentIds, isLoading }: UseTabManagerOpti
activeProjectPath,
isCustomTabActive,
isProjectTabActive,
canCreateTab,
};
}
1 change: 0 additions & 1 deletion src/components/TerminalsView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ export default function TerminalsView() {
<CustomTabBar
tabs={tabManager.customTabs}
activeTab={tabManager.activeTab}
canCreateTab={tabManager.canCreateTab}
onSelectTab={(tabId) => tabManager.setActiveTab({ type: 'custom', tabId })}
onCreateTab={tabManager.createTab}
onDeleteTab={tabManager.deleteTab}
Expand Down
Loading