Skip to content

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

TypeScript

fix(control-ui): restore table header icon alignment

Josué1883771bbdac
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index 2e5160677..0a6a845b4 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -2460,11 +2460,19 @@ textarea.cu-input {
.cu-table-panel__title-row {
display: flex;
align-items: center;
- gap: var(--cu-space-1);
+ gap: var(--cu-space-2);
min-width: 0;
}
+.cu-table-panel__title-icon {
+ display: inline-flex;
+ flex: 0 0 auto;
+ align-items: center;
+ line-height: 0;
+}
+
.cu-table-panel__title-text {
+ flex: 0 1 auto;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
diff --git a/control-ui/components/TablePanelHeader/index.tsx b/control-ui/components/TablePanelHeader/index.tsx
index 90eff8896..109e291e6 100644
--- a/control-ui/components/TablePanelHeader/index.tsx
+++ b/control-ui/components/TablePanelHeader/index.tsx
@@ -1,10 +1,20 @@
'use client'
+import { Children, Fragment, isValidElement } from 'react'
+import type { ReactNode } from 'react'
import { DataViewHeader } from '@clerum/frontend-components'
import { cn } from '@lib/cn'
import { ClampedDescription } from './ClampedDescription'
import type { TablePanelHeaderProps } from './types'
+function flattenTitleNodes(title: ReactNode): ReactNode[] {
+ return Children.toArray(title).flatMap(node =>
+ isValidElement<{ children?: ReactNode }>(node) && node.type === Fragment
+ ? flattenTitleNodes(node.props.children)
+ : node
+ )
+}
+
/** Control UI compatibility adapter for the shared list header. */
export function TablePanelHeader({
actionsClassName,
@@ -16,6 +26,11 @@ export function TablePanelHeader({
title,
titleActions,
}: TablePanelHeaderProps) {
+ const titleNodes = flattenTitleNodes(title)
+ const [firstTitleNode, ...remainingTitleNodes] = titleNodes
+ const titleIcon = isValidElement(firstTitleNode) ? firstTitleNode : undefined
+ const titleText = titleIcon ? remainingTitleNodes : titleNodes
+
return (
<DataViewHeader
actions={
@@ -32,7 +47,8 @@ export function TablePanelHeader({
description={subtitle ? <ClampedDescription>{subtitle}</ClampedDescription> : undefined}
title={
<span className="cu-panel-title cu-table-panel__title-row">
- <span className="cu-table-panel__title-text">{title}</span>
+ {titleIcon ? <span className="cu-table-panel__title-icon">{titleIcon}</span> : null}
+ <span className="cu-table-panel__title-text">{titleText}</span>
{titleActions}
</span>
}
diff --git a/control-ui/components/__tests__/TablePanelHeader.test.tsx b/control-ui/components/__tests__/TablePanelHeader.test.tsx
index 24b2d919f..e6ed09699 100644
--- a/control-ui/components/__tests__/TablePanelHeader.test.tsx
+++ b/control-ui/components/__tests__/TablePanelHeader.test.tsx
@@ -25,6 +25,24 @@ describe('TablePanelHeader', () => {
)
})
+ it('keeps a section icon aligned and separate from the truncatable title text', () => {
+ render(
+ <TablePanelHeader
+ title={
+ <>
+ <svg aria-label="Agents icon" />
+ Agents (8)
+ </>
+ }
+ />
+ )
+
+ expect(screen.getByLabelText('Agents icon').parentElement).toHaveClass(
+ 'cu-table-panel__title-icon'
+ )
+ expect(screen.getByText('Agents (8)')).toHaveClass('cu-table-panel__title-text')
+ })
+
it('renders secondary actions, search, refresh, and the primary action in focus order', () => {
render(
<TablePanelHeader
@@ -53,6 +71,7 @@ describe('TablePanelHeader', () => {
/\.cu-table-panel__head\s+\.eft-data-view-header__actions\s*\{[^}]*flex:\s*0\s+0\s+auto/
)
expect(css).toMatch(/\.cu-table-panel__title-text\s*\{[^}]*text-overflow:\s*ellipsis/)
+ expect(css).toMatch(/\.cu-table-panel__title-icon\s*\{[^}]*align-items:\s*center/)
expect(css).toMatch(/\.cu-table-panel__description-value\s*\{[^}]*-webkit-line-clamp:\s*2/)
expect(css).toMatch(/\.cu-table-panel__description-tooltip\s*\{[^}]*inset-inline:\s*0/)
expect(css).not.toMatch(
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 6e19a7ac7..03eccd756 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.576",
+ "version": "0.1.577",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.576",
+ "version": "0.1.577",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/control-ui/package.json b/control-ui/package.json
index 3d70dd5e1..3028160ce 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.576",
+ "version": "0.1.577",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",