UI: Avoid duplicate Windows major version in machine OS label (e.g., 'Windows 11 Pro (26100)')

This commit is contained in:
codex-bot 2025-10-21 09:08:59 -03:00
parent 66bf0cd9e1
commit 904c2ef457
2 changed files with 48 additions and 5 deletions

View file

@ -952,9 +952,29 @@ export function AdminCompaniesManager({ initialCompanies }: { initialCompanies:
</Badge>
</div>
<div className="flex flex-wrap items-center gap-2 text-xs text-neutral-500">
<span>{machine.osName ?? "SO desconhecido"}</span>
{machine.osVersion ? <span className="text-neutral-400"></span> : null}
{machine.osVersion ? <span>{machine.osVersion}</span> : null}
{(() => {
const name = machine.osName ?? "SO desconhecido"
const ver = ((): string => {
const n = machine.osName ?? null
const v = machine.osVersion ?? null
if (!v) return ""
const m = (n ?? "").match(/^windows\s+(\d+)\b/i)
if (m) {
const major = m[1]
const re = new RegExp(`^\\s*${major}(?:\\b|\\.|-_|\\s)+(.*)$`, "i")
const mm = v.match(re)
if (mm) return (mm[1] ?? "").trim()
}
return v
})()
return (
<>
<span>{name}</span>
{ver ? <span className="text-neutral-400"></span> : null}
{ver ? <span>{ver}</span> : null}
</>
)
})()}
{machine.architecture ? (
<span className="rounded-full bg-white px-2 py-0.5 text-[11px] font-medium text-neutral-600 shadow-sm">
{machine.architecture.toUpperCase()}