From e701f125e995c8e2a19ca18ab3626eb72eae0a95 Mon Sep 17 00:00:00 2001 From: PabloWiedemann Date: Thu, 12 Nov 2026 08:16:42 -0800 Subject: [PATCH 1/9] feat(assets): compact folder cards with a build count and a folder menu Each output folder on This computer is now a two-line card: the folder name and "N builds save here". Hovering the count lists the builds. A three-dot menu shows the folder in Finder or Explorer and copies its path. The full path and the "Used by" line are gone from the card. --- locales/en.json | 4 +- locales/zh.json | 4 +- src/renderer/src/panel/AssetsView.test.ts | 58 +++++++++++- src/renderer/src/panel/LocalFolders.vue | 104 +++++++++++++++++----- 4 files changed, 144 insertions(+), 26 deletions(-) diff --git a/locales/en.json b/locales/en.json index ddfdddc1b..7611f4bc3 100644 --- a/locales/en.json +++ b/locales/en.json @@ -96,8 +96,10 @@ "local": { "sharedOutput": "Shared output", "buildOutput": "{name} output", - "usedBy": "Used by {builds}", "notUsed": "No build saves here yet", + "buildCount": "1 build saves here | {count} builds save here", + "folderActions": "Folder actions", + "copyPath": "Copy path", "openFolder": "Open folder", "path": "Folder path", "noFoldersTitle": "No output folders yet", diff --git a/locales/zh.json b/locales/zh.json index 320146c71..589418c0c 100644 --- a/locales/zh.json +++ b/locales/zh.json @@ -96,8 +96,10 @@ "local": { "sharedOutput": "共享输出", "buildOutput": "{name} 输出", - "usedBy": "使用者:{builds}", "notUsed": "还没有构建保存到这里", + "buildCount": "{count} 个构建保存到这里", + "folderActions": "文件夹操作", + "copyPath": "复制路径", "openFolder": "打开文件夹", "path": "文件夹路径", "noFoldersTitle": "还没有输出文件夹", diff --git a/src/renderer/src/panel/AssetsView.test.ts b/src/renderer/src/panel/AssetsView.test.ts index fb0f159e5..6c0518f81 100644 --- a/src/renderer/src/panel/AssetsView.test.ts +++ b/src/renderer/src/panel/AssetsView.test.ts @@ -121,6 +121,7 @@ beforeEach(() => { listOutputFolder, openPath, revealPath, + platform: 'darwin', onInstallationsChanged: vi.fn(() => () => {}), onInstallationsVersionsUpdated: vi.fn(() => () => {}), comfybuilder: { @@ -531,16 +532,18 @@ describe('AssetsView on This computer', () => { listOutputFolders.mockResolvedValue(outputFolders()) }) - it('shows each output folder with the builds that save there, without the file tools', async () => { + it('shows each output folder with how many builds save there, without the file tools', async () => { const wrapper = await mountAssets([build('lab', 'Video Lab')]) await openThisComputer(wrapper) const cloudLoads = listAssets.mock.calls.length const shared = wrapper.get(`[data-testid="local-folder-${SHARED}"]`) expect(shared.text()).toContain('Shared output') - expect(shared.text()).toContain('Used by Test Instance, My Local 1') - expect(shared.text()).toContain(SHARED) - expect(wrapper.get(`[data-testid="local-folder-${APPS}"]`).text()).toContain('Apps output') + expect(shared.text()).toContain('2 builds save here') + expect(shared.text()).not.toContain(SHARED) + const apps = wrapper.get(`[data-testid="local-folder-${APPS}"]`) + expect(apps.text()).toContain('Apps output') + expect(apps.text()).toContain('1 build saves here') expect(wrapper.find('[data-testid="assets-filter"]').exists()).toBe(false) expect(wrapper.find('[data-testid="local-open-folder"]').exists()).toBe(false) @@ -550,6 +553,53 @@ describe('AssetsView on This computer', () => { expect(listAssets).toHaveBeenCalledTimes(cloudLoads) }) + it('names the builds that save to a folder when its build count gets focus', async () => { + const wrapper = await mountAssets([], [], { attachTo: document.body }) + await openThisComputer(wrapper) + expect(document.body.textContent).not.toContain('Test Instance') + + await wrapper.get(`[data-testid="local-folder-builds-${SHARED}"]`).trigger('focusin') + await flushPromises() + + expect(document.body.textContent).toContain('Test Instance') + expect(document.body.textContent).toContain('My Local 1') + wrapper.unmount() + }) + + it('shows a folder in Finder from its menu without opening it', async () => { + const wrapper = await mountAssets([]) + await openThisComputer(wrapper) + + await wrapper + .get(`[data-testid="local-folder-menu-${SHARED}"]`) + .trigger('keydown', { key: 'Enter' }) + await flushPromises() + const reveal = wrapper.get('[data-testid="local-folder-reveal"]') + expect(reveal.text()).toBe('Show in Finder') + await reveal.trigger('click') + await flushPromises() + + expect(revealPath).toHaveBeenCalledWith(SHARED) + expect(listOutputFolder).not.toHaveBeenCalled() + }) + + it('copies a folder path from its menu', async () => { + const writeText = vi.spyOn(navigator.clipboard, 'writeText').mockResolvedValue() + const wrapper = await mountAssets([]) + await openThisComputer(wrapper) + + await wrapper + .get(`[data-testid="local-folder-menu-${APPS}"]`) + .trigger('keydown', { key: 'Enter' }) + await flushPromises() + await wrapper.get('[data-testid="local-folder-copy-path"]').trigger('click') + await flushPromises() + + expect(writeText).toHaveBeenCalledWith(APPS) + expect(listOutputFolder).not.toHaveBeenCalled() + writeText.mockRestore() + }) + it('opens on This computer when the user left it there', async () => { window.localStorage.setItem('comfy.desktop.assets.place', 'computer') diff --git a/src/renderer/src/panel/LocalFolders.vue b/src/renderer/src/panel/LocalFolders.vue index 13c423f44..f18dc26d5 100644 --- a/src/renderer/src/panel/LocalFolders.vue +++ b/src/renderer/src/panel/LocalFolders.vue @@ -1,7 +1,18 @@ + + diff --git a/src/renderer/src/panel/LocalFolders.vue b/src/renderer/src/panel/LocalFolders.vue index f18dc26d5..16ee72264 100644 --- a/src/renderer/src/panel/LocalFolders.vue +++ b/src/renderer/src/panel/LocalFolders.vue @@ -1,21 +1,12 @@ diff --git a/src/renderer/src/panel/LocalFolders.vue b/src/renderer/src/panel/LocalFolders.vue index 16ee72264..ed3fbe2c5 100644 --- a/src/renderer/src/panel/LocalFolders.vue +++ b/src/renderer/src/panel/LocalFolders.vue @@ -1,5 +1,5 @@