This commit is contained in:
2026-05-09 14:32:25 +03:00
parent f43314b122
commit f3a0750891
4 changed files with 13 additions and 7 deletions

View File

@@ -45,11 +45,18 @@ export const useVersionStore = defineStore('version', () => {
// Полная строка версии: "Версия: 1.2.3 (build abc1234 от 2025-04-03)"
// Принимает функцию перевода для слова "от"/"from"
const getFormattedVersion = (t: (key: string) => string) => {
if (!version.value) return t('common.version') + ': ...'
if (!version.value) return t('common.version') + '...'
const { version: ver, commitHash } = version.value
const datePart = buildDateFormatted.value ? ` ${t('common.versionFrom')} ${buildDateFormatted.value}` : ''
return `${t('common.version')}: ${ver} (build ${commitHash}${datePart})`
}
return { version, loading, error, fetchVersion, buildDateFormatted, getFormattedVersion }
const getShortVersion = () => {
if (!version.value) return '...'
const { version: ver, commitHash } = version.value
const datePart = buildDateFormatted.value ? ` ${buildDateFormatted.value}` : ''
return `${ver} (build ${commitHash}${datePart})`
}
return { version, loading, error, fetchVersion, buildDateFormatted, getFormattedVersion, getShortVersion }
})