Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(gfs): swap folder icon + always list directories before files
Miguelon Peluchon15330b4ae840
diff --git a/control-ui/components/GfsBrowser.tsx b/control-ui/components/GfsBrowser.tsxindex 0cba1b163..14fcad116 100644--- a/control-ui/components/GfsBrowser.tsx+++ b/control-ui/components/GfsBrowser.tsx@@ -188,7 +188,8 @@ export function GfsBrowser(): React.JSX.Element {: prev)}- setItems(prev => (cursor ? [...prev, ...page.items] : page.items))+ const sortedItems = sortChildrenWithDirectoriesFirst(page.items)+ setItems(prev => (cursor ? [...prev, ...sortedItems] : sortedItems))setNextCursor(page.nextCursor)} catch (err) {if (!isSilentApiError(err)) {@@ -200,6 +201,13 @@ export function GfsBrowser(): React.JSX.Element {}}, [])+ function sortChildrenWithDirectoriesFirst(children: GfsChild[]): GfsChild[] {+ return [...children].sort((a, b) => {+ if (a.kind === b.kind) return a.name.localeCompare(b.name)+ return a.kind === 'directory' ? -1 : 1+ })+ }+useEffect(() => {void load(current)// Reload whenever the current folder changes (navigation).diff --git a/control-ui/components/Sidebar/icons.tsx b/control-ui/components/Sidebar/icons.tsxindex ad0afbb72..e99e485b2 100644--- a/control-ui/components/Sidebar/icons.tsx+++ b/control-ui/components/Sidebar/icons.tsx@@ -81,17 +81,14 @@ export function IconRobot() {export function IconFolder() {return (<svg- xmlns="http://www.w3.org/2000/svg"- width="18"- height="18"- viewBox="0 0 24 24"- fill="none"stroke="currentColor"- strokeWidth="2"- strokeLinecap="round"- strokeLinejoin="round"+ fill="currentColor"+ strokeWidth="0"+ viewBox="0 0 512 512"+ xmlns="http://www.w3.org/2000/svg"+ aria-hidden="true">- <path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z" />+ <path d="M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V176c0-26.51-21.49-48-48-48z" /></svg>)}diff --git a/control-ui/components/__tests__/GfsBrowser.test.tsx b/control-ui/components/__tests__/GfsBrowser.test.tsxindex 439a63a68..eb06e138b 100644--- a/control-ui/components/__tests__/GfsBrowser.test.tsx+++ b/control-ui/components/__tests__/GfsBrowser.test.tsx@@ -155,6 +155,14 @@ describe('GfsBrowser', () => {await screen.findAllByText(/readme\.md/)expect(screen.getByRole('navigation', { name: 'Breadcrumb' })).toBeTruthy()expect(screen.queryByText('Drive map')).toBeNull()++ const orgRow = screen+ .getByRole('list', { name: 'Current folder resources' })+ .querySelector('li')+ expect(orgRow?.querySelector('svg path')?.getAttribute('d')).toContain(+ 'M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288'+ )+await openResourceMenu('readme.md')expect(screen.getByRole('menuitem', { name: 'Copy GFS link' }).getAttribute('title')).toBe('gfs://main/r2'@@ -162,6 +170,25 @@ describe('GfsBrowser', () => {expect(mockApiGet).toHaveBeenCalledWith('/api/v1/gfs/tree', { drive: 'main' })})+ it('orders directories first, then files, both alphabetically', async () => {+ mockApiGet.mockResolvedValueOnce({+ items: [+ child('zebra.md', 'file', 4),+ child('beta', 'directory', 2),+ child('apple.md', 'file', 3),+ child('alpha', 'directory', 1),+ ],+ nextCursor: null,+ })+ renderBrowser()++ const list = await screen.findByRole('list', { name: 'Current folder resources' })+ const resourceNamesInOrder = Array.from(list.querySelectorAll('.cu-gfs-list__name'))+ .map(node => node.textContent?.trim() ?? '')+ .filter(name => /^(alpha|beta|apple|zebra)/.test(name))+ expect(resourceNamesInOrder).toEqual(['alpha', 'beta', 'apple.md', 'zebra.md'])+ })+it('uses the paperclip header, labels the root as main, and ignores current-crumb clicks', async () => {mockApiGet.mockResolvedValueOnce({ items: [], nextCursor: null })renderBrowser()diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex c0a66e25a..cc84d59f4 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.438",+ "version": "0.1.439","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.438",+ "version": "0.1.439","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/llm-providers": "file:../packages/llm-providers",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 2f28c607f..2a75f5b65 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.438",+ "version": "0.1.439","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",diff --git a/desktop-app/ui/src/components/SidebarNav/icons.tsx b/desktop-app/ui/src/components/SidebarNav/icons.tsxindex 09376e6db..b4fc3ec4f 100644--- a/desktop-app/ui/src/components/SidebarNav/icons.tsx+++ b/desktop-app/ui/src/components/SidebarNav/icons.tsx@@ -49,8 +49,15 @@ export function IconTeams(props: IconProps) {export function IconContexts(props: IconProps) {return (- <svg viewBox="0 0 24 24" aria-hidden="true" {...BASE_STROKE_PROPS} {...props}>- <path d="M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z" />+ <svg+ stroke="currentColor"+ fill="currentColor"+ strokeWidth="0"+ viewBox="0 0 512 512"+ aria-hidden="true"+ {...props}+ >+ <path d="M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V176c0-26.51-21.49-48-48-48z" /></svg>)}diff --git a/desktop-app/ui/src/pages/FilesPage.tsx b/desktop-app/ui/src/pages/FilesPage.tsxindex 200485e68..b7662d652 100644--- a/desktop-app/ui/src/pages/FilesPage.tsx+++ b/desktop-app/ui/src/pages/FilesPage.tsx@@ -571,8 +571,10 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:const visibleResources = useMemo<GfsDriveResource[]>(() => {const resources = currentIsFolder ? items : currentIsFile ? [] : accessibleResourcesreturn [...resources].sort((left, right) => {- if (left.kind === right.kind) return 0- return left.kind === 'directory' ? -1 : 1+ if (left.kind !== right.kind) {+ return left.kind === 'directory' ? -1 : 1+ }+ return (left.name || left.drive).localeCompare(right.name || right.drive)})}, [accessibleResources, currentIsFile, currentIsFolder, items])const visibleLoading = currentIsFolder ? loading : !current ? loadingAccessible : falsediff --git a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsxindex 126186d81..9016b6963 100644--- a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx+++ b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx@@ -195,6 +195,81 @@ describe('FilesPage', () => {expect(screen.queryByRole('tab')).toBeNull()})+ it('orders directories before files, both alphabetically by name', async () => {+ hookMock.useGfsBrowserController.mockReturnValue({+ ...baseController(),+ current: {+ resourceId: 'parent-1',+ gfsUri: 'gfs://main/parent-1',+ name: 'Workspace',+ kind: 'directory',+ version: 1,+ },+ items: [+ {+ resourceId: 'file-z',+ rid: 'file-z',+ gfsUri: 'gfs://main/file-z',+ drive: 'main',+ parentResourceId: 'parent-1',+ name: 'Zebra.md',+ kind: 'file',+ path: '/Zebra.md',+ version: 1,+ bytes: 12,+ },+ {+ resourceId: 'dir-b',+ rid: 'dir-b',+ gfsUri: 'gfs://main/dir-b',+ drive: 'main',+ parentResourceId: 'parent-1',+ name: 'beta',+ kind: 'directory',+ path: '/beta',+ version: 1,+ bytes: 0,+ },+ {+ resourceId: 'file-a',+ rid: 'file-a',+ gfsUri: 'gfs://main/file-a',+ drive: 'main',+ parentResourceId: 'parent-1',+ name: 'apple.md',+ kind: 'file',+ path: '/apple.md',+ version: 1,+ bytes: 4,+ },+ {+ resourceId: 'dir-a',+ rid: 'dir-a',+ gfsUri: 'gfs://main/dir-a',+ drive: 'main',+ parentResourceId: 'parent-1',+ name: 'alpha',+ kind: 'directory',+ path: '/alpha',+ version: 1,+ bytes: 0,+ },+ ],+ })++ renderFilesPage()++ const resourceNamesInOrder = Array.from(document.querySelectorAll('.da-gfs-list__name')).map(+ node => node.textContent?.trim() ?? ''+ )+ expect(resourceNamesInOrder).toEqual(['alpha', 'beta', 'apple.md', 'Zebra.md'])++ const alphaRow = screen.getByRole('button', { name: 'alpha' }).closest('.da-grid__row')+ expect(alphaRow?.querySelector('.da-gfs-list__icon svg path')?.getAttribute('d')).toContain(+ 'M464 128H272l-64-64H48C21.49 64 0 85.49 0 112v288'+ )+ })+it('shows end-user folder CRUD controls only when held permissions allow them', async () => {const createFolder = vi.fn(async () => undefined)const renameResource = vi.fn(async () => undefined)