From 5f14e112838d1d88127ba8dafa597cee37dd8c3d Mon Sep 17 00:00:00 2001 From: Pierre Bastianelli Date: Thu, 11 Jul 2024 17:26:37 -0700 Subject: [PATCH] fix: don't show archived attachments on the project attachment list --- .../Form/ProjectAttachmentsFormSummary.tsx | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/app/components/Form/ProjectAttachmentsFormSummary.tsx b/app/components/Form/ProjectAttachmentsFormSummary.tsx index 35c0b9cec7..02885f7fa6 100644 --- a/app/components/Form/ProjectAttachmentsFormSummary.tsx +++ b/app/components/Form/ProjectAttachmentsFormSummary.tsx @@ -6,8 +6,8 @@ import { ProjectAttachmentsFormSummary_projectRevision$key } from "__generated__ import { FormNotAddedOrUpdated } from "./SummaryFormCommonComponents"; import { useEffect, useMemo } from "react"; -const tableFilters = [ - new TextFilter("Operation", "operation"), +const operationTableFilter = new TextFilter("Operation", "operation"); +const mainTableFilters = [ new TextFilter("File Name", "fileName"), new TextFilter("Type", "type"), new TextFilter("Size", "size"), @@ -39,7 +39,6 @@ const ProjectAttachmentsFormSummary: React.FC = ({ formDataTableName: "project_attachment" ) @connection(key: "connection_summaryProjectAttachmentFormChanges") { __id - totalCount edges { node { id @@ -66,7 +65,7 @@ const ProjectAttachmentsFormSummary: React.FC = ({ // If we are showing the diff then we want to see archived records, otherwise filter out the archived contacts let attachmentFormChanges = revision.summaryProjectAttachmentFormChanges.edges; - if (!renderDiff) + if (!renderDiff || isOnAmendmentsAndOtherRevisionsPage) attachmentFormChanges = revision.summaryProjectAttachmentFormChanges.edges.filter( ({ node }) => node.operation !== "ARCHIVE" @@ -91,6 +90,10 @@ const ProjectAttachmentsFormSummary: React.FC = ({ if (isOnAmendmentsAndOtherRevisionsPage && projectAttachmentsFormNotUpdated) return null; + const tableFilters = isOnAmendmentsAndOtherRevisionsPage + ? [operationTableFilter, ...mainTableFilters] + : mainTableFilters; + return ( <> {!isOnAmendmentsAndOtherRevisionsPage &&

Project Attachments

} @@ -106,24 +109,22 @@ const ProjectAttachmentsFormSummary: React.FC = ({ ) : ( - {revision.summaryProjectAttachmentFormChanges.edges.map( - ({ node }) => ( - - ) - )} + {attachmentFormChanges.map(({ node }) => ( + + ))}
)}