fix(ui): убрать недостоверную шкалу срока сертификата
This commit is contained in:
1 parent
f99612f6aa
commit
bb74eae64c
3 files changed
+8
-38
No files matched your search
@@ -1,16 +1,9 @@
|
||||
"use client"
|
||||
|
||||
import type { CertificateDto } from "@mmapp/contracts/certificates"
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function daysLeftBar(days: number, total = 365): number {
|
||||
if (days <= 0) return 0
|
||||
return Math.min(100, Math.round((days / total) * 100))
|
||||
}
|
||||
|
||||
function CertificateExpandedDetail({ cert }: { cert: CertificateDto }) {
|
||||
const pct = daysLeftBar(cert.daysLeft)
|
||||
|
||||
return (
|
||||
<div className="px-10 pb-4 grid grid-cols-2 sm:grid-cols-4 gap-4 text-xs border-t border-border/50 pt-3">
|
||||
<div>
|
||||
@@ -39,23 +32,8 @@ function CertificateExpandedDetail({ cert }: { cert: CertificateDto }) {
|
||||
{cert.trusted ? "Да (доверенный)" : "Нет (не доверенный)"}
|
||||
</p>
|
||||
</div>
|
||||
<div className="col-span-2 sm:col-span-4">
|
||||
<div className="h-1.5 bg-muted rounded-full overflow-hidden max-w-xs">
|
||||
<div
|
||||
className={cn(
|
||||
"h-full rounded-full",
|
||||
cert.daysLeft < 0 || cert.daysLeft <= 7
|
||||
? "bg-red-500"
|
||||
: cert.daysLeft <= 30
|
||||
? "bg-amber-500"
|
||||
: "bg-emerald-500",
|
||||
)}
|
||||
style={{ width: `${pct}%` }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export { CertificateExpandedDetail, daysLeftBar }
|
||||
export { CertificateExpandedDetail }
|
||||
Reference in new issue
Block a user