From adefb435886a1712bf32190f52996f3c19fc047b Mon Sep 17 00:00:00 2001 From: CommaBot Date: Sun, 29 Nov 2026 20:43:30 +0000 Subject: [PATCH] fix(core): restore sync progress tooltip and remove nested hover (#15971) Use Tooltip for non-diagnostic sync status in WorkspaceCard so hover shows sync progress and clicks still open the workspace selector. Pass withoutHover and tooltip to the diagnostic status Button to prevent double hover backgrounds. Co-authored-by: DarkSky --- .../workspace-card/index.spec.tsx | 36 ++++++++++ .../workspace-card/index.tsx | 70 +++++++++++-------- .../workspace-card/styles.css.ts | 3 + 3 files changed, 80 insertions(+), 29 deletions(-) diff --git a/packages/frontend/core/src/components/workspace-selector/workspace-card/index.spec.tsx b/packages/frontend/core/src/components/workspace-selector/workspace-card/index.spec.tsx index 451d038e34..1a71289601 100644 --- a/packages/frontend/core/src/components/workspace-selector/workspace-card/index.spec.tsx +++ b/packages/frontend/core/src/components/workspace-selector/workspace-card/index.spec.tsx @@ -98,6 +98,7 @@ test.each([undefined, 'server-revision'])( try { expect(await screen.findByText('Upload paused')).toBeTruthy(); const status = screen.getByRole('button', { name: 'Sync status' }); + expect(Object.hasOwn(status.dataset, 'noHover')).toBe(true); status.focus(); expect(document.activeElement).toBe(status); fireEvent.click(status); @@ -129,3 +130,38 @@ test.each([undefined, 'server-revision'])( } } ); + +test('syncing status shows progress tooltip without nested hover button', async () => { + const onCardClick = vi.fn(); + mocks.workspace = { + id: 'workspace-syncing', + flavour: 'affine-cloud', + engine: { + doc: { + state$: new BehaviorSubject({ + total: 10, + syncing: 4, + synced: false, + syncRetrying: false, + syncErrorMessage: null, + }), + }, + }, + }; + const view = render( + + ); + try { + const syncing = await screen.findByText('Syncing...'); + expect(screen.getByText('Syncing with AFFiNE Cloud (60%)')).toBeTruthy(); + expect(screen.queryByRole('button', { name: 'Sync status' })).toBeNull(); + fireEvent.click(syncing); + expect(onCardClick).toHaveBeenCalledTimes(1); + } finally { + view.unmount(); + } +}); diff --git a/packages/frontend/core/src/components/workspace-selector/workspace-card/index.tsx b/packages/frontend/core/src/components/workspace-selector/workspace-card/index.tsx index 0fb6e2848c..65ef53b61f 100644 --- a/packages/frontend/core/src/components/workspace-selector/workspace-card/index.tsx +++ b/packages/frontend/core/src/components/workspace-selector/workspace-card/index.tsx @@ -315,37 +315,49 @@ const WorkspaceSyncInfo = ({ {/* when syncing/offline/... */} {syncStatus && (
- -
{syncStatus.message}
- {syncStatus.diagnostics && ( - <> - + {BUILD_CONFIG.isElectron && ( + - {BUILD_CONFIG.isElectron && ( - - )} - - )} - - } - contentOptions={{ className: styles.workspaceInfoTooltip }} - > - -
+ + + ) : ( + +
+ {syncStatus.icon} +
+
+ )}
)} diff --git a/packages/frontend/core/src/components/workspace-selector/workspace-card/styles.css.ts b/packages/frontend/core/src/components/workspace-selector/workspace-card/styles.css.ts index 0ffbbe78cf..35efeceb7d 100644 --- a/packages/frontend/core/src/components/workspace-selector/workspace-card/styles.css.ts +++ b/packages/frontend/core/src/components/workspace-selector/workspace-card/styles.css.ts @@ -120,6 +120,9 @@ globalStyle(`.${workspaceStatus} svg`, { }); export const workspaceActiveStatus = style({ + display: 'flex', + gap: 2, + alignItems: 'center', justifyContent: 'flex-start', padding: 0, fontSize: cssVar('fontSm'),