Merge branch 'main' into pr-735

This commit is contained in:
github-actions[bot]
2026-05-24 11:26:33 +00:00
committed by GitHub
10 changed files with 360 additions and 180 deletions

View File

@@ -757,12 +757,12 @@ describe('StatusBar', () => {
fireEvent.click(screen.getByTestId('status-sync'))
expect(screen.getByTestId('status-bar')).toHaveStyle({ zIndex: '30' })
expect(screen.getByTestId('git-status-popup')).toBeInTheDocument()
expect(screen.getByText('main')).toBeInTheDocument()
expect(screen.queryByText('main')).not.toBeInTheDocument()
expect(screen.getByText(/2 ahead/)).toBeInTheDocument()
expect(screen.getByText(/1 behind/)).toBeInTheDocument()
})
it('shows the selected repository on sync controls when multiple vaults are active', () => {
it('keeps sync controls vault-agnostic when multiple vaults are active', () => {
render(
<StatusBar
noteCount={100}
@@ -781,9 +781,10 @@ describe('StatusBar', () => {
/>
)
expect(screen.getByTestId('status-sync')).toHaveTextContent('Work Vault')
expect(screen.getByTestId('status-sync')).not.toHaveTextContent('Work Vault')
expect(screen.getByTestId('status-sync')).toHaveTextContent('Not synced')
fireEvent.click(screen.getByTestId('status-sync'))
expect(screen.getByTestId('git-status-repository-select')).toBeInTheDocument()
expect(screen.queryByTestId('git-status-repository-select')).not.toBeInTheDocument()
})
it('shows History badge in status bar', () => {

View File

@@ -94,7 +94,7 @@ describe('StatusBarBadges extra coverage', () => {
fireEvent.click(screen.getByTestId('status-sync'))
expect(screen.getByTestId('git-status-popup')).toHaveTextContent('main')
expect(screen.getByTestId('git-status-popup')).not.toHaveTextContent('main')
expect(screen.getByText('↑ 2 ahead')).toBeInTheDocument()
expect(screen.getByText('↓ 1 behind')).toBeInTheDocument()
expect(screen.getByText(/Status: Synced/)).toBeInTheDocument()

View File

@@ -8,8 +8,7 @@ import type { McpStatus } from '../../hooks/useMcpStatus'
import { translate, type AppLocale, type TranslationKey } from '../../lib/i18n'
import type { GitRemoteStatus, LastCommitInfo, SyncStatus } from '../../types'
import { openExternalUrl } from '../../utils/url'
import { gitRepositoryLabel, type GitRepositoryOption } from '../../utils/gitRepositories'
import { GitRepositorySelect } from '../GitRepositorySelect'
import type { GitRepositoryOption } from '../../utils/gitRepositories'
import { useDismissibleLayer } from './useDismissibleLayer'
import { ICON_STYLE, SEP_STYLE } from './styles'
@@ -45,16 +44,6 @@ function formatSyncLabel(locale: AppLocale, status: SyncStatus, lastSyncTime: nu
return labelKey ? translate(locale, labelKey) : formatElapsedSync(locale, lastSyncTime)
}
function formatSyncBadgeLabel(
locale: AppLocale,
status: SyncStatus,
lastSyncTime: number | null,
repositoryLabel?: string | null,
): string {
const label = formatSyncLabel(locale, status, lastSyncTime)
return repositoryLabel ? `${repositoryLabel} · ${label}` : label
}
function syncIconColor(status: SyncStatus): string {
return SYNC_COLORS.get(status) ?? 'var(--accent-green)'
}
@@ -447,9 +436,6 @@ function PullAction({
function GitStatusPopup({
status,
remoteStatus,
repositories = [],
selectedRepositoryPath,
onRepositoryChange,
locale = 'en',
onPull,
onClose,
@@ -482,21 +468,6 @@ function GitStatusPopup({
color: 'var(--foreground)',
}}
>
{repositories.length > 1 && selectedRepositoryPath && onRepositoryChange && (
<div style={{ marginBottom: 8 }}>
<GitRepositorySelect
label={translate(locale, 'git.repository.select')}
repositories={repositories}
selectedPath={selectedRepositoryPath}
onChange={onRepositoryChange}
testId="git-status-repository-select"
/>
</div>
)}
<div style={{ display: 'flex', alignItems: 'center', gap: 6, marginBottom: 6 }}>
<GitBranch size={13} style={{ color: 'var(--muted-foreground)' }} />
<span style={{ fontWeight: 500 }}>{remoteStatus?.branch || '—'}</span>
</div>
<RemoteStatusSummary remoteStatus={remoteStatus} locale={locale} />
<div style={{ display: 'flex', alignItems: 'center', gap: 6, marginBottom: 4, color: 'var(--muted-foreground)' }}>
{translate(locale, 'status.sync.status', { status: syncStatusText(locale, status) })}
@@ -681,9 +652,6 @@ export function SyncBadge({
const [showPopup, setShowPopup] = useState(false)
const popupRef = useRef<HTMLDivElement>(null)
const isSyncing = status === 'syncing'
const selectedRepositoryLabel = selectedRepositoryPath && repositories
? gitRepositoryLabel(selectedRepositoryPath, repositories)
: null
useDismissibleLayer(showPopup, popupRef, () => setShowPopup(false))
@@ -706,7 +674,7 @@ export function SyncBadge({
<StatusBarAction copy={syncBadgeTooltipCopy(locale, status)} onClick={handleClick} testId="status-sync" compact={compact}>
<span style={ICON_STYLE}>
<SyncStatusIcon status={status} color={syncIconColor(status)} spinning={isSyncing} />
{compact ? null : formatSyncBadgeLabel(locale, status, lastSyncTime, selectedRepositoryLabel)}
{compact ? null : formatSyncLabel(locale, status, lastSyncTime)}
</span>
</StatusBarAction>
{showPopup && (