From 48c61cc2e52722178f328506475a3520946c3316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D0=BE=D0=B2=20=D0=90=D1=80=D1=82?= =?UTF-8?q?=D0=B5=D0=BC?= Date: Tue, 21 Apr 2026 12:36:53 +0300 Subject: [PATCH] Enhance attachment display in ChangeEquipmentStatusList - Added a new component, StatusChangeAttachmentLink, to render file attachments in the ChangeEquipmentStatusList. - Updated the rendering logic to display up to three attachment links with a count of additional attachments if more than three exist. - Improved the overall user interface for better visibility of file attachments related to equipment status changes. --- .../ChangeEquipmentStatusList.tsx | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/client/src/resources/change-equipment-status/ChangeEquipmentStatusList.tsx b/client/src/resources/change-equipment-status/ChangeEquipmentStatusList.tsx index 892971a..7264630 100644 --- a/client/src/resources/change-equipment-status/ChangeEquipmentStatusList.tsx +++ b/client/src/resources/change-equipment-status/ChangeEquipmentStatusList.tsx @@ -13,6 +13,7 @@ import { TopToolbar, } from 'react-admin'; import { equipmentStatusChoices } from '../equipment/shared'; +import { StatusChangeAttachmentLink } from './StatusChangeAttachmentLink'; const statusFilters = [ , @@ -41,9 +42,31 @@ export function ChangeEquipmentStatusList() { { - const count = Array.isArray(record.attachments) ? record.attachments.length : 0; - return count ? String(count) : '—'; + render={(record: { + id: string; + attachments?: { id: string; originalFileName?: string | null }[] | null; + }) => { + const items = Array.isArray(record.attachments) ? record.attachments : []; + if (!items.length) { + return '—'; + } + + return ( +
+ {items.slice(0, 3).map((att) => ( +
+ +
+ ))} + {items.length > 3 ? ( + {`+ ещё ${items.length - 3}`} + ) : null} +
+ ); }} />