Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop): align chat tab strip (R1-M1)

Josué4d250381c77f
diff --git a/desktop-app/ui/src/components/ChatTabs/ChatTabs.test.tsx b/desktop-app/ui/src/components/ChatTabs/ChatTabs.test.tsx
index 69f49d837..92718a95d 100644
--- a/desktop-app/ui/src/components/ChatTabs/ChatTabs.test.tsx
+++ b/desktop-app/ui/src/components/ChatTabs/ChatTabs.test.tsx
@@ -1,6 +1,8 @@
// @vitest-environment jsdom
import { afterEach, describe, expect, it, vi } from 'vitest'
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { readFileSync } from 'node:fs'
+import path from 'node:path'
import { ChatTabs } from '.'
afterEach(cleanup)
@@ -30,4 +32,29 @@ describe('ChatTabs', () => {
expect(onSelect).toHaveBeenCalledWith('two')
expect(onClose).toHaveBeenCalledWith('one')
})
+
+ it('keeps long tab labels left-aligned, truncatable, and separate from close controls', () => {
+ const longTitle = 'A very long conversation title that must not overlap its close control'
+ const { container } = render(
+ <ChatTabs
+ tabs={[{ id: 'one', agentRef: 'alpha', chatId: 'chat-1', title: longTitle }]}
+ activeTabId="one"
+ onSelect={vi.fn()}
+ onClose={vi.fn()}
+ />
+ )
+
+ const select = screen.getByRole('button', { name: longTitle })
+ const label = container.querySelector('.chat-view-tab__label')
+ const close = screen.getByRole('button', { name: `Close ${longTitle}` })
+ expect(select.classList.contains('ui-button--align-start')).toBe(true)
+ expect(label?.textContent).toBe(longTitle)
+ expect(select.nextElementSibling).toBe(close)
+
+ const styles = readFileSync(path.join(process.cwd(), 'ui', 'src', 'styles.css'), 'utf8')
+ expect(styles).toMatch(/\.chat-view-tabs\s*\{[^}]*padding:\s*var\(--space-2\) 0 0;/s)
+ expect(styles).toMatch(/\.chat-view-tabs__list\s*\{[^}]*width:\s*100%;/s)
+ expect(styles).toMatch(/\.chat-view-tab__select\s*\{[^}]*flex:\s*1 1 auto;/s)
+ expect(styles).toMatch(/\.chat-view-tab__label\s*\{[^}]*text-overflow:\s*ellipsis;/s)
+ })
})
diff --git a/desktop-app/ui/src/components/ChatTabs/index.tsx b/desktop-app/ui/src/components/ChatTabs/index.tsx
index e42ca9018..11de2efcf 100644
--- a/desktop-app/ui/src/components/ChatTabs/index.tsx
+++ b/desktop-app/ui/src/components/ChatTabs/index.tsx
@@ -10,6 +10,7 @@ export function ChatTabs({ tabs, activeTabId, onSelect, onClose }: ChatTabsProps
return (
<div className={`chat-view-tab${active ? ' is-active' : ''}`} key={tab.id}>
<Button
+ align="start"
aria-pressed={active}
className="chat-view-tab__select"
color="neutral"
@@ -17,7 +18,7 @@ export function ChatTabs({ tabs, activeTabId, onSelect, onClose }: ChatTabsProps
size="sm"
variant="ghost"
>
- {tab.title}
+ <span className="chat-view-tab__label">{tab.title}</span>
</Button>
<Button
aria-label={`Close ${tab.title}`}
diff --git a/desktop-app/ui/src/styles.css b/desktop-app/ui/src/styles.css
index c4660d187..b14336b72 100644
--- a/desktop-app/ui/src/styles.css
+++ b/desktop-app/ui/src/styles.css
@@ -14890,7 +14890,8 @@ pre {
.chat-view-tabs {
display: flex;
min-width: 0;
- padding: var(--space-2) var(--space-3) 0;
+ padding: var(--space-2) 0 0;
+ width: 100%;
}
.chat-view-tabs__list {
@@ -14898,6 +14899,7 @@ pre {
gap: var(--space-1);
min-width: 0;
overflow-x: auto;
+ width: 100%;
}
.chat-view-tab {
@@ -14908,6 +14910,7 @@ pre {
display: flex;
flex: 0 0 auto;
max-width: 220px;
+ min-width: 0;
}
.chat-view-tab.is-active {
@@ -14916,9 +14919,17 @@ pre {
}
.chat-view-tab__select {
+ flex: 1 1 auto;
+ min-width: 0;
+ max-width: 100%;
+}
+
+.chat-view-tab__label {
+ display: block;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
+ text-align: left;
white-space: nowrap;
}