feat: show dynamic build number in status bar (bNNN format) (#163)

* feat: show dynamic build number in status bar (bNNN format)

Replace hardcoded v0.4.2 with a dynamic build number derived from
git rev-list --count HEAD at compile time. The count is embedded via
build.rs and exposed through a get_build_number Tauri command.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* design: add build-number-status-bar wireframes (status bar with dynamic b-number)

* fix: use runtime env var for BUILD_NUMBER (compile-time env! not available in CI)

* style: rustfmt format get_build_number

---------

Co-authored-by: Test <test@test.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Luca Rossi
2026-03-02 01:50:41 +01:00
committed by GitHub
parent 36a421d42a
commit 1a18de2340
9 changed files with 184 additions and 5 deletions

View File

@@ -25,9 +25,14 @@ describe('StatusBar', () => {
expect(screen.getByText('9,200 notes')).toBeInTheDocument()
})
it('displays version info', () => {
it('displays build number when provided', () => {
render(<StatusBar noteCount={100} vaultPath="/Users/luca/Laputa" vaults={vaults} onSwitchVault={vi.fn()} buildNumber="b223" />)
expect(screen.getByText('b223')).toBeInTheDocument()
})
it('displays fallback build number when not provided', () => {
render(<StatusBar noteCount={100} vaultPath="/Users/luca/Laputa" vaults={vaults} onSwitchVault={vi.fn()} />)
expect(screen.getByText('v0.4.2')).toBeInTheDocument()
expect(screen.getByText('b?')).toBeInTheDocument()
})
it('does not display branch name', () => {

View File

@@ -26,6 +26,7 @@ interface StatusBarProps {
onTriggerSync?: () => void
zoomLevel?: number
onZoomReset?: () => void
buildNumber?: string
}
function VaultMenuItem({ vault, isActive, onSelect }: { vault: VaultOption; isActive: boolean; onSelect: () => void }) {
@@ -155,7 +156,7 @@ function CommitBadge({ info }: { info: LastCommitInfo }) {
)
}
export function StatusBar({ noteCount, modifiedCount = 0, vaultPath, vaults, onSwitchVault, onOpenSettings, onOpenLocalFolder, onConnectGitHub, onClickPending, hasGitHub, syncStatus = 'idle', lastSyncTime = null, conflictCount = 0, lastCommitInfo, onTriggerSync, zoomLevel = 100, onZoomReset }: StatusBarProps) {
export function StatusBar({ noteCount, modifiedCount = 0, vaultPath, vaults, onSwitchVault, onOpenSettings, onOpenLocalFolder, onConnectGitHub, onClickPending, hasGitHub, syncStatus = 'idle', lastSyncTime = null, conflictCount = 0, lastCommitInfo, onTriggerSync, zoomLevel = 100, onZoomReset, buildNumber }: StatusBarProps) {
// Force re-render every 30s to keep relative time label fresh
const [, setTick] = useState(0)
useEffect(() => {
@@ -171,7 +172,7 @@ export function StatusBar({ noteCount, modifiedCount = 0, vaultPath, vaults, onS
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
<VaultMenu vaults={vaults} vaultPath={vaultPath} onSwitchVault={onSwitchVault} onOpenLocalFolder={onOpenLocalFolder} onConnectGitHub={onConnectGitHub} hasGitHub={hasGitHub} />
<span style={SEP_STYLE}>|</span>
<span style={ICON_STYLE}><Package size={13} />v0.4.2</span>
<span style={ICON_STYLE} data-testid="status-build-number"><Package size={13} />{buildNumber ?? 'b?'}</span>
<span style={SEP_STYLE}>|</span>
<span
role="button"