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'),