diff --git a/e2e/beta-activation-notice-lockdown.test.ts b/e2e/beta-activation-notice-lockdown.test.ts index 6bf328329..d501e8f7b 100644 --- a/e2e/beta-activation-notice-lockdown.test.ts +++ b/e2e/beta-activation-notice-lockdown.test.ts @@ -57,8 +57,8 @@ async function popupVisible(app: ElectronApplication): Promise { const bell = await titleBar.exists('.title-announcement-button') - const pill = await titleBar.exists('.title-install-pill.is-interactive') - return !bell && !pill + const firstUseLabel = await titleBar.exists('.title-install-pill') + return !bell && firstUseLabel } const UNREACHABLE_POSTHOG_HOST = 'http://127.0.0.1:1' diff --git a/e2e/chooser.test.ts b/e2e/chooser.test.ts index 6bd950696..01a85f0cf 100644 --- a/e2e/chooser.test.ts +++ b/e2e/chooser.test.ts @@ -39,9 +39,10 @@ test('chooser body renders on cold start @windows @macos @linux', async () => { expect(await ctx.panel.exists('[data-testid="devplatform-account-signin"]')).toBe(true) }) -test('title bar shows install-less pill on chooser host @windows @macos @linux', async () => { - expect(await ctx.titleBar.exists('.title-install-pill.is-install-less')).toBe(true) - expect(await ctx.titleBar.textOf('.title-install-name')).toMatch(/Comfy Desktop/i) +test('title bar leaves the middle empty on the chooser host @windows @macos @linux', async () => { + expect(await ctx.titleBar.exists('.title-center')).toBe(true) + expect(await ctx.titleBar.exists('.title-center > *')).toBe(false) + expect(await ctx.titleBar.exists('.title-install-pill')).toBe(false) }) test('Desktop Settings opens from the sidebar footer when expanded and collapsed @windows @macos @linux', async () => { diff --git a/e2e/core-beta-args-pill-restart.test.ts b/e2e/core-beta-args-pill-restart.test.ts index 7e2cd839e..947a0e6dd 100644 --- a/e2e/core-beta-args-pill-restart.test.ts +++ b/e2e/core-beta-args-pill-restart.test.ts @@ -7,7 +7,7 @@ import { launchApp, type AppContext } from './launchApp' import { clickInstallTile, expectChooserVisible, - openPickerViaTitlePill + openPickerInWindow } from './support/chooserHelpers' import { closeTitlePopupIfOpen, isPopupVisible, type WebContentsPage } from './support/cdpPages' import { getRunningSessionSnapshot } from './support/devHooks' @@ -84,7 +84,7 @@ test.afterAll(async () => { async function openStartupArgs(): Promise { await closeTitlePopupIfOpen(ctx.app) - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar, 'config') + const popup = await openPickerInWindow(ctx.app, ctx.titleBar, 'config') await popup.waitForVisible(`${ARGS_FIELD} .ui-input`, { timeout: 15_000 }) return popup } diff --git a/e2e/launch-own-window.test.ts b/e2e/launch-own-window.test.ts index 4729662bb..22ca415a3 100644 --- a/e2e/launch-own-window.test.ts +++ b/e2e/launch-own-window.test.ts @@ -5,7 +5,7 @@ import { test, expect } from '@playwright/test' import { launchApp, type AppContext } from './launchApp' import { reserveFreePort, writeFakeComfyInstall } from './support/fakeComfyInstall' import { evalWithRetry } from './support/evalRetry' -import { openPickerViaTitlePill } from './support/chooserHelpers' +import { openPickerInWindow } from './support/chooserHelpers' import { WebContentsPage } from './support/cdpPages' import { byTestId, TID } from './support/testIds' @@ -154,7 +154,7 @@ test('Start on another build from a build window opens it in its own window and ctx.app, `comfyTitleBar.html?installationId=${INSTALL_ID}` ) - const popup = await openPickerViaTitlePill(ctx.app, firstBuildTitleBar) + const popup = await openPickerInWindow(ctx.app, firstBuildTitleBar) const secondRow = byTestId(TID.pickerRow(SECOND_INSTALL_ID)) await popup.waitForVisible(secondRow, { timeout: 15_000 }) expect(await popup.click(secondRow), 'second build selected').toBe(true) diff --git a/e2e/real-comfy.test.ts b/e2e/real-comfy.test.ts index adaaecbf1..ff2eb3520 100644 --- a/e2e/real-comfy.test.ts +++ b/e2e/real-comfy.test.ts @@ -14,7 +14,7 @@ import { expectNewBuildModalOpen, openManageViaDashboard, openNewBuildChangeSetup, - openPickerViaTitlePill + openPickerInWindow } from './support/chooserHelpers' import { armLaunchReadyHold, @@ -509,9 +509,7 @@ test('picker Dashboard opens a chooser without stopping the running install @sec }) ) - expect(await ctx.titleBar.click('.title-install-pill.is-interactive')).toBe(true) - await waitForWebContents(ctx.app, 'comfyTitlePopup.html') - const popup = titlePopupPage(ctx.app) + const popup = await openPickerInWindow(ctx.app, ctx.titleBar) await popup.waitForVisible('.picker-home', { timeout: 10_000 }) expect(await popup.click('.picker-home')).toBe(true) @@ -658,7 +656,7 @@ async function stopAndReturnToDashboardViaUI(): Promise { return } } - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar) + const popup = await openPickerInWindow(ctx.app, ctx.titleBar) await popup.waitForVisible(byTestId(TID.pickerMoreTrigger), { timeout: 15_000 }) await popup.clickUntilVisible( byTestId(TID.pickerMoreTrigger), @@ -878,7 +876,7 @@ async function selectPytorchOption( async function changePytorchStack(option: PytorchPickerOption): Promise { const beforeSession = await getRunningSessionSnapshot(ctx.app, _updateInstallId) - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar, 'update') + const popup = await openPickerInWindow(ctx.app, ctx.titleBar, 'update') await selectPytorchOption(popup, option) const action = byTestId(TID.updateActionButton('change-pytorch')) await popup.waitForVisible(action, { timeout: 60_000 }) @@ -910,7 +908,7 @@ async function changePytorchStack(option: PytorchPickerOption): Promise { .toBe(true) await closeTitlePopupIfOpen(ctx.app) - const verifyPopup = await openPickerViaTitlePill(ctx.app, ctx.titleBar, 'update') + const verifyPopup = await openPickerInWindow(ctx.app, ctx.titleBar, 'update') const picker = await readPytorchPicker(verifyPopup) expect(picker.current.value).toBe(option.value) await expect @@ -926,7 +924,7 @@ test('captures the baseline pytorch stack @sec-pytorch @real-comfy', async () => await ctx.panel.evaluate( `window.api.runAction(${JSON.stringify(_updateInstallId)}, 'check-update', { silent: true })` ) - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar, 'update') + const popup = await openPickerInWindow(ctx.app, ctx.titleBar, 'update') const picker = await readPytorchPicker(popup) _baselinePytorchOption = picker.current _baselinePytorchSignature = queryTorchSignature() @@ -939,7 +937,7 @@ test('captures the baseline pytorch stack @sec-pytorch @real-comfy', async () => test('switches to a different compatible stack via the picker @sec-pytorch @real-comfy', async () => { test.setTimeout(GPU_VARIANT ? 2_700_000 : 1_200_000) expect(_baselinePytorchOption, 'baseline PyTorch picker option not captured').not.toBeNull() - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar, 'update') + const popup = await openPickerInWindow(ctx.app, ctx.titleBar, 'update') const picker = await readPytorchPicker(popup) _targetPytorchOption = picker.options.find( @@ -1128,7 +1126,7 @@ function findStackSnapshot( async function restoreSnapshotViaPicker(filename: string): Promise { await waitForOperationDrain(_updateInstallId) const beforeSession = await getRunningSessionSnapshot(ctx.app, _updateInstallId) - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar, 'snapshots') + const popup = await openPickerInWindow(ctx.app, ctx.titleBar, 'snapshots') await popup.waitForSelector(byTestId(TID.snapshotRow(filename)), { timeout: 30_000 }) await popup.clickUntilVisible( byTestId(TID.snapshotRow(filename)), @@ -1241,7 +1239,7 @@ test('captures a snapshot for the picker-driven restore test @sec-snapshot @real ).snapshots.map((s) => s.filename) ) - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar, 'snapshots') + const popup = await openPickerInWindow(ctx.app, ctx.titleBar, 'snapshots') await popup.waitForVisible(byTestId(TID.snapshotsSaveCta), { timeout: 15_000 }) expect(await popup.click(byTestId(TID.snapshotsSaveCta))).toBe(true) await popup.waitForVisible(byTestId(TID.basePromptInput), { timeout: 15_000 }) @@ -1398,7 +1396,7 @@ test('per-install Manager security level + network mode land in Manager config.i `window.api.getSetting('managerNetworkMode')` ) - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar, 'config') + const popup = await openPickerInWindow(ctx.app, ctx.titleBar, 'config') const trigger = 'button.ui-select-trigger[aria-label="Manager Security Level"]' await popup.waitForVisible(trigger, { timeout: 15_000 }) @@ -1540,7 +1538,7 @@ test('picker-driven cross-channel update-comfyui (stable → latest) IN_PLACE_RE await resetIpcInvocations(ctx.app, 'stop-comfyui') await resetIpcInvocations(ctx.app, 'run-action') - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar, 'update') + const popup = await openPickerInWindow(ctx.app, ctx.titleBar, 'update') const channelSelect = 'button[role="combobox"][aria-label="Update Channel"]' await popup.waitForSelector(channelSelect, { timeout: 60_000 }) @@ -1622,7 +1620,7 @@ test('picker-driven snapshot-restore IN_PLACE_RELAUNCH while running @sec-snapsh await resetIpcInvocations(ctx.app, 'stop-comfyui') await resetIpcInvocations(ctx.app, 'run-action') - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar, 'snapshots') + const popup = await openPickerInWindow(ctx.app, ctx.titleBar, 'snapshots') await popup.waitForSelector(byTestId(TID.snapshotRow(_restoreSnapshotFilename)), { timeout: 30_000 }) @@ -1686,7 +1684,7 @@ test('picker primary CTA Restart drives in-drawer confirm + re-launch @sec-picke .not.toBeNull() expect(beforeSnapshot, 'expected a running session before Restart').not.toBeNull() - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar) + const popup = await openPickerInWindow(ctx.app, ctx.titleBar) await popup.waitForVisible(byTestId(TID.pickerPrimaryCta), { timeout: 15_000 }) await expect @@ -1745,7 +1743,7 @@ test('picker More-menu Stop fires stop-comfyui; stopped-card Relaunch restores i await resetIpcInvocations(ctx.app, 'stop-comfyui') await resetIpcInvocations(ctx.app, 'run-action') - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar, 'config') + const popup = await openPickerInWindow(ctx.app, ctx.titleBar, 'config') await popup.waitForVisible(byTestId(TID.pickerMoreTrigger), { timeout: 15_000 }) await popup.clickUntilVisible( @@ -1862,7 +1860,7 @@ async function confirmPickerRestart(popup: WebContentsPage): Promise { } async function openBootWindowViaPickerRestart(): Promise { - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar) + const popup = await openPickerInWindow(ctx.app, ctx.titleBar) await confirmPickerRestart(popup) await expect .poll( @@ -1906,7 +1904,7 @@ test('boot-window --port edit surfaces Restart-to-apply and the restart applies let popup: WebContentsPage try { await restartAndHoldTheBootBeforeItCountsAsRunning() - popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar, 'config') + popup = await openPickerInWindow(ctx.app, ctx.titleBar, 'config') await setPortArgViaPicker(popup, targetPort) expect( await getRunningSessionSnapshot(ctx.app, _updateInstallId), @@ -1983,7 +1981,7 @@ test('restart clicked during boot cancels the in-flight boot and applies the edi try { await restartAndHoldTheBootBeforeItCountsAsRunning() - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar, 'config') + const popup = await openPickerInWindow(ctx.app, ctx.titleBar, 'config') await setPortArgViaPicker(popup, targetPort) await popup.waitForVisible(byTestId(TID.pickerPrimaryCta), { timeout: 15_000 }) @@ -2383,7 +2381,7 @@ async function openDashboardWindowViaPickerHome(): Promise { .map((w) => w.id) ) ) - const popup = await openPickerViaTitlePill(ctx.app, ctx.titleBar) + const popup = await openPickerInWindow(ctx.app, ctx.titleBar) await popup.waitForVisible('.picker-home', { timeout: 10_000 }) expect(await popup.click('.picker-home')).toBe(true) await closeTitlePopupIfOpen(ctx.app) diff --git a/e2e/support/chooserHelpers.ts b/e2e/support/chooserHelpers.ts index 4ccf04b4f..03275dc25 100644 --- a/e2e/support/chooserHelpers.ts +++ b/e2e/support/chooserHelpers.ts @@ -129,20 +129,20 @@ export async function openManageViaDashboard( return popup } -export async function openPickerViaTitlePill( +export async function openPickerInWindow( app: ElectronApplication, titleBar: WebContentsPage, tabKey?: string ): Promise { if (await isPopupVisible(app, 'comfyTitlePopup.html')) { throw new Error( - 'openPickerViaTitlePill: picker popup is already open - close it before re-entering via the pill' + 'openPickerInWindow: picker popup is already open - close it before opening it again' ) } - await titleBar.waitForVisible('.title-install-pill.is-interactive', { timeout: 15_000 }) + await titleBar.waitForVisible('.title-trailing', { timeout: 15_000 }) expect( - await titleBar.click('.title-install-pill.is-interactive'), - 'title-bar install pill clicked' + await titleBar.evaluate('(() => { window.api.openInstancePicker(); return true })()'), + 'picker requested from the title bar' ).toBe(true) await waitForWebContents(app, 'comfyTitlePopup.html') await expect diff --git a/e2e/update-pills.test.ts b/e2e/update-pills.test.ts index 9d30e089d..316d71df6 100644 --- a/e2e/update-pills.test.ts +++ b/e2e/update-pills.test.ts @@ -84,17 +84,6 @@ test('clicking the ready desktop-update pill opens the embedded system-modal res .toBe(true) }) -test('install-update chip stays hidden on the install-less chooser host even with an override @windows @macos @linux', async () => { - await setInstallUpdate(ctx.app, { available: true, version: '99.0.0' }) - await new Promise((r) => setTimeout(r, 250)) - await expect - .poll(() => ctx.titleBar.exists('.title-install-update-chip'), { - timeout: 3_000, - intervals: [100, 200] - }) - .toBe(false) -}) - async function isSystemModalVisible(app: ElectronApplication): Promise { try { return await evalWithRetry(() => diff --git a/locales/en.json b/locales/en.json index 33d8b9069..edb886742 100644 --- a/locales/en.json +++ b/locales/en.json @@ -240,7 +240,6 @@ "appUpdateAvailable": "Update {version}", "appUpdateReady": "Restart to update", "installUpdateAvailable": "Update available", - "installUpdateShort": "Update", "home": "Home", "menu": "Menu", "feedback": "Feedback", @@ -258,9 +257,6 @@ "installUpdateVersion": "ComfyUI {version}", "refreshInstanceTooltip": "Refresh", "resetZoomTooltip": "Reset zoom to 100%", - "pillHintTitle": "Switch & manage instances", - "pillHintBody": "Click here to switch instances, start a new local instance, or return to the dashboard.", - "pillHintDismiss": "Got it", "betaNoticeTitle": "A beta feature is on", "betaNoticeBody": "This instance started with a beta feature enabled. You can turn beta features off in Settings.", "betaNoticeTitleNamed": "The {feature} beta is on", diff --git a/locales/zh.json b/locales/zh.json index ebe69c26f..6dd4a353a 100644 --- a/locales/zh.json +++ b/locales/zh.json @@ -240,7 +240,6 @@ "appUpdateAvailable": "更新 {version}", "appUpdateReady": "重启以更新", "installUpdateAvailable": "有可用更新", - "installUpdateShort": "更新", "home": "主页", "menu": "菜单", "feedback": "反馈", @@ -258,9 +257,6 @@ "installUpdateVersion": "ComfyUI {version}", "refreshInstanceTooltip": "刷新", "resetZoomTooltip": "将缩放重置为 100%", - "pillHintTitle": "切换和管理实例", - "pillHintBody": "点击这里切换实例、启动新的本地实例,或返回仪表板。", - "pillHintDismiss": "知道了", "betaNoticeTitle": "已启用 Beta 功能", "betaNoticeBody": "此实例启动时启用了一项 Beta 功能。你可以在设置中关闭 Beta 功能。", "betaNoticeTitleNamed": "已启用 {feature} Beta 功能", diff --git a/src/main/popups/titleCoachmark.test.ts b/src/main/popups/titleCoachmark.test.ts index 443a1faa5..bcb37acc0 100644 --- a/src/main/popups/titleCoachmark.test.ts +++ b/src/main/popups/titleCoachmark.test.ts @@ -26,16 +26,16 @@ import { describe('buildCoachmarkConfig', () => { it('stamps the coachmark variant and carries title + body + dismiss copy', () => { const cfg = buildCoachmarkConfig({ - kind: 'pill-hint', - title: 'Switch & manage instances', - body: 'Click here to switch instances.', + kind: 'beta-notice', + title: 'A beta feature is on', + body: 'This instance started with a beta feature enabled.', dismissLabel: 'Got it', token: 'cm-1' }) expect(cfg.variant).toBe('coachmark') - expect(cfg.kind).toBe('pill-hint') - expect(cfg.title).toBe('Switch & manage instances') - expect(cfg.body).toBe('Click here to switch instances.') + expect(cfg.kind).toBe('beta-notice') + expect(cfg.title).toBe('A beta feature is on') + expect(cfg.body).toBe('This instance started with a beta feature enabled.') expect(cfg.dismissLabel).toBe('Got it') expect(cfg.configToken).toBe('cm-1') expect(cfg.theme.accent).toMatch(/^#/) @@ -43,9 +43,9 @@ describe('buildCoachmarkConfig', () => { it('omits actionLabel entirely for a card with no secondary action', () => { const cfg = buildCoachmarkConfig({ - kind: 'pill-hint', - title: 'Switch & manage instances', - body: 'Click here to switch instances.', + kind: 'beta-notice', + title: 'A beta feature is on', + body: 'This instance started with a beta feature enabled.', dismissLabel: 'Got it', token: 'cm-1' }) diff --git a/src/main/popups/titleCoachmark.ts b/src/main/popups/titleCoachmark.ts index 6ea9c7292..ef1f67878 100644 --- a/src/main/popups/titleCoachmark.ts +++ b/src/main/popups/titleCoachmark.ts @@ -18,7 +18,7 @@ export interface CoachmarkTheme { accent: string } -export type CoachmarkKind = 'pill-hint' | 'beta-notice' +export type CoachmarkKind = 'beta-notice' export interface CoachmarkConfig { variant: 'coachmark' @@ -163,7 +163,7 @@ function ensureCoachmarkPopup(parent: BrowserWindow): CoachmarkPopupEntry { pendingConfig: null, pendingAnchor: null, pendingConfigToken: null, - kind: 'pill-hint', + kind: 'beta-notice', settleTimer: null } coachmarkPopupsByParent.set(view.parentWindowId, entry) @@ -227,7 +227,7 @@ export function openCoachmarkPopup(opts: { entry.pendingAnchor = { leftX: opts.leftX, rightX: opts.rightX, bottomY: opts.bottomY } const token = nextCoachmarkToken() - const kind = opts.kind ?? 'pill-hint' + const kind = opts.kind ?? 'beta-notice' const config = buildCoachmarkConfig({ kind, title: opts.title, @@ -295,7 +295,6 @@ export function registerTitleCoachmarkIpc(opts: { ( event, payload: { - kind?: unknown title?: unknown body?: unknown dismissLabel?: unknown @@ -312,7 +311,6 @@ export function registerTitleCoachmarkIpc(opts: { if (!title && !body) return const dismissLabel = typeof payload?.dismissLabel === 'string' ? payload.dismissLabel : '' const actionLabel = typeof payload?.actionLabel === 'string' ? payload.actionLabel : undefined - const kind: CoachmarkKind = payload?.kind === 'beta-notice' ? 'beta-notice' : 'pill-hint' const finite = (v: unknown, fallback: number): number => typeof v === 'number' && Number.isFinite(v) ? v : fallback const leftX = finite(payload?.leftX, 0) @@ -320,7 +318,6 @@ export function registerTitleCoachmarkIpc(opts: { const bottomY = finite(payload?.bottomY, TITLEBAR_HEIGHT) openCoachmarkPopup({ parent, - kind, title, body, dismissLabel, diff --git a/src/main/popups/titlePopup.ts b/src/main/popups/titlePopup.ts index 8cb18f4d5..12f178af6 100644 --- a/src/main/popups/titlePopup.ts +++ b/src/main/popups/titlePopup.ts @@ -1617,34 +1617,6 @@ export function registerTitlePopupIpc(bindings: TitlePopupHostBindings): void { hideTitlePopup(popup, { releaseFocusToParent: true }) }) - ipcMain.on( - 'comfy-window:click-install-pill', - (event, payload: { anchor?: { x?: number; y?: number } } | undefined) => { - const found = findEntryByTitleBarSender(event.sender) - if (!found) return - const { id: windowKey, entry } = found - if (entry.window.isDestroyed()) return - - const existingPopup = titlePopupsByParent.get(entry.window.id) - if ( - existingPopup && - existingPopup.kind === 'instance-picker' && - (existingPopup.view.isOpen || existingPopup.view.pendingShowTimer !== null) - ) { - hideTitlePopup(existingPopup, { releaseFocusToParent: true }) - return - } - - const x = Math.max(0, Math.round(payload?.anchor?.x ?? 0)) - const y = Math.max(0, Math.round(payload?.anchor?.y ?? TITLEBAR_HEIGHT)) - - openInstancePickerForHost(entry, windowKey, bindings, entry.titleBarView.webContents, { - x, - y - }) - } - ) - ipcMain.on( 'comfy-window:open-instance-picker-for-install', ( diff --git a/src/preload/comfyTitleBarPreload.ts b/src/preload/comfyTitleBarPreload.ts index 22f68d036..8ac375a96 100644 --- a/src/preload/comfyTitleBarPreload.ts +++ b/src/preload/comfyTitleBarPreload.ts @@ -12,11 +12,7 @@ export type ComfyPanelKey = | 'load-snapshot' | 'quick-install' -export type CoachmarkKind = 'pill-hint' | 'beta-notice' - -function coachmarkKindOf(payload?: { kind?: unknown }): CoachmarkKind { - return payload?.kind === 'beta-notice' ? 'beta-notice' : 'pill-hint' -} +export type CoachmarkKind = 'beta-notice' export interface TitleMenuAnchor { x: number @@ -72,7 +68,6 @@ export interface ComfyTitleBarBridge { clickInstallUpdatePill(): void onDownloadsChanged(cb: (state: DownloadsTrayState) => void): () => void clickDownloadsTray(anchor: TitleMenuAnchor): void - clickInstallPill(anchor: TitleMenuAnchor): void clickFeedback(): void clickAnnouncement(): void clickRefreshInstance(): void @@ -255,9 +250,6 @@ const bridge: ComfyTitleBarBridge = { clickDownloadsTray: (anchor) => { ipcRenderer.send('comfy-window:click-downloads-tray', { anchor }) }, - clickInstallPill: (anchor) => { - ipcRenderer.send('comfy-window:click-install-pill', { anchor }) - }, clickFeedback: () => { ipcRenderer.send('comfy-window:click-feedback') }, @@ -286,32 +278,27 @@ const bridge: ComfyTitleBarBridge = { ipcRenderer.send('comfy-window:hide-titlebar-coachmark') }, onCoachmarkDismissed: (cb) => { - const handler = (_event: IpcRendererEvent, payload?: { kind?: unknown }): void => - cb({ kind: coachmarkKindOf(payload) }) + const handler = (): void => cb({ kind: 'beta-notice' }) ipcRenderer.on('comfy-titlebar:coachmark-dismissed', handler) return () => ipcRenderer.removeListener('comfy-titlebar:coachmark-dismissed', handler) }, onCoachmarkAction: (cb) => { - const handler = (_event: IpcRendererEvent, payload?: { kind?: unknown }): void => - cb({ kind: coachmarkKindOf(payload) }) + const handler = (): void => cb({ kind: 'beta-notice' }) ipcRenderer.on('comfy-titlebar:coachmark-action', handler) return () => ipcRenderer.removeListener('comfy-titlebar:coachmark-action', handler) }, onCoachmarkAutoHidden: (cb: (payload: { kind: CoachmarkKind }) => void) => { - const handler = (_e: unknown, payload?: { kind?: unknown }): void => - cb({ kind: coachmarkKindOf(payload) }) + const handler = (): void => cb({ kind: 'beta-notice' }) ipcRenderer.on('comfy-titlebar:coachmark-auto-hidden', handler) return () => ipcRenderer.removeListener('comfy-titlebar:coachmark-auto-hidden', handler) }, onCoachmarkSettled: (cb: (payload: { kind: CoachmarkKind }) => void) => { - const handler = (_e: unknown, payload?: { kind?: unknown }): void => - cb({ kind: coachmarkKindOf(payload) }) + const handler = (): void => cb({ kind: 'beta-notice' }) ipcRenderer.on('comfy-titlebar:coachmark-settled', handler) return () => ipcRenderer.removeListener('comfy-titlebar:coachmark-settled', handler) }, onCoachmarkDisplaced: (cb: (payload: { kind: CoachmarkKind }) => void) => { - const handler = (_e: unknown, payload?: { kind?: unknown }): void => - cb({ kind: coachmarkKindOf(payload) }) + const handler = (): void => cb({ kind: 'beta-notice' }) ipcRenderer.on('comfy-titlebar:coachmark-displaced', handler) return () => ipcRenderer.removeListener('comfy-titlebar:coachmark-displaced', handler) }, diff --git a/src/renderer/src/comfyTitleBar/TitleBarApp.test.ts b/src/renderer/src/comfyTitleBar/TitleBarApp.test.ts index d76663291..077eba072 100644 --- a/src/renderer/src/comfyTitleBar/TitleBarApp.test.ts +++ b/src/renderer/src/comfyTitleBar/TitleBarApp.test.ts @@ -45,7 +45,6 @@ interface MockBridgeState { appUpdatePillClicks: number installUpdatePillClicks: number downloadsTrayClicks: number - installPillClicks: { x: number; y: number }[] feedbackClicks: number refreshInstanceClicks: number homeClicks: number @@ -96,7 +95,6 @@ function installMockBridge( appUpdatePillClicks: 0, installUpdatePillClicks: 0, downloadsTrayClicks: 0, - installPillClicks: [], feedbackClicks: 0, refreshInstanceClicks: 0, homeClicks: 0, @@ -202,9 +200,6 @@ function installMockBridge( clickDownloadsTray: () => { state.downloadsTrayClicks += 1 }, - clickInstallPill: (anchor: { x: number; y: number }) => { - state.installPillClicks.push(anchor) - }, clickFeedback: () => { state.feedbackClicks += 1 }, @@ -272,7 +267,7 @@ describe('TitleBarApp', () => { vi.resetModules() }) - it('renders the app menu button and a center install pill', async () => { + it('renders the app menu button and leaves the middle of a build window empty', async () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp) await flushPromises() @@ -280,13 +275,8 @@ describe('TitleBarApp', () => { expect(fileBtn.exists()).toBe(true) expect(fileBtn.attributes('aria-label')).toBe('Menu') expect(fileBtn.classes()).toContain('title-menu-button--icon') - const pill = wrapper.find('.title-install-pill') - expect(pill.exists()).toBe(true) - expect(pill.element.tagName).toBe('DIV') - expect(pill.attributes('role')).toBe('button') - expect(pill.attributes('aria-haspopup')).toBe('dialog') - expect(wrapper.find('.title-install-name').text()).toBe('ComfyUI') - expect(wrapper.find('.title-install-caret').exists()).toBe(true) + expect(wrapper.find('.title-center').element.children.length).toBe(0) + expect(wrapper.find('.title-install-pill').exists()).toBe(false) }) it('signals readiness so main can push initial state', async () => { @@ -296,19 +286,6 @@ describe('TitleBarApp', () => { expect(bridgeState.readyCalls).toBe(1) }) - it('routes pill clicks to the install-picker bridge handler with an anchor', async () => { - const { default: TitleBarApp } = await import('./TitleBarApp.vue') - const wrapper = mount(TitleBarApp, { attachTo: document.body }) - await flushPromises() - await wrapper.find('.title-install-pill').trigger('click') - expect(bridgeState.setPanelCalls).toEqual([]) - expect(bridgeState.installPillClicks.length).toBe(1) - const anchor = bridgeState.installPillClicks[0]! - expect(typeof anchor.x).toBe('number') - expect(typeof anchor.y).toBe('number') - wrapper.unmount() - }) - it('asks main to pop the native File menu when the File button is clicked', async () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp, { attachTo: document.body }) @@ -321,40 +298,33 @@ describe('TitleBarApp', () => { wrapper.unmount() }) - it('renders the install-less pill as an interactive opener for the instance picker', async () => { + it('leaves the middle of the Desktop window empty', async () => { bridgeState = installMockBridge({ installationId: null }) vi.resetModules() const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp, { attachTo: document.body }) await flushPromises() - const pill = wrapper.find('.title-install-pill') - expect(pill.exists()).toBe(true) - expect(pill.element.tagName).toBe('DIV') - expect(pill.attributes('role')).toBe('button') - expect(pill.classes()).toContain('is-install-less') - expect(wrapper.find('.title-install-caret').exists()).toBe(true) + bridgeState.titleChangedCallbacks.forEach((cb) => cb('Comfy Desktop')) + await flushPromises() + expect(wrapper.find('.title-center').element.children.length).toBe(0) + expect(wrapper.find('.title-install-pill').exists()).toBe(false) + expect(wrapper.text()).not.toContain('Comfy Desktop') wrapper.unmount() }) - it('updates the install pill label when main pushes a title', async () => { + it('shows the title main pushes on the first-use label, which is not a button', async () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp) await flushPromises() + bridgeState.firstUseModeChangedCallbacks.forEach((cb) => cb('consent-lockdown')) bridgeState.titleChangedCallbacks.forEach((cb) => cb('MyInstall')) await flushPromises() + const label = wrapper.find('.title-cluster .title-install-pill') + expect(label.exists()).toBe(true) + expect(label.attributes('role')).toBeUndefined() + expect(label.attributes('tabindex')).toBeUndefined() expect(wrapper.find('.title-install-name').text()).toBe('MyInstall') - }) - - it('does not mark the install pill active for any panel — pill is an identity label, not a tab', async () => { - const { default: TitleBarApp } = await import('./TitleBarApp.vue') - const wrapper = mount(TitleBarApp) - await flushPromises() - bridgeState.panelChangedCallbacks.forEach((cb) => cb('comfy')) - await flushPromises() - expect(wrapper.find('.title-install-pill').classes()).not.toContain('active') - bridgeState.panelChangedCallbacks.forEach((cb) => cb('settings')) - await flushPromises() - expect(wrapper.find('.title-install-pill').classes()).not.toContain('active') + expect(wrapper.find('.title-center').element.children.length).toBe(0) }) it('does not render any title-bar nav buttons (back/forward chevrons removed with the takeover layout)', async () => { @@ -373,27 +343,6 @@ describe('TitleBarApp', () => { expect(wrapper.find('header').classes()).toContain('is-mac') }) - it('shows the dropdown caret on install-less host windows so the picker opener reads as actionable', async () => { - bridgeState = installMockBridge({ installationId: null }) - vi.resetModules() - const { default: TitleBarApp } = await import('./TitleBarApp.vue') - const wrapper = mount(TitleBarApp) - await flushPromises() - expect(wrapper.find('.title-install-name').exists()).toBe(true) - expect(wrapper.find('.title-install-caret').exists()).toBe(true) - }) - - it('accepts the install-less fallback label pushed by main', async () => { - bridgeState = installMockBridge({ installationId: null }) - vi.resetModules() - const { default: TitleBarApp } = await import('./TitleBarApp.vue') - const wrapper = mount(TitleBarApp) - await flushPromises() - bridgeState.titleChangedCallbacks.forEach((cb) => cb('Comfy Desktop')) - await flushPromises() - expect(wrapper.find('.title-install-name').text()).toBe('Comfy Desktop') - }) - it('suppresses menu re-open immediately after a menu close (click-to-toggle dismiss)', async () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp, { attachTo: document.body }) @@ -418,7 +367,7 @@ describe('TitleBarApp', () => { expect(wrapper.find('.title-menu-button[aria-haspopup="menu"]').exists()).toBe(true) expect(wrapper.find('.title-downloads-tray').exists()).toBe(true) expect(wrapper.find('.title-feedback-button').exists()).toBe(true) - expect(wrapper.find('.title-install-pill.is-interactive').exists()).toBe(true) + expect(wrapper.find('.title-install-pill').exists()).toBe(false) expect(wrapper.find('header').classes()).not.toContain('is-consent-lockdown') bridgeState.firstUseModeChangedCallbacks.forEach((cb) => cb('consent-lockdown')) @@ -427,7 +376,7 @@ describe('TitleBarApp', () => { expect(wrapper.find('.title-menu-button[aria-haspopup="menu"]').exists()).toBe(false) expect(wrapper.find('.title-downloads-tray').exists()).toBe(false) expect(wrapper.find('.title-feedback-button').exists()).toBe(false) - expect(wrapper.find('.title-install-pill.is-interactive').exists()).toBe(false) + expect(wrapper.find('.title-install-pill').exists()).toBe(true) bridgeState.firstUseModeChangedCallbacks.forEach((cb) => cb('post-consent')) await flushPromises() @@ -435,7 +384,7 @@ describe('TitleBarApp', () => { expect(wrapper.find('.title-menu-button[aria-haspopup="menu"]').exists()).toBe(true) expect(wrapper.find('.title-downloads-tray').exists()).toBe(false) expect(wrapper.find('.title-feedback-button').exists()).toBe(false) - expect(wrapper.find('.title-install-pill.is-interactive').exists()).toBe(false) + expect(wrapper.find('.title-install-pill').exists()).toBe(true) bridgeState.firstUseModeChangedCallbacks.forEach((cb) => cb('loading-lockdown')) await flushPromises() @@ -443,7 +392,7 @@ describe('TitleBarApp', () => { expect(wrapper.find('.title-menu-button[aria-haspopup="menu"]').exists()).toBe(true) expect(wrapper.find('.title-downloads-tray').exists()).toBe(true) expect(wrapper.find('.title-feedback-button').exists()).toBe(true) - expect(wrapper.find('.title-install-pill.is-interactive').exists()).toBe(true) + expect(wrapper.find('.title-install-pill').exists()).toBe(false) bridgeState.firstUseModeChangedCallbacks.forEach((cb) => cb('none')) await flushPromises() @@ -451,7 +400,7 @@ describe('TitleBarApp', () => { expect(wrapper.find('.title-menu-button[aria-haspopup="menu"]').exists()).toBe(true) expect(wrapper.find('.title-downloads-tray').exists()).toBe(true) expect(wrapper.find('.title-feedback-button').exists()).toBe(true) - expect(wrapper.find('.title-install-pill.is-interactive').exists()).toBe(true) + expect(wrapper.find('.title-install-pill').exists()).toBe(false) wrapper.unmount() }) @@ -560,10 +509,16 @@ describe('TitleBarApp', () => { expect(wrapper.find('header').classes()).not.toContain('is-fullscreen') }) + function enterFirstUseTakeover(): Promise { + bridgeState.firstUseModeChangedCallbacks.forEach((cb) => cb('consent-lockdown')) + return flushPromises() + } + it('hides the install-type icon by default until main pushes a category', async () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp) await flushPromises() + await enterFirstUseTakeover() expect(wrapper.find('.title-install-type-icon').exists()).toBe(false) }) @@ -571,6 +526,7 @@ describe('TitleBarApp', () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp) await flushPromises() + await enterFirstUseTakeover() bridgeState.sourceCategoryChangedCallbacks.forEach((cb) => cb('local')) await flushPromises() const icon = wrapper.find('.title-install-type-icon') @@ -583,6 +539,7 @@ describe('TitleBarApp', () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp) await flushPromises() + await enterFirstUseTakeover() bridgeState.sourceCategoryChangedCallbacks.forEach((cb) => cb('cloud')) await flushPromises() expect(wrapper.find('.title-install-type-icon').attributes('title')).toBe('Cloud') @@ -597,6 +554,7 @@ describe('TitleBarApp', () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp) await flushPromises() + await enterFirstUseTakeover() bridgeState.sourceCategoryChangedCallbacks.forEach((cb) => cb('local')) await flushPromises() expect(wrapper.find('.title-install-type-icon').exists()).toBe(false) @@ -606,6 +564,7 @@ describe('TitleBarApp', () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp) await flushPromises() + await enterFirstUseTakeover() bridgeState.sourceCategoryChangedCallbacks.forEach((cb) => cb('local')) await flushPromises() expect(wrapper.find('.title-install-type-icon').exists()).toBe(true) @@ -722,48 +681,6 @@ describe('TitleBarApp', () => { expect(pill.text()).toContain('Desktop Update Ready') }) - it('renders the install-update chip inside the center pill when onInstallUpdateAvailable=true', async () => { - const { default: TitleBarApp } = await import('./TitleBarApp.vue') - const wrapper = mount(TitleBarApp) - await flushPromises() - expect(wrapper.find('.title-install-update-chip').exists()).toBe(false) - bridgeState.installUpdateAvailableCallbacks.forEach((cb) => - cb({ available: true, version: null }) - ) - await flushPromises() - const chip = wrapper.find('.title-install-update-chip') - expect(chip.exists()).toBe(true) - expect(chip.text()).toBe('Update') - }) - - it('keeps the chip label short and carries the version in its tooltip', async () => { - const { default: TitleBarApp } = await import('./TitleBarApp.vue') - const wrapper = mount(TitleBarApp) - await flushPromises() - bridgeState.installUpdateAvailableCallbacks.forEach((cb) => - cb({ available: true, version: 'v1.2.3' }) - ) - await flushPromises() - const chip = wrapper.find('.title-install-update-chip') - expect(chip.exists()).toBe(true) - expect(chip.text()).toBe('Update') - expect(chip.attributes('title')).toBe('ComfyUI v1.2.3') - expect(chip.attributes('aria-label')).toBe('ComfyUI v1.2.3') - }) - - it('suppresses the install-update pill on install-less host windows even when push fires', async () => { - bridgeState = installMockBridge({ installationId: null }) - vi.resetModules() - const { default: TitleBarApp } = await import('./TitleBarApp.vue') - const wrapper = mount(TitleBarApp) - await flushPromises() - bridgeState.installUpdateAvailableCallbacks.forEach((cb) => - cb({ available: true, version: null }) - ) - await flushPromises() - expect(wrapper.find('.title-install-update-chip').exists()).toBe(false) - }) - it('forwards app-update pill clicks through the bridge', async () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp, { attachTo: document.body }) @@ -777,19 +694,6 @@ describe('TitleBarApp', () => { wrapper.unmount() }) - it('forwards install-update chip clicks through the bridge', async () => { - const { default: TitleBarApp } = await import('./TitleBarApp.vue') - const wrapper = mount(TitleBarApp, { attachTo: document.body }) - await flushPromises() - bridgeState.installUpdateAvailableCallbacks.forEach((cb) => - cb({ available: true, version: null }) - ) - await flushPromises() - await wrapper.find('.title-install-update-chip').trigger('click') - expect(bridgeState.installUpdatePillClicks).toBe(1) - wrapper.unmount() - }) - it('hides the app-update pill when state transitions back to kind=null', async () => { const { default: TitleBarApp } = await import('./TitleBarApp.vue') const wrapper = mount(TitleBarApp) @@ -1173,218 +1077,92 @@ describe('TitleBarApp', () => { } }) - describe('trailing-width mirror (true-centered install pill)', () => { - type ResizeCallback = (entries: ResizeObserverEntry[], obs: ResizeObserver) => void - interface ResizeObserverHandle { - observed: Element[] - fire: (width: number) => void - } + describe('fitting the right side next to Home', () => { + const rect = (left: number, width: number): DOMRect => + ({ + left, + right: left + width, + width, + top: 0, + bottom: 32, + height: 32, + x: left, + y: 0 + }) as DOMRect + + let resizeCallbacks: ResizeObserverCallback[] = [] - let handles: ResizeObserverHandle[] - let originalResizeObserver: typeof globalThis.ResizeObserver | undefined - - function installStub(): void { - function StubCtor(this: unknown, cb: ResizeCallback) { - const self = this as { observed: Element[]; cb: ResizeCallback } - self.observed = [] - self.cb = cb - const handle: ResizeObserverHandle = { - observed: self.observed, - fire(width: number) { - self.cb( - [{ contentRect: { width, height: 28 } as DOMRectReadOnly } as ResizeObserverEntry], - self as unknown as ResizeObserver - ) + beforeEach(() => { + resizeCallbacks = [] + vi.stubGlobal( + 'ResizeObserver', + class { + constructor(cb: ResizeObserverCallback) { + resizeCallbacks.push(cb) } + observe(): void {} + unobserve(): void {} + disconnect(): void {} } - handles.push(handle) - } - StubCtor.prototype.observe = function observe(this: { observed: Element[] }, el: Element) { - this.observed.push(el) - } - StubCtor.prototype.disconnect = function disconnect(this: { observed: Element[] }) { - this.observed.length = 0 - } - StubCtor.prototype.unobserve = function unobserve() {} - ;(globalThis as { ResizeObserver?: unknown }).ResizeObserver = - StubCtor as unknown as typeof globalThis.ResizeObserver - } - - beforeEach(() => { - handles = [] - originalResizeObserver = (globalThis as { ResizeObserver?: typeof globalThis.ResizeObserver }) - .ResizeObserver - installStub() + ) }) afterEach(() => { - if (originalResizeObserver) { - ;(globalThis as { ResizeObserver?: typeof globalThis.ResizeObserver }).ResizeObserver = - originalResizeObserver - } else { - delete (globalThis as { ResizeObserver?: typeof globalThis.ResizeObserver }).ResizeObserver - } - }) - - it('observes the trailing cluster on mount and disconnects on unmount', async () => { - const mod = await import('./TitleBarApp.vue') - const wrapper = mount(mod.default, { attachTo: document.body }) - await flushPromises() - expect(handles).toHaveLength(2) - const trailingEl = wrapper.find('.title-trailing').element - const handle = handles.find((h) => h.observed[0] === trailingEl) - expect(handle).toBeDefined() - wrapper.unmount() - for (const h of handles) { - expect(h.observed).toHaveLength(0) - } - }) - - it('mirrors trailing width onto the title bar as `--title-trailing-width`', async () => { - const mod = await import('./TitleBarApp.vue') - const wrapper = mount(mod.default, { attachTo: document.body }) - await flushPromises() - const titleBar = wrapper.find('.title-bar').element as HTMLElement - const handle = handles[0]! - expect(titleBar.style.getPropertyValue('--title-trailing-width')).toBe('0px') - handle.fire(240) - await flushPromises() - expect(titleBar.style.getPropertyValue('--title-trailing-width')).toBe('240px') - handle.fire(520) - await flushPromises() - expect(titleBar.style.getPropertyValue('--title-trailing-width')).toBe('520px') - wrapper.unmount() + vi.unstubAllGlobals() + vi.restoreAllMocks() }) - it('does not update the CSS var when the width is unchanged (avoids redundant style writes)', async () => { - const mod = await import('./TitleBarApp.vue') - const wrapper = mount(mod.default, { attachTo: document.body }) - await flushPromises() - const titleBar = wrapper.find('.title-bar').element as HTMLElement - const handle = handles[0]! - handle.fire(300) + async function mountWithTrailingAt(trailingLeft: number) { + vi.spyOn(Element.prototype, 'getBoundingClientRect').mockImplementation(function ( + this: Element + ) { + if (this.matches('header')) return rect(0, 800) + if (this.closest('.title-trailing')) return rect(trailingLeft, 788 - trailingLeft) + return rect(12, 88) + }) + const { default: TitleBarApp } = await import('./TitleBarApp.vue') + const wrapper = mount(TitleBarApp, { attachTo: document.body }) + const header = wrapper.find('header').element as HTMLElement + header.style.columnGap = '12px' await flushPromises() - expect(titleBar.style.getPropertyValue('--title-trailing-width')).toBe('300px') - handle.fire(300) + resizeCallbacks.forEach((cb) => cb([], {} as ResizeObserver)) + await new Promise((resolve) => requestAnimationFrame(resolve)) await flushPromises() - expect(titleBar.style.getPropertyValue('--title-trailing-width')).toBe('300px') - wrapper.unmount() - }) + return wrapper + } - it('rounds fractional widths up so the left-cluster reservation never under-shoots', async () => { - const mod = await import('./TitleBarApp.vue') - const wrapper = mount(mod.default, { attachTo: document.body }) - await flushPromises() - const titleBar = wrapper.find('.title-bar').element as HTMLElement - const handle = handles[0]! - handle.fire(287.4) - await flushPromises() - expect(titleBar.style.getPropertyValue('--title-trailing-width')).toBe('288px') + it('collapses once only the two grid gutters are left between Home and the right side', async () => { + const wrapper = await mountWithTrailingAt(124) + expect(wrapper.find('header').classes()).toContain('is-collapsed-feedback') wrapper.unmount() }) - it('does not crash if ResizeObserver is unavailable (older Electron / SSR-safety)', async () => { - delete (globalThis as { ResizeObserver?: typeof globalThis.ResizeObserver }).ResizeObserver - const mod = await import('./TitleBarApp.vue') - const wrapper = mount(mod.default, { attachTo: document.body }) - await flushPromises() - const titleBar = wrapper.find('.title-bar').element as HTMLElement - expect(titleBar.style.getPropertyValue('--title-trailing-width')).toBe('0px') - expect(wrapper.find('.title-install-pill').exists()).toBe(true) + it('stays expanded while the empty middle still has room', async () => { + const wrapper = await mountWithTrailingAt(200) + expect(wrapper.find('header').classes()).not.toContain('is-collapsed-feedback') wrapper.unmount() }) }) - describe('first-instance pill coachmark', () => { - let getSetting: ReturnType - let setSetting: ReturnType - let getPendingBetaNotice: ReturnType + describe('without ResizeObserver', () => { + let originalResizeObserver: typeof globalThis.ResizeObserver | undefined beforeEach(() => { - getSetting = vi.fn().mockResolvedValue(undefined) - setSetting = vi.fn().mockResolvedValue(undefined) - getPendingBetaNotice = vi.fn().mockResolvedValue(null) - ;(window as unknown as { api: unknown }).api = { - getSetting, - setSetting, - getPendingBetaNotice, - acknowledgeBetaNotice: vi.fn().mockResolvedValue(undefined), - openGlobalSettings: vi.fn() - } - vi.spyOn(window, 'requestAnimationFrame').mockImplementation((cb) => { - cb(0) - return 0 - }) + originalResizeObserver = (globalThis as { ResizeObserver?: typeof globalThis.ResizeObserver }) + .ResizeObserver + delete (globalThis as { ResizeObserver?: typeof globalThis.ResizeObserver }).ResizeObserver }) afterEach(() => { - vi.restoreAllMocks() - delete (window as unknown as { api?: unknown }).api - }) - - it('shows the coachmark when a window attaches to an instance AFTER mount', async () => { - bridgeState = installMockBridge({ installationId: null }) - vi.resetModules() - const { default: TitleBarApp } = await import('./TitleBarApp.vue') - const wrapper = mount(TitleBarApp, { attachTo: document.body }) - await flushPromises() - expect(bridgeState.showCoachmarkCalls.length).toBe(0) - - bridgeState.installationIdChangedCallbacks.forEach((cb) => cb('inst-1')) - await flushPromises() - - expect(bridgeState.showCoachmarkCalls.length).toBe(1) - const payload = bridgeState.showCoachmarkCalls[0] - expect(payload.title).toBe('Switch & manage instances') - wrapper.unmount() - }) - - it('does not show the coachmark on an install-less (dashboard) window', async () => { - bridgeState = installMockBridge({ installationId: null }) - vi.resetModules() - const { default: TitleBarApp } = await import('./TitleBarApp.vue') - const wrapper = mount(TitleBarApp, { attachTo: document.body }) - await flushPromises() - expect(bridgeState.showCoachmarkCalls.length).toBe(0) - wrapper.unmount() - }) - - it('does not show the coachmark when already seen', async () => { - getSetting.mockImplementation((key: string) => - key === 'hasSeenCentralPillHint' ? Promise.resolve(true) : Promise.resolve(undefined) - ) - bridgeState = installMockBridge({ installationId: 'inst-1' }) - vi.resetModules() - const { default: TitleBarApp } = await import('./TitleBarApp.vue') - const wrapper = mount(TitleBarApp, { attachTo: document.body }) - await flushPromises() - expect(bridgeState.showCoachmarkCalls.length).toBe(0) - wrapper.unmount() - }) - - it('waits for loading-lockdown to clear (ComfyUI screen visible) before showing', async () => { - bridgeState = installMockBridge({ installationId: 'inst-1' }) - vi.resetModules() - const { default: TitleBarApp } = await import('./TitleBarApp.vue') - const wrapper = mount(TitleBarApp, { attachTo: document.body }) - bridgeState.firstUseModeChangedCallbacks.forEach((cb) => cb('loading-lockdown')) - await flushPromises() - expect(bridgeState.showCoachmarkCalls.length).toBe(0) - - bridgeState.firstUseModeChangedCallbacks.forEach((cb) => cb('none')) - await flushPromises() - expect(bridgeState.showCoachmarkCalls.length).toBe(1) - wrapper.unmount() + ;(globalThis as { ResizeObserver?: typeof globalThis.ResizeObserver }).ResizeObserver = + originalResizeObserver }) - it('lifts the pill to the brand-open state while the coachmark is showing', async () => { - bridgeState = installMockBridge({ installationId: 'inst-1' }) - vi.resetModules() - const { default: TitleBarApp } = await import('./TitleBarApp.vue') - const wrapper = mount(TitleBarApp, { attachTo: document.body }) + it('still mounts and renders the title bar', async () => { + const mod = await import('./TitleBarApp.vue') + const wrapper = mount(mod.default, { attachTo: document.body }) await flushPromises() - expect(bridgeState.showCoachmarkCalls.length).toBe(1) - expect(wrapper.find('.title-install-pill.is-coachmark').exists()).toBe(true) + expect(wrapper.find('.title-trailing').exists()).toBe(true) wrapper.unmount() }) }) @@ -1402,7 +1180,6 @@ describe('TitleBarApp', () => { direction: 'enabled' | 'disabled' description: string | null } | null - pillHintSeen?: boolean } = {} ): void { const pending = @@ -1414,13 +1191,7 @@ describe('TitleBarApp', () => { openGlobalSettings = vi.fn() setSetting = vi.fn().mockResolvedValue(undefined) ;(window as unknown as { api: unknown }).api = { - getSetting: vi - .fn() - .mockImplementation((key: string) => - key === 'hasSeenCentralPillHint' - ? Promise.resolve(opts.pillHintSeen !== false) - : Promise.resolve(undefined) - ), + getSetting: vi.fn().mockResolvedValue(undefined), setSetting, getPendingBetaNotice, acknowledgeBetaNotice, @@ -1477,15 +1248,6 @@ describe('TitleBarApp', () => { wrapper.unmount() }) - it('defers while the onboarding pill hint owns the popup', async () => { - installApiMock({ pillHintSeen: false }) - const wrapper = await mountBar() - expect(bridgeState.showCoachmarkCalls.length).toBe(1) - expect(bridgeState.showCoachmarkCalls[0]!.kind).not.toBe('beta-notice') - expect(acknowledgeBetaNotice).not.toHaveBeenCalled() - wrapper.unmount() - }) - it('acknowledges on dismiss so the notice never returns', async () => { const wrapper = await mountBar() bridgeState.coachmarkDismissedCallbacks.forEach((cb) => cb({ kind: 'beta-notice' })) @@ -1527,25 +1289,12 @@ describe('TitleBarApp', () => { direction: 'enabled', description: null }) - bridgeState.coachmarkDismissedCallbacks.forEach((cb) => cb({ kind: 'pill-hint' })) + bridgeState.coachmarkSettledCallbacks.forEach((cb) => cb({ kind: 'beta-notice' })) await flushPromises() expect(betaCards().length).toBe(2) wrapper.unmount() }) - it('ignores an auto-hide addressed to the other card', async () => { - const wrapper = await mountBar() - expect(betaCards().length).toBe(1) - - bridgeState.coachmarkAutoHiddenCallbacks.forEach((cb) => cb({ kind: 'pill-hint' })) - await flushPromises() - bridgeState.coachmarkDismissedCallbacks.forEach((cb) => cb({ kind: 'beta-notice' })) - await flushPromises() - - expect(acknowledgeBetaNotice).toHaveBeenCalledWith('inst-1', ['--enable-assets']) - wrapper.unmount() - }) - it('opens Settings on the beta opt-in row and retires the card in one click', async () => { const wrapper = await mountBar() bridgeState.coachmarkActionCallbacks.forEach((cb) => cb({ kind: 'beta-notice' })) @@ -1557,48 +1306,6 @@ describe('TitleBarApp', () => { wrapper.unmount() }) - it('survives the pill drawer opening: the hint must not hide a card it did not raise', async () => { - const wrapper = await mountBar() - expect(betaCards().length).toBe(1) - const hidesBefore = bridgeState.hideCoachmarkCalls - - expect(await wrapper.find('.title-install-pill').exists()).toBe(true) - await wrapper.find('.title-install-pill').trigger('click') - await flushPromises() - - expect(bridgeState.hideCoachmarkCalls).toBe(hidesBefore) - expect(acknowledgeBetaNotice).not.toHaveBeenCalled() - wrapper.unmount() - }) - - it('re-raises the onboarding hint after movement auto-hides it', async () => { - installApiMock({ pillHintSeen: false }) - const wrapper = await mountBar() - const hintCards = () => bridgeState.showCoachmarkCalls.filter((c) => c.kind !== 'beta-notice') - expect(hintCards().length).toBe(1) - expect(betaCards().length).toBe(0) - - bridgeState.coachmarkAutoHiddenCallbacks.forEach((cb) => cb({ kind: 'pill-hint' })) - bridgeState.coachmarkSettledCallbacks.forEach((cb) => cb({ kind: 'pill-hint' })) - await flushPromises() - - expect(hintCards().length).toBe(2) - expect(setSetting).not.toHaveBeenCalledWith('hasSeenCentralPillHint', true) - wrapper.unmount() - }) - - it('retries once the onboarding hint releases the popup', async () => { - installApiMock({ pillHintSeen: false }) - const wrapper = await mountBar() - expect(betaCards().length).toBe(0) - - bridgeState.coachmarkDismissedCallbacks.forEach((cb) => cb({ kind: 'pill-hint' })) - await flushPromises() - - expect(betaCards().length).toBe(1) - wrapper.unmount() - }) - it('never acknowledges an install the card was not raised for', async () => { getPendingBetaNotice.mockImplementation(async (id: string) => id === 'inst-1' @@ -1700,13 +1407,5 @@ describe('TitleBarApp', () => { expect(payload.actionLabel).toBe('Settings') wrapper.unmount() }) - - it('routes a pill-hint dismiss away from the beta notice', async () => { - const wrapper = await mountBar() - bridgeState.coachmarkDismissedCallbacks.forEach((cb) => cb({ kind: 'pill-hint' })) - await flushPromises() - expect(acknowledgeBetaNotice).not.toHaveBeenCalled() - wrapper.unmount() - }) }) }) diff --git a/src/renderer/src/comfyTitleBar/TitleBarApp.vue b/src/renderer/src/comfyTitleBar/TitleBarApp.vue index 134b2e789..53bb13fcd 100644 --- a/src/renderer/src/comfyTitleBar/TitleBarApp.vue +++ b/src/renderer/src/comfyTitleBar/TitleBarApp.vue @@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n' import { ArrowDownToLine, Bell, - ChevronDown, CloudDownload, House, Loader2, @@ -19,7 +18,6 @@ import { useTitleBarMenus } from './useTitleBarMenus' import { useTitleBarIdentity } from './useTitleBarIdentity' import { useUpdatePills } from './useUpdatePills' import { useTitleBarHoverGate } from './useTitleBarHoverGate' -import { useCentralPillCoachmark } from './useCentralPillCoachmark' import { useBetaActivationNotice } from './useBetaActivationNotice' import { useAppLocale, windowApiLocaleSource } from '../lib/useAppLocale' import ComfyCLogo from '../components/icons/ComfyCLogo.vue' @@ -36,7 +34,7 @@ type ComfyPanelKey = | 'load-snapshot' | 'quick-install' -type CoachmarkKind = 'pill-hint' | 'beta-notice' +type CoachmarkKind = 'beta-notice' interface MenuAnchor { x: number @@ -110,7 +108,6 @@ interface Bridge { clickInstallUpdatePill: () => void onDownloadsChanged: (cb: (state: DownloadsTrayState) => void) => () => void clickDownloadsTray: (anchor: MenuAnchor) => void - clickInstallPill: (anchor: MenuAnchor) => void clickFeedback: () => void clickAnnouncement: () => void clickRefreshInstance: () => void @@ -126,19 +123,8 @@ const titleMenuButtonClass = const titleInstallPillClass = [ '[-webkit-app-region:no-drag] inline-flex h-7 items-center gap-2 [inline-size:fit-content] [min-inline-size:200px] [max-inline-size:clamp(200px,22cqi,360px)] rounded-[999px] border border-solid border-transparent bg-[var(--chooser-surface-bg)] py-[5px] pr-2.5 pl-3 [font-family:inherit] text-[12px] leading-[inherit] font-normal text-neutral-100 cursor-default transition-[background-color,border-color,color] duration-[120ms] ease-[ease]', - '[&.is-interactive]:cursor-pointer', - '[&.is-interactive:focus-visible]:outline-none [&.is-interactive:focus-visible]:outline-current', - '[&.is-install-less]:opacity-85', - '[.title-bar.is-hover-active_&.is-interactive:hover:not(.is-open)]:bg-[var(--chooser-surface-bg-hover)] [.title-bar.is-hover-active_&.is-interactive:hover:not(.is-open)]:border-[color-mix(in_srgb,var(--neutral-50)_35%,transparent)] [.title-bar.is-hover-active_&.is-interactive:hover:not(.is-open)]:text-[color-mix(in_srgb,var(--neutral-50)_70%,var(--neutral-100))]', - '[&.is-interactive:focus-visible:not(.is-open)]:bg-[var(--chooser-surface-bg-hover)] [&.is-interactive:focus-visible:not(.is-open)]:border-[color-mix(in_srgb,var(--neutral-50)_35%,transparent)] [&.is-interactive:focus-visible:not(.is-open)]:text-[color-mix(in_srgb,var(--neutral-50)_70%,var(--neutral-100))]', - '[&.is-interactive.is-open]:border-neutral-50 [&.is-interactive.is-open]:text-neutral-50', '[.title-bar.is-light_&]:bg-[rgba(0,0,0,0.04)] [.title-bar.is-light_&]:text-neutral-700', - '[.title-bar:not(.is-light)_&]:border-border [.title-bar:not(.is-light)_&]:bg-[oklch(1_0_0/0.04)] [.title-bar:not(.is-light)_&]:text-text-muted', - '[.title-bar.is-light.is-hover-active_&.is-interactive:hover:not(.is-open)]:bg-[rgba(0,0,0,0.07)] [.title-bar.is-light.is-hover-active_&.is-interactive:hover:not(.is-open)]:border-[color-mix(in_srgb,var(--neutral-700)_35%,transparent)] [.title-bar.is-light.is-hover-active_&.is-interactive:hover:not(.is-open)]:text-neutral-700', - '[.title-bar.is-light_&.is-interactive:focus-visible:not(.is-open)]:bg-[rgba(0,0,0,0.07)] [.title-bar.is-light_&.is-interactive:focus-visible:not(.is-open)]:border-[color-mix(in_srgb,var(--neutral-700)_35%,transparent)] [.title-bar.is-light_&.is-interactive:focus-visible:not(.is-open)]:text-neutral-700', - '[.title-bar.is-hover-active:not(.is-light)_&.is-interactive:hover:not(.is-open)]:border-[oklch(1_0_0/0.12)] [.title-bar.is-hover-active:not(.is-light)_&.is-interactive:hover:not(.is-open)]:bg-[oklch(1_0_0/0.07)] [.title-bar.is-hover-active:not(.is-light)_&.is-interactive:hover:not(.is-open)]:text-text', - '[.title-bar:not(.is-light)_&.is-interactive.is-open]:border-[oklch(1_0_0/0.3)] [.title-bar:not(.is-light)_&.is-interactive.is-open]:bg-[oklch(1_0_0/0.07)] [.title-bar:not(.is-light)_&.is-interactive.is-open]:text-text', - '[.title-bar.is-light_&.is-interactive.is-open]:border-[color-mix(in_srgb,var(--neutral-700)_55%,transparent)] [.title-bar.is-light_&.is-interactive.is-open]:text-neutral-700' + '[.title-bar:not(.is-light)_&]:border-border [.title-bar:not(.is-light)_&]:bg-[oklch(1_0_0/0.04)] [.title-bar:not(.is-light)_&]:text-text-muted' ].join(' ') const titleHomeButtonClass = @@ -190,11 +176,8 @@ const { appUpdateState, appUpdatePillLabel, appUpdatePillTooltip, - installUpdatePillLabel, showAppUpdatePill, - showInstallUpdatePill, - handleAppUpdatePill, - handleInstallUpdatePill + handleAppUpdatePill } = useUpdatePills({ bridge, isInstallLess }) function handleFeedback(): void { @@ -245,12 +228,9 @@ const titleBarRef = useTemplateRef('titleBar') const fileBtnRef = useTemplateRef('fileBtn') const downloadsBtnRef = useTemplateRef('downloadsBtn') const announcementBtnRef = useTemplateRef('announcementBtn') -const installPillRef = useTemplateRef('installPill') +const titleClusterRef = useTemplateRef('titleCluster') const titleTrailingRef = useTemplateRef('titleTrailing') -const trailingWidthPx = ref(0) -let trailingObserver: ResizeObserver | undefined - type CollapseMode = 'full' | 'no-feedback' | 'icons-only' const collapseMode = ref('full') const collapsedFeedback = computed( @@ -275,13 +255,20 @@ interface FitMeasurement { function measureFit(): FitMeasurement { const bar = titleBarRef.value const trailing = titleTrailingRef.value - const pill = installPillRef.value - if (!bar || !trailing || !pill) return { gap: Infinity, trailingWidth: NaN } + const cluster = titleClusterRef.value + if (!bar || !trailing || !cluster) return { gap: Infinity, trailingWidth: NaN } const barRect = bar.getBoundingClientRect() if (barRect.width === 0) return { gap: Infinity, trailingWidth: NaN } const trailingRect = trailing.getBoundingClientRect() - const pillRect = pill.getBoundingClientRect() - return { gap: trailingRect.left - pillRect.right, trailingWidth: trailingRect.width } + const leadingRight = Math.max( + cluster.getBoundingClientRect().left, + ...Array.from(cluster.children).map((child) => child.getBoundingClientRect().right) + ) + const guttersAroundMiddle = 2 * (Number.parseFloat(getComputedStyle(bar).columnGap) || 0) + return { + gap: trailingRect.left - leadingRight - guttersAroundMiddle, + trailingWidth: trailingRect.width + } } function scheduleFit(): void { @@ -346,33 +333,18 @@ const { isHoverActive } = useTitleBarHoverGate({ hideTip, handleTooltipPointer } const { isDownloadsOpen, - isInstancePickerOpen, downloadsActiveCount, unseenFinishedCount, unseenErrorCount, downloadsTrayLabel, downloadsStartedAt, handleFileMenu, - handleDownloadsTray, - handleInstallPill + handleDownloadsTray } = useTitleBarMenus({ bridge, hideTip, fileBtnRef, - downloadsBtnRef, - installPillRef -}) - -const coachmark = useCentralPillCoachmark({ - bridge, - isInstallLess, - isFirstUseLockdown, - isLoadingLockdown, - ownsPopup: () => coachmark.isShowing.value, - installPillRef, - title: t('titleBar.pillHintTitle'), - body: t('titleBar.pillHintBody'), - dismissLabel: t('titleBar.pillHintDismiss') + downloadsBtnRef }) const betaNotice = useBetaActivationNotice({ @@ -382,7 +354,6 @@ const betaNotice = useBetaActivationNotice({ isFirstUseLockdown, isLoadingLockdown, anchorRef: announcementBtnRef, - isSuppressed: () => coachmark.isShowing.value, copyFor: ({ direction, description }) => { const keys = direction === 'disabled' @@ -402,19 +373,7 @@ const betaNotice = useBetaActivationNotice({ } }) -function handleInstallPillWithCoachmark(): void { - void coachmark.acknowledgeViaPillOpen().then(retryBetaNoticeAfterHint) - handleInstallPill() -} - -function reshowCoachmarksAfterMove(): void { - if (unmounted) return - void coachmark.maybeShow().then(() => { - if (!unmounted) void betaNotice.maybeShow() - }) -} - -function retryBetaNoticeAfterHint(): void { +function retryBetaNotice(): void { if (unmounted) return void nextTick().then(() => { if (!unmounted) void betaNotice.maybeShow() @@ -443,18 +402,6 @@ let unsubCoachmarkSettled: (() => void) | undefined let unsubCoachmarkDisplaced: (() => void) | undefined onMounted(() => { - if (titleTrailingRef.value && typeof ResizeObserver !== 'undefined') { - trailingObserver = new ResizeObserver((entries) => { - const entry = entries[0] - if (!entry) return - const width = Math.ceil(entry.contentRect.width) - if (width !== trailingWidthPx.value) { - trailingWidthPx.value = width - } - }) - trailingObserver.observe(titleTrailingRef.value) - } - if (titleBarRef.value && typeof ResizeObserver !== 'undefined') { fitObserver = new ResizeObserver(() => scheduleFit()) fitObserver.observe(titleBarRef.value) @@ -481,26 +428,23 @@ onMounted(() => { bridge.hideCoachmark() betaNotice.forgetWithoutAcknowledging() } - retryBetaNoticeAfterHint() + retryBetaNotice() } }) unsubCoachmarkDismissed = bridge.onCoachmarkDismissed(({ kind }) => { if (kind === 'beta-notice') void betaNotice.dismiss() - else void coachmark.dismiss().then(retryBetaNoticeAfterHint) }) unsubCoachmarkAction = bridge.onCoachmarkAction(({ kind }) => { if (kind === 'beta-notice') void betaNotice.openSettings() }) unsubCoachmarkAutoHidden = bridge.onCoachmarkAutoHidden(({ kind }) => { if (kind === 'beta-notice') betaNotice.forgetWithoutAcknowledging() - else coachmark.forgetWithoutAcknowledging() }) unsubCoachmarkSettled = bridge.onCoachmarkSettled(() => { - reshowCoachmarksAfterMove() + if (!unmounted) void betaNotice.maybeShow() }) unsubCoachmarkDisplaced = bridge.onCoachmarkDisplaced(({ kind }) => { if (kind === 'beta-notice') betaNotice.forgetWithoutAcknowledging() - else coachmark.forgetWithoutAcknowledging() }) bridge.ready() }) @@ -514,26 +458,15 @@ watch( } void nextTick().then(() => { requestAnimationFrame(() => { - if (unmounted) return - void coachmark.maybeShow().then(() => { - if (!unmounted) void betaNotice.maybeShow() - }) + if (!unmounted) void betaNotice.maybeShow() }) }) }, { immediate: true } ) -watch( - [ - locale, - installLabel, - appUpdatePillLabel, - showAppUpdatePill, - showInstallUpdatePill, - isFirstUseLockdown - ], - () => invalidateRestoreCosts() +watch([locale, installLabel, appUpdatePillLabel, showAppUpdatePill, isFirstUseLockdown], () => + invalidateRestoreCosts() ) onUnmounted(() => { @@ -548,8 +481,6 @@ onUnmounted(() => { unsubCoachmarkDisplaced?.() bridge?.hideCoachmark() hideTip() - trailingObserver?.disconnect() - trailingObserver = undefined fitObserver?.disconnect() fitObserver = undefined if (fitRaf !== null) { @@ -570,7 +501,7 @@ onUnmounted(() => {