Skip to content

Commit a43e595

Browse files
committed
fix(ui): show a human-friendly version in the auth footer
The footer rendered raw `git describe` output (e.g. "v0.1.0-beta.1-7-ge49ba2e") on any build past a tag — the -<commits>-g<sha> tail looks broken to users. Add formatVersion() to collapse it to "<tag> (<sha>)", so the footer reads "v0.1.0-beta.1 (e49ba2e)". Settings keeps the full precise string for support. https://claude.ai/code/session_01EeGweBeouxSsT6nSaXy8Pk
1 parent e49ba2e commit a43e595

4 files changed

Lines changed: 33 additions & 2 deletions

File tree

web/src/pages/Login.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { AlertCircle, Zap, Dumbbell, Apple, TrendingUp, LogIn } from 'lucide-rea
44
import { useAuthStore } from '../stores/auth'
55
import { apiErrorMessage } from '../services/api'
66
import { useServerInfo } from '../hooks/useServerInfo'
7+
import { formatVersion } from '../utils/version'
78
import Logo from '../components/Logo'
89
import ServerSettings from '../components/ServerSettings'
910

@@ -95,7 +96,7 @@ export default function Login() {
9596

9697
{/* Footer */}
9798
<div className="relative text-tx-muted text-xs">
98-
© lyftr{serverInfo ? ` · ${serverInfo.version}` : ''}
99+
© lyftr{serverInfo ? ` · ${formatVersion(serverInfo.version)}` : ''}
99100
</div>
100101
</div>
101102

web/src/pages/Register.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { AlertCircle, Dumbbell, Apple, TrendingUp, UserPlus } from 'lucide-react
44
import { useAuthStore } from '../stores/auth'
55
import { apiErrorMessage } from '../services/api'
66
import { useServerInfo } from '../hooks/useServerInfo'
7+
import { formatVersion } from '../utils/version'
78
import Logo from '../components/Logo'
89
import ServerSettings from '../components/ServerSettings'
910

@@ -86,7 +87,7 @@ export default function Register() {
8687

8788
{/* Footer */}
8889
<div className="relative text-tx-muted text-xs">
89-
© lyftr{serverInfo ? ` · ${serverInfo.version}` : ''}
90+
© lyftr{serverInfo ? ` · ${formatVersion(serverInfo.version)}` : ''}
9091
</div>
9192
</div>
9293

web/src/utils/version.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { describe, it, expect } from 'vitest'
2+
import { formatVersion } from './version'
3+
4+
describe('formatVersion', () => {
5+
it('collapses a git-describe ahead-of-tag string to tag + short commit', () => {
6+
expect(formatVersion('v0.1.0-beta.1-7-ge49ba2e')).toBe('v0.1.0-beta.1 (e49ba2e)')
7+
expect(formatVersion('v1.2.3-2-gabc1234')).toBe('v1.2.3 (abc1234)')
8+
})
9+
10+
it('leaves an exact tag unchanged', () => {
11+
expect(formatVersion('v0.1.0-beta.1')).toBe('v0.1.0-beta.1')
12+
expect(formatVersion('v1.2.3')).toBe('v1.2.3')
13+
})
14+
15+
it('leaves a bare commit SHA or dev string unchanged', () => {
16+
expect(formatVersion('e49ba2e')).toBe('e49ba2e')
17+
expect(formatVersion('dev')).toBe('dev')
18+
})
19+
})

web/src/utils/version.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* `git describe` emits "<tag>-<commits>-g<sha>" for commits past the latest tag
3+
* (e.g. on :latest/main builds). Collapse that tooling output to a human-friendly
4+
* "<tag> (<sha>)" for display. Exact tags ("v0.1.0-beta.1") and bare commit SHAs
5+
* pass through unchanged.
6+
*/
7+
export const formatVersion = (raw: string): string => {
8+
const m = raw.match(/^(.+)-\d+-g([0-9a-f]+)$/)
9+
return m ? `${m[1]} (${m[2]})` : raw
10+
}

0 commit comments

Comments
 (0)