Skip to content

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

TypeScript

fix(desktop): r2-b1 redesign selected tab seam

Josuéab9051e7d82f
diff --git a/desktop-app/test/native/chat-workspace-geometry.fixture.cjs b/desktop-app/test/native/chat-workspace-geometry.fixture.cjs
index a8ccc35ba..efcfe7891 100644
--- a/desktop-app/test/native/chat-workspace-geometry.fixture.cjs
+++ b/desktop-app/test/native/chat-workspace-geometry.fixture.cjs
@@ -5,8 +5,8 @@ const { app, BrowserWindow } = require('electron')
function tab(title, active = false) {
return `<div class="chat-view-tab${active ? ' is-active' : ''}">
- <button class="ui-button chat-view-tab__select"><span class="chat-view-tab__label">${title}</span></button>
- <button class="ui-button chat-view-tab__close" aria-label="Close ${title}">×</button>
+ <button class="ui-button ui-button--ghost ui-button--neutral ui-button--sm ui-button--align-start chat-view-tab__select"><span class="chat-view-tab__label">${title}</span></button>
+ <button class="ui-button ui-button--ghost ui-button--neutral ui-button--xs ui-button--align-center chat-view-tab__close" aria-label="Close ${title}">×</button>
</div>`
}
@@ -17,12 +17,12 @@ async function geometry(window) {
const workspace = document.querySelector('.chat-view-workspace').getBoundingClientRect()
const tabs = document.querySelector('.chat-view-tabs').getBoundingClientRect()
const active = document.querySelector('.chat-view-tab.is-active').getBoundingClientRect()
- const list = document.querySelector('.chat-view-tabs__list')
+ const scroller = document.querySelector('.chat-view-tabs__scroller')
const surface = document.querySelector('.chat-view-surface').getBoundingClientRect()
const surfaceStyle = getComputedStyle(document.querySelector('.chat-view-surface'))
const activeTab = document.querySelector('.chat-view-tab.is-active')
const activeStyle = getComputedStyle(activeTab)
- const activeSeamStyle = getComputedStyle(activeTab, '::after')
+ const listSeamStyle = getComputedStyle(document.querySelector('.chat-view-tabs__list'), '::after')
const inactiveStyle = getComputedStyle(document.querySelector('.chat-view-tab:not(.is-active)'))
const inactiveBorderReferenceStyle = getComputedStyle(
document.querySelector('[data-inactive-tab-border-reference]')
@@ -36,25 +36,26 @@ async function geometry(window) {
return {
activeBottom: active.bottom,
activeBackground: activeStyle.backgroundColor,
+ activeBackgroundImage: activeStyle.backgroundImage,
activeBorderBottom: activeStyle.borderBottomColor,
activeBorderBottomStyle: activeStyle.borderBottomStyle,
activeBorderBottomWidth: activeStyle.borderBottomWidth,
activeBorderTop: activeStyle.borderTopColor,
activeBorderTopStyle: activeStyle.borderTopStyle,
activeCloseBackground: activeCloseStyle.backgroundColor,
- activeSeamBackground: activeSeamStyle.backgroundColor,
- activeSeamBottom: activeSeamStyle.bottom,
- activeSeamHeight: activeSeamStyle.height,
- activeSeamPosition: activeSeamStyle.position,
activeSelectBackground: activeSelectStyle.backgroundColor,
inactiveBackground: inactiveStyle.backgroundColor,
inactiveBorderBottomStyle: inactiveStyle.borderBottomStyle,
inactiveBorderBottomWidth: inactiveStyle.borderBottomWidth,
inactiveBorderTop: inactiveStyle.borderTopColor,
inactiveBorderReferenceTop: inactiveBorderReferenceStyle.borderTopColor,
- listClientWidth: list.clientWidth,
- listOverflowX: getComputedStyle(list).overflowX,
- listScrollWidth: list.scrollWidth,
+ listClientWidth: scroller.clientWidth,
+ listOverflowX: getComputedStyle(scroller).overflowX,
+ listSeamBackground: listSeamStyle.backgroundColor,
+ listSeamBottom: listSeamStyle.bottom,
+ listSeamHeight: listSeamStyle.height,
+ listSeamPosition: listSeamStyle.position,
+ listScrollWidth: scroller.scrollWidth,
panelPaddingLeft: panelStyle.paddingLeft,
surfaceBackground: surfaceStyle.backgroundColor,
surfaceBorderBottom: surfaceStyle.borderBottomColor,
@@ -74,6 +75,57 @@ async function geometry(window) {
})()`)
}
+async function paintedSeam(window) {
+ const targets = await window.webContents.executeJavaScript(`(() => {
+ const active = document.querySelector('.chat-view-tab.is-active').getBoundingClientRect()
+ const surface = document.querySelector('.chat-view-surface').getBoundingClientRect()
+ return {
+ activeCenterX: active.left + active.width / 2,
+ outsideX: Math.min(surface.right - 4, active.right + 8),
+ seamRows: [surface.top - 1, surface.top],
+ selectedFillY: active.bottom - 3,
+ surfaceFillY: surface.top + 3,
+ viewportHeight: window.innerHeight,
+ viewportWidth: window.innerWidth,
+ }
+ })()`)
+ const image = await window.webContents.capturePage()
+ const bitmap = image.toBitmap()
+ const size = image.getSize()
+ const scaleX = size.width / targets.viewportWidth
+ const scaleY = size.height / targets.viewportHeight
+
+ function pixel(cssX, cssY) {
+ const x = Math.min(size.width - 1, Math.max(0, Math.floor(cssX * scaleX)))
+ const y = Math.min(size.height - 1, Math.max(0, Math.floor(cssY * scaleY)))
+ const offset = (y * size.width + x) * 4
+ return [bitmap[offset + 2], bitmap[offset + 1], bitmap[offset], bitmap[offset + 3]]
+ }
+
+ const outsideFill = pixel(targets.outsideX, targets.surfaceFillY)
+ const seamRow = targets.seamRows
+ .map(cssY => ({
+ cssY,
+ outsideBorder: pixel(targets.outsideX, cssY),
+ }))
+ .sort(
+ (left, right) =>
+ colorDistance(right.outsideBorder, outsideFill) -
+ colorDistance(left.outsideBorder, outsideFill)
+ )[0]
+
+ return {
+ outsideBorder: seamRow.outsideBorder,
+ outsideFill,
+ selectedSeam: pixel(targets.activeCenterX, seamRow.cssY),
+ selectedFill: pixel(targets.activeCenterX, targets.selectedFillY),
+ }
+}
+
+function colorDistance(left, right) {
+ return Math.max(...left.map((channel, index) => Math.abs(channel - right[index])))
+}
+
function assertTabTreatment(state, theme) {
assert.equal(state.theme, theme, `${theme} theme is applied`)
assert.notEqual(
@@ -124,11 +176,13 @@ app.whenReady().then(async () => {
></div>
<main class="content-panel content-panel--agent-chat" style="width:100%;height:600px">
<section class="chat-view-workspace">
- <div class="chat-view-tabs" role="toolbar"><div class="chat-view-tabs__list">
- ${tab('First chat', true)}
- ${tab('A long second conversation title')}
- ${tab('A long third conversation title')}
- ${tab('A long fourth conversation title')}
+ <div class="chat-view-tabs" role="toolbar"><div class="chat-view-tabs__scroller">
+ <div class="chat-view-tabs__list">
+ ${tab('First chat', true)}
+ ${tab('A long second conversation title')}
+ ${tab('A long third conversation title')}
+ ${tab('A long fourth conversation title')}
+ </div>
</div></div>
<section class="chat-view-surface">
<div class="current-content-search">Current chat find</div>
@@ -139,6 +193,7 @@ app.whenReady().then(async () => {
await window.loadURL(`data:text/html;charset=utf-8,${encodeURIComponent(html)}`)
const wide = await geometry(window)
+ const darkPaint = await paintedSeam(window)
assertTabTreatment(wide, 'dark')
assert.ok(
Math.abs(wide.surfaceWidth - wide.workspaceWidth) <= 1,
@@ -165,23 +220,28 @@ app.whenReady().then(async () => {
assert.equal(wide.activeBorderTopStyle, 'solid', 'active tab keeps its top border')
assert.equal(wide.activeBorderBottomStyle, 'none', 'active tab has no bottom border')
assert.equal(wide.activeBorderBottomWidth, '0px', 'active tab bottom edge has no width')
- assert.equal(wide.activeSeamPosition, 'absolute', 'active tab owns the surface border mask')
- assert.equal(
- wide.activeSeamBottom,
- '-1px',
- 'surface border mask extends beneath the active tab'
+ assert.ok(
+ colorDistance(darkPaint.selectedSeam, darkPaint.selectedFill) <
+ colorDistance(darkPaint.outsideBorder, darkPaint.outsideFill) / 2,
+ 'selected tab visibly masks the surface border beneath its own span'
)
- assert.equal(wide.activeSeamHeight, '1px', 'surface border mask covers one border row')
+ assert.ok(
+ colorDistance(darkPaint.outsideBorder, darkPaint.outsideFill) >= 5,
+ 'surface border remains visibly painted outside the selected tab'
+ )
+ assert.equal(wide.listSeamPosition, 'absolute', 'tab list owns the shared surface seam')
+ assert.equal(wide.listSeamBottom, '0px', 'shared seam occupies the tab row lower edge')
+ assert.equal(wide.listSeamHeight, '1px', 'shared seam paints exactly one border row')
assert.equal(
- wide.activeSeamBackground,
- wide.activeBackground,
- 'surface border is hidden beneath the connected active tab'
+ wide.listSeamBackground,
+ wide.surfaceBorderTop,
+ 'shared seam uses the selected surface border treatment'
)
-
await window.webContents.executeJavaScript(
"document.documentElement.setAttribute('data-theme', 'light')"
)
const light = await geometry(window)
+ const lightPaint = await paintedSeam(window)
assertTabTreatment(light, 'light')
assert.equal(
light.activeBorderTop,
@@ -189,16 +249,25 @@ app.whenReady().then(async () => {
'light active tab shares the surface border'
)
assert.equal(
- light.activeSeamBackground,
- light.activeBackground,
- 'light surface border is hidden beneath the connected active tab'
+ light.listSeamBackground,
+ light.surfaceBorderTop,
+ 'light shared seam uses the selected surface border treatment'
+ )
+ assert.ok(
+ colorDistance(lightPaint.selectedSeam, lightPaint.selectedFill) <
+ colorDistance(lightPaint.outsideBorder, lightPaint.outsideFill) / 2,
+ 'light selected tab visibly masks the surface border beneath its own span'
+ )
+ assert.ok(
+ colorDistance(lightPaint.outsideBorder, lightPaint.outsideFill) >= 5,
+ 'light surface border remains visibly painted outside the selected tab'
)
await hover(window, '.chat-view-tab.is-active .chat-view-tab__close')
const closeHover = await geometry(window)
assert.notEqual(
- closeHover.activeBackground,
- wide.activeBackground,
+ closeHover.activeBackgroundImage,
+ wide.activeBackgroundImage,
'hovering the close area fills the whole tab'
)
assert.equal(
@@ -211,17 +280,11 @@ app.whenReady().then(async () => {
'rgba(0, 0, 0, 0)',
'the close button does not own a partial hover fill'
)
- assert.equal(
- closeHover.activeSeamBackground,
- closeHover.activeBackground,
- 'hover keeps the surface border masked beneath the complete tab fill'
- )
-
await hover(window, '.chat-view-tab.is-active .chat-view-tab__select')
const labelHover = await geometry(window)
assert.equal(
- labelHover.activeBackground,
- closeHover.activeBackground,
+ labelHover.activeBackgroundImage,
+ closeHover.activeBackgroundImage,
'label and close hover fill the same complete tab surface'
)
assert.equal(
@@ -233,6 +296,7 @@ app.whenReady().then(async () => {
window.setSize(420, 700)
await new Promise(resolve => setTimeout(resolve, 50))
const narrow = await geometry(window)
+ const narrowPaint = await paintedSeam(window)
assert.equal(narrow.listOverflowX, 'auto', 'only the tab list owns horizontal overflow')
assert.ok(narrow.listScrollWidth > narrow.listClientWidth, 'long narrow tabs remain scrollable')
assert.ok(
@@ -243,6 +307,15 @@ app.whenReady().then(async () => {
Math.abs(narrow.surfaceTop - narrow.activeBottom) <= 1,
'narrow active tab and selected surface share one border row'
)
+ assert.ok(
+ colorDistance(narrowPaint.selectedSeam, narrowPaint.selectedFill) <
+ colorDistance(narrowPaint.outsideBorder, narrowPaint.outsideFill) / 2,
+ 'narrow selected tab visibly masks the surface border beneath its own span'
+ )
+ assert.ok(
+ colorDistance(narrowPaint.outsideBorder, narrowPaint.outsideFill) >= 5,
+ 'narrow surface border remains visibly painted outside the selected tab'
+ )
assert.equal(narrow.surfaceBorderLeftStyle, 'solid', 'narrow surface keeps its left border')
assert.equal(narrow.surfaceBorderRightStyle, 'solid', 'narrow surface keeps its right border')
diff --git a/desktop-app/ui/src/components/ChatTabs/ChatTabs.test.tsx b/desktop-app/ui/src/components/ChatTabs/ChatTabs.test.tsx
index 7e1a824cc..754923a8a 100644
--- a/desktop-app/ui/src/components/ChatTabs/ChatTabs.test.tsx
+++ b/desktop-app/ui/src/components/ChatTabs/ChatTabs.test.tsx
@@ -48,15 +48,19 @@ describe('ChatTabs', () => {
)
const select = screen.getByRole('button', { name: longTitle })
+ const scroller = container.querySelector('.chat-view-tabs__scroller')
+ const list = container.querySelector('.chat-view-tabs__list')
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)
+ expect(scroller?.firstElementChild).toBe(list)
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-tabs__scroller\s*\{[^}]*width:\s*100%;/s)
+ expect(styles).toMatch(/\.chat-view-tabs__list\s*\{[^}]*width:\s*max-content;/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 b38b35d86..0ce507c78 100644
--- a/desktop-app/ui/src/components/ChatTabs/index.tsx
+++ b/desktop-app/ui/src/components/ChatTabs/index.tsx
@@ -10,42 +10,44 @@ export function ChatTabs({ tabs, activeTabId, onSelect, onClose, panelId }: Chat
return (
<div className="chat-view-tabs" role="toolbar" aria-label="Chat tabs">
- <div className="chat-view-tabs__list">
- {tabs.map(tab => {
- const active = tab.id === activeTabId
- const sessionState =
- tab.agentRef && tab.chatId
- ? chatList?.sessionStateByChatKey[makeTaskKey(tab.agentRef, tab.chatId)]
- : undefined
- return (
- <div className={`chat-view-tab${active ? ' is-active' : ''}`} key={tab.id}>
- <Button
- align="start"
- aria-controls={active ? panelId : undefined}
- aria-label={tab.title}
- aria-pressed={active}
- className="chat-view-tab__select"
- color="neutral"
- onClick={() => onSelect(tab.id)}
- size="sm"
- variant="ghost"
- >
- <ChatStateBadge sessionState={sessionState} unreadTerminal={false} />
- <span className="chat-view-tab__label">{tab.title}</span>
- </Button>
- <Button
- aria-label={`Close ${tab.title}`}
- className="chat-view-tab__close"
- color="neutral"
- onClick={() => onClose(tab.id)}
- size="xs"
- variant="ghost"
- >
- <span aria-hidden="true">×</span>
- </Button>
- </div>
- )
- })}
+ <div className="chat-view-tabs__scroller">
+ <div className="chat-view-tabs__list">
+ {tabs.map(tab => {
+ const active = tab.id === activeTabId
+ const sessionState =
+ tab.agentRef && tab.chatId
+ ? chatList?.sessionStateByChatKey[makeTaskKey(tab.agentRef, tab.chatId)]
+ : undefined
+ return (
+ <div className={`chat-view-tab${active ? ' is-active' : ''}`} key={tab.id}>
+ <Button
+ align="start"
+ aria-controls={active ? panelId : undefined}
+ aria-label={tab.title}
+ aria-pressed={active}
+ className="chat-view-tab__select"
+ color="neutral"
+ onClick={() => onSelect(tab.id)}
+ size="sm"
+ variant="ghost"
+ >
+ <ChatStateBadge sessionState={sessionState} unreadTerminal={false} />
+ <span className="chat-view-tab__label">{tab.title}</span>
+ </Button>
+ <Button
+ aria-label={`Close ${tab.title}`}
+ className="chat-view-tab__close"
+ color="neutral"
+ onClick={() => onClose(tab.id)}
+ size="xs"
+ variant="ghost"
+ >
+ <span aria-hidden="true">×</span>
+ </Button>
+ </div>
+ )
+ })}
+ </div>
</div>
</div>
)
diff --git a/desktop-app/ui/src/components/ChatViewWorkspace/ChatViewWorkspace.test.tsx b/desktop-app/ui/src/components/ChatViewWorkspace/ChatViewWorkspace.test.tsx
index d3fb984ab..06effbaa3 100644
--- a/desktop-app/ui/src/components/ChatViewWorkspace/ChatViewWorkspace.test.tsx
+++ b/desktop-app/ui/src/components/ChatViewWorkspace/ChatViewWorkspace.test.tsx
@@ -51,14 +51,15 @@ describe('ChatViewWorkspace', () => {
const { container } = renderWorkspace('active chat', <div role="search">Current chat find</div>)
const surface = screen.getByRole('region', { name: 'Current chat' })
const active = screen.getByRole('button', { name: 'First chat' })
- const list = container.querySelector('.chat-view-tabs__list') as HTMLElement
+ const scroller = container.querySelector('.chat-view-tabs__scroller') as HTMLElement
expect(active.getAttribute('aria-controls')).toBe(surface.id)
expect(surface.getAttribute('data-selected-surface')).toBe('chat')
expect(surface.contains(screen.getByRole('search'))).toBe(true)
expect(surface.contains(screen.getByTestId('chat-state'))).toBe(true)
- expect(getComputedStyle(list).overflowX).toBe('auto')
+ expect(getComputedStyle(scroller).overflowX).toBe('auto')
expect(getComputedStyle(surface).borderTopStyle).toBe('solid')
+ expect(getComputedStyle(surface).borderTopWidth).toBe('0px')
expect(getComputedStyle(surface).borderLeftStyle).toBe('solid')
expect(getComputedStyle(surface).borderRightStyle).toBe('solid')
expect(getComputedStyle(surface).borderBottomStyle).toBe('solid')
@@ -78,12 +79,12 @@ describe('ChatViewWorkspace', () => {
it('keeps tab overflow separate from a full-width surface at narrow widths', () => {
const { container } = renderWorkspace('narrow chat')
const workspace = container.querySelector('.chat-view-workspace') as HTMLElement
- const list = container.querySelector('.chat-view-tabs__list') as HTMLElement
+ const scroller = container.querySelector('.chat-view-tabs__scroller') as HTMLElement
const surface = screen.getByRole('region', { name: 'Current chat' })
workspace.style.width = '320px'
expect(getComputedStyle(workspace).display).toBe('flex')
- expect(getComputedStyle(list).overflowX).toBe('auto')
+ expect(getComputedStyle(scroller).overflowX).toBe('auto')
expect(getComputedStyle(surface).width).toBe('100%')
expect(screen.getByText(/A second conversation/)).toBeTruthy()
expect(screen.getByRole('button', { name: /Close A second conversation/ })).toBeTruthy()
diff --git a/desktop-app/ui/src/styles.css b/desktop-app/ui/src/styles.css
index 048660ac9..fffa08560 100644
--- a/desktop-app/ui/src/styles.css
+++ b/desktop-app/ui/src/styles.css
@@ -14954,9 +14954,7 @@ pre {
z-index: 1;
}
-.chat-view-tabs__list {
- display: flex;
- gap: var(--space-1);
+.chat-view-tabs__scroller {
min-width: 0;
overflow-x: auto;
overflow-y: hidden;
@@ -14964,6 +14962,26 @@ pre {
width: 100%;
}
+.chat-view-tabs__list {
+ display: flex;
+ gap: var(--space-1);
+ min-width: 100%;
+ position: relative;
+ transform: rotateX(180deg);
+ width: max-content;
+}
+
+.chat-view-tabs__list::after {
+ background: var(--chat-view-selected-border);
+ bottom: 0;
+ content: '';
+ height: 1px;
+ left: 0;
+ pointer-events: none;
+ position: absolute;
+ right: 0;
+}
+
.chat-view-tab {
align-items: center;
background: var(--surface-soft);
@@ -14973,7 +14991,6 @@ pre {
flex: 0 0 auto;
max-width: 220px;
min-width: 0;
- transform: rotateX(180deg);
transition: background var(--motion-fast);
}
@@ -14983,29 +15000,21 @@ pre {
}
.chat-view-tab.is-active {
- background: var(--surface-strong);
+ background: linear-gradient(var(--surface-strong), var(--surface-strong)), var(--panel);
border-color: var(--chat-view-selected-border);
border-bottom: 0;
- margin-top: -1px;
position: relative;
z-index: 1;
}
-.chat-view-tab.is-active::after {
- background: inherit;
- bottom: -1px;
- content: '';
- height: 1px;
- left: 0;
- pointer-events: none;
- position: absolute;
- right: 0;
-}
-
.chat-view-tab:hover {
background: var(--surface-hover);
}
+.chat-view-tab.is-active:hover {
+ background: linear-gradient(var(--surface-hover), var(--surface-hover)), var(--panel);
+}
+
.chat-view-tab .chat-view-tab__select.ui-button:hover:enabled,
.chat-view-tab .chat-view-tab__close.ui-button:hover:enabled {
background: transparent;
@@ -15046,7 +15055,7 @@ pre {
background: var(--surface-strong);
border-color: var(--chat-view-selected-border);
border-style: solid;
- border-width: 1px;
+ border-width: 0 1px 1px;
border-radius: 0 var(--radius-sm) 0 0;
display: flex;
flex: 1 1 0;