feat: git status bar — show last commit link, remove branch name (#92)
* feat: show last commit hash in status bar, remove branch name Replace the hardcoded "main" branch display with a clickable short SHA linking to the GitHub commit. Add Rust get_last_commit_info command that returns the last commit hash and constructs a GitHub URL from the remote. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: add design/git-status-bar.pen with new status bar layout Shows the updated status bar with commit hash link, no branch name, and annotated change callouts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: retrigger — runner 3 pnpm not found (env issue) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,10 +14,56 @@ describe('StatusBar', () => {
|
||||
expect(screen.getByText('9,200 notes')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('displays version and branch info', () => {
|
||||
it('displays version info', () => {
|
||||
render(<StatusBar noteCount={100} vaultPath="/Users/luca/Laputa" vaults={vaults} onSwitchVault={vi.fn()} />)
|
||||
expect(screen.getByText('v0.4.2')).toBeInTheDocument()
|
||||
expect(screen.getByText('main')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('does not display branch name', () => {
|
||||
render(<StatusBar noteCount={100} vaultPath="/Users/luca/Laputa" vaults={vaults} onSwitchVault={vi.fn()} />)
|
||||
expect(screen.queryByText('main')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('shows clickable commit hash when commitUrl is available', () => {
|
||||
render(
|
||||
<StatusBar
|
||||
noteCount={100}
|
||||
vaultPath="/Users/luca/Laputa"
|
||||
vaults={vaults}
|
||||
onSwitchVault={vi.fn()}
|
||||
lastCommitInfo={{ shortHash: 'a3f9b1c', commitUrl: 'https://github.com/owner/repo/commit/abc123' }}
|
||||
/>
|
||||
)
|
||||
const link = screen.getByTestId('status-commit-link')
|
||||
expect(link).toBeInTheDocument()
|
||||
expect(link.tagName).toBe('A')
|
||||
expect(link).toHaveAttribute('href', 'https://github.com/owner/repo/commit/abc123')
|
||||
expect(link).toHaveAttribute('target', '_blank')
|
||||
expect(screen.getByText('a3f9b1c')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('shows non-clickable commit hash when no commitUrl', () => {
|
||||
render(
|
||||
<StatusBar
|
||||
noteCount={100}
|
||||
vaultPath="/Users/luca/Laputa"
|
||||
vaults={vaults}
|
||||
onSwitchVault={vi.fn()}
|
||||
lastCommitInfo={{ shortHash: 'b4e2d8f', commitUrl: null }}
|
||||
/>
|
||||
)
|
||||
const span = screen.getByTestId('status-commit-hash')
|
||||
expect(span).toBeInTheDocument()
|
||||
expect(span.tagName).toBe('SPAN')
|
||||
expect(screen.getByText('b4e2d8f')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('hides commit hash when lastCommitInfo is null', () => {
|
||||
render(
|
||||
<StatusBar noteCount={100} vaultPath="/Users/luca/Laputa" vaults={vaults} onSwitchVault={vi.fn()} lastCommitInfo={null} />
|
||||
)
|
||||
expect(screen.queryByTestId('status-commit-link')).not.toBeInTheDocument()
|
||||
expect(screen.queryByTestId('status-commit-hash')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('displays active vault name', () => {
|
||||
|
||||
Reference in New Issue
Block a user