Skip to content

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

TypeScript

fix(desktop): keep app header controls clear

Josuéb853f47970e9
diff --git a/desktop-app/ui/src/components/AppHeader/__tests__/notifications.test.tsx b/desktop-app/ui/src/components/AppHeader/__tests__/notifications.test.tsx
index fa1d9c2a4..fddb1412f 100644
--- a/desktop-app/ui/src/components/AppHeader/__tests__/notifications.test.tsx
+++ b/desktop-app/ui/src/components/AppHeader/__tests__/notifications.test.tsx
@@ -73,6 +73,7 @@ describe('AppHeader notification tray presentation', () => {
cleanup()
notificationMocks.notifications.length = 0
vi.clearAllMocks()
+ vi.unstubAllGlobals()
})
it('opens a notification when its card surface is clicked', () => {
@@ -215,4 +216,16 @@ describe('AppHeader notification tray presentation', () => {
.classList.contains('notification-menu--app-drawer')
).toBe(false)
})
+
+ it('uses a compact search label at constrained widths while retaining the full hover text', () => {
+ vi.stubGlobal('innerWidth', 1200)
+
+ render(<AppHeader />)
+
+ const search = screen.getByRole('textbox', { name: 'Search' })
+ expect(search.getAttribute('placeholder')).toBe('Search workspace...')
+ expect(search.getAttribute('title')).toBe(
+ 'Search teams, contexts, members, agents or connectors...'
+ )
+ })
})
diff --git a/desktop-app/ui/src/components/AppHeader/index.tsx b/desktop-app/ui/src/components/AppHeader/index.tsx
index 856379a01..973485cc4 100644
--- a/desktop-app/ui/src/components/AppHeader/index.tsx
+++ b/desktop-app/ui/src/components/AppHeader/index.tsx
@@ -19,6 +19,10 @@ import type {
SearchTeamResult,
} from './types'
+const FULL_SEARCH_PLACEHOLDER = 'Search teams, contexts, members, agents or connectors...'
+const COMPACT_SEARCH_PLACEHOLDER = 'Search workspace...'
+const COMPACT_SEARCH_BREAKPOINT = 1220
+
function formatApprovalTimestamp(value: string, mode: 'relative' | 'absolute'): string {
const date = new Date(value)
if (Number.isNaN(date.getTime())) {
@@ -121,6 +125,9 @@ export const AppHeader = React.memo(function AppHeader({
const [searchQuery, setSearchQuery] = useState('')
const [searchOpen, setSearchOpen] = useState(false)
const [notificationsOpen, setNotificationsOpen] = useState(false)
+ const [compactSearch, setCompactSearch] = useState(
+ () => window.innerWidth <= COMPACT_SEARCH_BREAKPOINT
+ )
const searchRef = useRef<HTMLDivElement | null>(null)
const notificationsRef = useRef<HTMLDivElement | null>(null)
const searchDirectoryInFlightRef = useRef(false)
@@ -135,6 +142,12 @@ export const AppHeader = React.memo(function AppHeader({
return () => window.clearInterval(timer)
}, [])
+ useEffect(() => {
+ const updateCompactSearch = () => setCompactSearch(window.innerWidth <= COMPACT_SEARCH_BREAKPOINT)
+ window.addEventListener('resize', updateCompactSearch)
+ return () => window.removeEventListener('resize', updateCompactSearch)
+ }, [])
+
useClickOutside(searchRef, searchOpen, () => setSearchOpen(false))
useClickOutside(notificationsRef, notificationsOpen, () => setNotificationsOpen(false))
@@ -525,9 +538,10 @@ export const AppHeader = React.memo(function AppHeader({
<div className="global-search" ref={searchRef}>
<TextInput
type="text"
- placeholder="Search teams, contexts, members, agents or connectors..."
+ placeholder={compactSearch ? COMPACT_SEARCH_PLACEHOLDER : FULL_SEARCH_PLACEHOLDER}
className="search-input"
aria-label="Search"
+ title={FULL_SEARCH_PLACEHOLDER}
value={searchQuery}
onChange={event => {
setSearchQuery(event.target.value)
diff --git a/desktop-app/ui/src/styles.css b/desktop-app/ui/src/styles.css
index ba3e3cdf2..098a79a8a 100644
--- a/desktop-app/ui/src/styles.css
+++ b/desktop-app/ui/src/styles.css
@@ -100,9 +100,9 @@ h3 {
.global-search {
position: relative;
- width: min(480px, 44vw);
+ width: var(--app-notification-drawer-width);
min-width: 220px;
- max-width: 480px;
+ max-width: 100%;
}
.global-search::before {
@@ -2158,6 +2158,9 @@ h3 {
.content-panel {
--app-notification-drawer-width: clamp(280px, 42vw, 420px);
+ --app-header-utilities-width: calc(
+ var(--app-notification-drawer-width) + var(--space-2) + 36px
+ );
height: 100vh;
min-height: 0;
@@ -12306,10 +12309,12 @@ pre {
display: flex;
align-items: center;
justify-content: flex-start;
+ flex-wrap: wrap;
+ align-content: flex-start;
gap: var(--space-2);
min-width: 0;
padding-top: var(--space-4);
- padding-right: 360px;
+ padding-right: var(--app-header-utilities-width);
}
.sandbox-ui-conversation-btn,
@@ -12327,7 +12332,7 @@ pre {
.sandbox-ui-conversation-btn {
min-width: 0;
- max-width: min(360px, 45vw);
+ max-width: min(280px, 40vw);
}
.sandbox-ui-conversation-btn span {
@@ -12367,7 +12372,7 @@ pre {
}
.content-panel.content-panel--app-notification-drawer-open > .page:has(.sandbox-ui-mounted-header) {
- padding-right: calc(var(--app-notification-drawer-width) + var(--space-2));
+ padding-right: var(--app-header-utilities-width);
}
.content-panel.content-panel--app-notification-drawer-open .sandbox-ui-mounted-header {
@@ -12379,8 +12384,12 @@ pre {
}
@media (max-width: 1220px) {
- .apps-page-header,
- .sandbox-ui-mounted-header {
+ .global-search {
+ width: clamp(160px, 32vw, var(--app-notification-drawer-width));
+ min-width: 160px;
+ }
+
+ .apps-page-header {
padding-right: 0;
}
}