From d573ab59a93832b36a573b5fa78eba34b1c65a48 Mon Sep 17 00:00:00 2001 From: Alexandre Brandizzi Date: Thu, 24 Sep 2026 23:03:23 -0300 Subject: [PATCH] refactor(vendor-portal): extract document row from VendorPortalDocuments The changed-file maintainability gate caps functions at 150 lines; VendorPortalDocuments reached 156. Move the per-document row into VendorPortalDocumentRow with no behavior change. --- .../v/_components/vendor-portal-documents.tsx | 105 +++++++++++------- 1 file changed, 66 insertions(+), 39 deletions(-) diff --git a/src/app/v/_components/vendor-portal-documents.tsx b/src/app/v/_components/vendor-portal-documents.tsx index 204d8092..5ebc1538 100644 --- a/src/app/v/_components/vendor-portal-documents.tsx +++ b/src/app/v/_components/vendor-portal-documents.tsx @@ -21,6 +21,64 @@ type VendorPortalDocumentsProps = { onChanged: () => Promise; }; +type VendorPortalDocumentRowProps = { + document: VendorPortalDocument; + locked: boolean; + uploading: boolean; + onDownload: () => void; + onReplace: () => void; +}; + +function VendorPortalDocumentRow({ + document, + locked, + uploading, + onDownload, + onReplace, +}: VendorPortalDocumentRowProps) { + return ( +
+
+ File + + {document.originalFileName} · v{document.version} + +
+
+ Security scan + {document.scanStatus} +
+
+ Review + {document.reviewStatus} +
+ {Boolean(document.rejectionReason) && ( + {document.rejectionReason} + )} +
+ + {!locked && ( + + )} +
+
+ ); +} + type UploadRequest = { file: File; replacementId?: number; @@ -112,45 +170,14 @@ export function VendorPortalDocuments({ )} {documents.map((document) => ( -
-
- File - - {document.originalFileName} · v{document.version} - -
-
- Security scan - {document.scanStatus} -
-
- Review - {document.reviewStatus} -
- {Boolean(document.rejectionReason) && ( - {document.rejectionReason} - )} -
- - {!locked && ( - - )} -
-
+ void vendorPortalApi.downloadDocument(token, dispatchId, document)} + onReplace={() => chooseFile(document.id)} + /> ))} {progress !== undefined && (