archy/neode-ui/src/utils/version.ts
archipelago 87769cbfbf feat(ui): dual-ecash wallet settings, buy-peer-files, seed backup, assorted fixes
- Tabbed Wallet Settings modal (Cashu + Fedimint) and dual-balance wallet card
- Buy a peer's paid file (ecash / node Lightning / on-chain / external QR)
- Recovery-phrase reveal + backup section; onboarding seed retry resilience
- NetBird HTTPS launch, remote-control two-finger scroll + external-open
- Shared BackButton, single-v version label, mesh Bitcoin header toggles

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 19:21:42 -04:00

23 lines
847 B
TypeScript

/**
* Format a version string for display with exactly one leading "v".
*
* Version strings reach the UI from several sources — manifests (bare like
* "1.7.96"), node/federation state and the update RPC (sometimes already
* "v1.7.96"). Templates used to hard-code a `v` prefix (`v{{ version }}`),
* which produced "vv1.7.96" whenever the source already carried a "v". This
* normalizes both shapes to a single "v".
*/
export function displayVersion(v?: string | null): string {
if (v === null || v === undefined) return ''
const bare = String(v).trim().replace(/^v+/i, '')
return bare ? `v${bare}` : ''
}
// Exposed globally as `$ver` (see main.ts) so templates can normalize version
// labels without a per-file import.
declare module 'vue' {
interface ComponentCustomProperties {
$ver: (v?: string | null) => string
}
}