feat: multi-session terminal frontend UI + tests (PR 3)

- Add TerminalSessionTabs component with status dots, rename, close, max-5 limit
- Add 7 component tests for tab rendering, selection, close, rename
- TerminalComponent: sessionId prop, forwardRef with fit() method
- TerminalPage: multi-session orchestration, tab switching, auto-create default
- Fullscreen mode: Alt+Shift+F toggle, auto-hide tabs, Esc exit
- Keyboard shortcuts: Alt+Shift+N/W/ArrowLeft/ArrowRight/R
- Add CSS for tabs, fullscreen, mobile responsive
- Update useTerminalSessions hook for session CRUD
- terminal_manager.py: lookup by internal session_id fallback

Quality gates: tsc --noEmit clean, vitest (7/7 new tests passed), pytest (182 passed)
This commit is contained in:
2026-05-28 13:35:45 +02:00
parent 0b35ae3bf0
commit 62d1bdc462
26 changed files with 4589 additions and 775 deletions
+248
View File
@@ -2663,6 +2663,254 @@ a.nav-item,
}
}
/* ============================================
Terminal Session Tabs
============================================ */
.terminal-session-tabs {
display: flex;
flex-shrink: 0;
background: #2d2d2d;
border-bottom: 1px solid #3e3e3e;
overflow: hidden;
}
.terminal-session-tabs.mobile {
background: #1e1e1e;
}
.terminal-session-tabs-scroll {
display: flex;
gap: 2px;
padding: var(--space-1) var(--space-2);
overflow-x: auto;
scrollbar-width: thin;
scrollbar-color: #555 transparent;
flex: 1;
min-width: 0;
}
.terminal-session-tabs-scroll::-webkit-scrollbar {
height: 4px;
}
.terminal-session-tabs-scroll::-webkit-scrollbar-thumb {
background: #555;
border-radius: 2px;
}
.terminal-session-tab {
display: flex;
align-items: center;
gap: var(--space-1);
padding: var(--space-1) var(--space-2);
border: 1px solid transparent;
border-radius: 6px;
background: transparent;
color: #888;
cursor: pointer;
font-size: 0.8125rem;
white-space: nowrap;
transition: background 0.15s, color 0.15s, border-color 0.15s;
user-select: none;
min-width: 0;
}
.terminal-session-tab:hover {
background: #3e3e3e;
color: #ccc;
}
.terminal-session-tab.active {
background: #1e1e1e;
color: #d4d4d4;
border-color: #3e3e3e;
}
.terminal-session-tab-status {
width: 6px;
height: 6px;
border-radius: 50%;
flex-shrink: 0;
}
.terminal-session-tab-status.connecting {
background: #f5f543;
animation: pulse 1.5s infinite;
}
.terminal-session-tab-status.connected {
background: #0dbc79;
}
.terminal-session-tab-status.disconnected,
.terminal-session-tab-status.error {
background: #cd3131;
}
.terminal-session-tab-name {
max-width: 120px;
overflow: hidden;
text-overflow: ellipsis;
}
.terminal-session-tab-input {
background: #1e1e1e;
border: 1px solid var(--brand);
border-radius: 4px;
color: #d4d4d4;
font-size: 0.8125rem;
padding: 1px 4px;
width: 100px;
outline: none;
}
.terminal-session-tab-close {
display: flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
padding: 0;
margin: 0;
background: transparent;
border: none;
color: #888;
cursor: pointer;
font-size: 0.875rem;
line-height: 1;
border-radius: 3px;
opacity: 0;
transition: opacity 0.15s, background 0.15s;
}
.terminal-session-tab:hover .terminal-session-tab-close {
opacity: 1;
}
.terminal-session-tab-close:hover {
background: #cd3131;
color: white;
}
.terminal-session-tab-confirm {
font-size: 0.6875rem;
color: #cd3131;
padding: 1px 4px;
border-radius: 3px;
background: rgba(205, 49, 49, 0.15);
white-space: nowrap;
}
.terminal-session-tab.new-session {
font-weight: 600;
font-size: 1rem;
line-height: 1;
padding: var(--space-1) var(--space-2);
color: #888;
}
.terminal-session-tab.new-session:hover {
background: #3e3e3e;
color: #d4d4d4;
}
.terminal-session-tab.new-session:disabled {
opacity: 0.4;
cursor: not-allowed;
}
/* Terminal page with multi-session */
.terminal-page-content {
display: flex;
flex-direction: column;
flex: 1;
min-height: 0;
border: 1px solid var(--border);
border-radius: 10px;
overflow: hidden;
background: #1e1e1e;
}
.terminal-instance {
flex: 1;
min-height: 0;
display: none;
}
.terminal-instance.active {
display: flex;
}
.terminal-empty-state {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
color: #888;
font-size: 0.875rem;
}
.terminal-error-banner {
padding: var(--space-2) var(--space-4);
background: var(--danger-light);
color: var(--danger);
font-size: 0.875rem;
border-bottom: 1px solid var(--danger-light);
}
/* Fullscreen mode */
.terminal-page.fullscreen {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1000;
padding: 0;
gap: 0;
background: #1e1e1e;
}
.terminal-page.fullscreen .terminal-page-content {
border: none;
border-radius: 0;
}
.terminal-page.fullscreen .terminal-session-tabs {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 10;
opacity: 0;
transition: opacity 0.3s;
}
.terminal-page.fullscreen .terminal-session-tabs:hover {
opacity: 1;
}
/* Mobile fullscreen */
@media (max-width: 767px) {
.terminal-page.fullscreen {
padding: 0;
}
.terminal-page.mobile .terminal-page-header {
padding: var(--space-2);
gap: var(--space-2);
}
.terminal-page.mobile .terminal-page-header h1 {
font-size: 1rem;
}
.terminal-session-tab-name {
max-width: 80px;
}
}
/* ============================================
Sessions Page Styles
============================================ */