fix(ui): убрать недостоверную шкалу срока сертификата

This commit is contained in:
Denozordec committed 2026-10-01 13:28:19 +07:00
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 }
@@ -20,7 +20,6 @@ import {
import { DataGridSortHeader } from "@/components/data-grids/shared/data-grid-sort-header"
import {
CertificateExpandedDetail,
daysLeftBar,
} from "@/components/data-grids/certificate-expanded-detail"
import { EmptyState } from "@/components/empty-state"
import {
@@ -65,7 +64,6 @@ function daysLeftColor(days: number): string {
}
function CertDaysCell({ cert }: { cert: CertificateDto }) {
const pct = daysLeftBar(cert.daysLeft)
return (
<>
<div className="flex items-center justify-between text-xs mb-1">
@@ -74,19 +72,6 @@ function CertDaysCell({ cert }: { cert: CertificateDto }) {
</span>
<span className="text-muted-foreground text-[10px]">{cert.validUntil}</span>
</div>
<div className="h-1.5 bg-muted rounded-full overflow-hidden">
<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>
</>
)
}
+7
View File
@@ -36,6 +36,13 @@
## Блок 11А.16.1 — достоверное отображение срока сертификата (2026-10-01)
- Удалены декоративные шкалы из таблицы и раскрытых деталей сертификата: они делили оставшиеся дни на выдуманный общий срок 365 дней. Сертификаты могут иметь другую продолжительность, поэтому процент не был достоверным.
- Дата окончания и текст оставшихся дней в таблице сохранены. Удалён неиспользуемый daysLeftBar; API, операции и ReUI vendor не изменены.
- TypeScript, профильный ESLint и diff check прошли. Это небольшой подготовительный блок, а не приёмка сертификатов; legacy неизвестные значения исправляются при подключении observed state.
- Следующий шаг остаётся 11А.17: миграция страницы, таблицы и деталей на новый state reader, nullable поля, частичные ошибки и свежесть. На начало блока использовано 98% пятичасовой квоты; большую миграцию не начинали.
## Блок 11А.16 — изоляция setup ошибок устройств (2026-10-01)
- В обоих новых state каталогах создание клиента/reader перенесено внутрь защищённого чтения устройства. Setup исключение одного клиента становится его error/partial, остальные строки остаются доступны; общий каталог не срывается.