Skip to content

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

TypeScript

fix(desktop): distinguish selected chat tabs

Josuéaf922ca9906c
diff --git a/desktop-app/test/native/chat-workspace-geometry.fixture.cjs b/desktop-app/test/native/chat-workspace-geometry.fixture.cjs
index e876960a6..c20eb1d3a 100644
--- a/desktop-app/test/native/chat-workspace-geometry.fixture.cjs
+++ b/desktop-app/test/native/chat-workspace-geometry.fixture.cjs
@@ -22,6 +22,10 @@ async function geometry(window) {
const surfaceStyle = getComputedStyle(document.querySelector('.chat-view-surface'))
const activeTab = document.querySelector('.chat-view-tab.is-active')
const activeStyle = getComputedStyle(activeTab)
+ const inactiveStyle = getComputedStyle(document.querySelector('.chat-view-tab:not(.is-active)'))
+ const inactiveBorderReferenceStyle = getComputedStyle(
+ document.querySelector('[data-inactive-tab-border-reference]')
+ )
const activeSeamStyle = getComputedStyle(activeTab, '::after')
const activeSelectStyle = getComputedStyle(
document.querySelector('.chat-view-tab.is-active .chat-view-tab__select')
@@ -42,6 +46,11 @@ async function geometry(window) {
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,
@@ -58,11 +67,41 @@ async function geometry(window) {
surfaceTop: surface.top,
surfaceWidth: surface.width,
tabsBottom: tabs.bottom,
+ theme: document.documentElement.dataset.theme,
workspaceWidth: workspace.width,
}
})()`)
}
+function assertTabTreatment(state, theme) {
+ assert.equal(state.theme, theme, `${theme} theme is applied`)
+ assert.notEqual(
+ state.activeBackground,
+ state.inactiveBackground,
+ `${theme} active tab remains visually distinct`
+ )
+ assert.notEqual(
+ state.activeBorderTop,
+ state.inactiveBorderTop,
+ `${theme} active tab keeps its selected border treatment`
+ )
+ assert.equal(
+ state.inactiveBorderBottomStyle,
+ 'none',
+ `${theme} inactive tabs have no bottom border`
+ )
+ assert.equal(
+ state.inactiveBorderBottomWidth,
+ '0px',
+ `${theme} inactive tabs have no bottom-border width`
+ )
+ assert.equal(
+ state.inactiveBorderTop,
+ state.inactiveBorderReferenceTop,
+ `${theme} inactive tabs use 25% of the normal border color`
+ )
+}
+
async function hover(window, selector) {
const point = await window.webContents.executeJavaScript(`(() => {
const rect = document.querySelector(${JSON.stringify(selector)}).getBoundingClientRect()
@@ -77,7 +116,11 @@ app.whenReady().then(async () => {
try {
const tokens = readFileSync(path.join(__dirname, '../../ui/src/styles/tokens.css'), 'utf8')
const css = readFileSync(path.join(__dirname, '../../ui/src/styles.css'), 'utf8')
- const html = `<!doctype html><style>${tokens}\n${css}</style>
+ const html = `<!doctype html><html data-theme="dark"><style>${tokens}\n${css}</style>
+ <div
+ data-inactive-tab-border-reference
+ style="border-top: 1px solid color-mix(in srgb, var(--border-soft) 25%, transparent); position: fixed; visibility: hidden"
+ ></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">
@@ -95,6 +138,7 @@ app.whenReady().then(async () => {
await window.loadURL(`data:text/html;charset=utf-8,${encodeURIComponent(html)}`)
const wide = await geometry(window)
+ assertTabTreatment(wide, 'dark')
assert.ok(
Math.abs(wide.surfaceWidth - wide.workspaceWidth) <= 1,
'wide surface stays full width'
@@ -125,6 +169,17 @@ app.whenReady().then(async () => {
'conversation top border is hidden beneath the active tab'
)
+ await window.webContents.executeJavaScript(
+ "document.documentElement.setAttribute('data-theme', 'light')"
+ )
+ const light = await geometry(window)
+ assertTabTreatment(light, 'light')
+ assert.equal(
+ light.activeSeamBackground,
+ light.activeBackground,
+ 'light theme conversation top border is hidden beneath the active tab'
+ )
+
await hover(window, '.chat-view-tab.is-active .chat-view-tab__close')
const closeHover = await geometry(window)
assert.notEqual(
diff --git a/desktop-app/ui/src/styles.css b/desktop-app/ui/src/styles.css
index 978b81286..2422f1220 100644
--- a/desktop-app/ui/src/styles.css
+++ b/desktop-app/ui/src/styles.css
@@ -14960,6 +14960,7 @@ pre {
min-width: 0;
overflow-x: auto;
overflow-y: hidden;
+ transform: rotateX(180deg);
width: 100%;
}
@@ -14972,9 +14973,15 @@ pre {
flex: 0 0 auto;
max-width: 220px;
min-width: 0;
+ transform: rotateX(180deg);
transition: background var(--motion-fast);
}
+.chat-view-tab:not(.is-active) {
+ border-bottom: 0;
+ border-color: color-mix(in srgb, var(--border-soft) 25%, transparent);
+}
+
.chat-view-tab.is-active {
background: var(--surface-strong);
border-color: var(--chat-view-selected-border);