fix(ui): показывать неизвестные поля сертификатов явно
This commit is contained in:
1 parent
bb74eae64c
commit
17f03e7af1
6 files changed
+101
-36
No files matched your search
@@ -0,0 +1,28 @@
|
||||
"use client"
|
||||
|
||||
import type { CertificateView } from "@/lib/certificate-view"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function daysLeftColor(days: number | null): string {
|
||||
if (days === null) return "text-muted-foreground"
|
||||
if (days <= 7) return "text-destructive"
|
||||
if (days <= 30) return "text-warning"
|
||||
return "text-success"
|
||||
}
|
||||
|
||||
export function CertDaysCell({ cert }: { cert: CertificateView }) {
|
||||
return (
|
||||
<div className="flex flex-wrap items-center justify-between gap-1 text-xs">
|
||||
<span className={cn("font-mono font-medium", daysLeftColor(cert.daysLeft))}>
|
||||
{cert.daysLeft === null
|
||||
? "Срок неизвестен"
|
||||
: cert.daysLeft < 0
|
||||
? "Истёк " + -cert.daysLeft + "д назад"
|
||||
: cert.daysLeft + "д осталось"}
|
||||
</span>
|
||||
<span className="text-muted-foreground text-[10px] break-all">
|
||||
{cert.validUntil ?? "Дата окончания неизвестна"}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user