From 22f98105e9184ae4e25f58cb3c57983ee5fd908a Mon Sep 17 00:00:00 2001 From: albina Date: Mon, 21 Oct 2024 10:35:25 +0000 Subject: [PATCH] tweaks --- .../Constituency/index.tsx | 133 +++++++++--------- .../src/screens-parliamentary/List/index.tsx | 14 +- .../src/screens-parliamentary/index.tsx | 12 +- .../extendDeadline/index.tsx | 18 +-- 4 files changed, 96 insertions(+), 81 deletions(-) diff --git a/libs/portals/admin/signature-collection/src/screens-parliamentary/Constituency/index.tsx b/libs/portals/admin/signature-collection/src/screens-parliamentary/Constituency/index.tsx index 0f5fd355a24b..c9b9ca3f7062 100644 --- a/libs/portals/admin/signature-collection/src/screens-parliamentary/Constituency/index.tsx +++ b/libs/portals/admin/signature-collection/src/screens-parliamentary/Constituency/index.tsx @@ -127,7 +127,7 @@ export const Constituency = ({ ': ' + constituencyLists.length} - {constituencyLists?.length > 0 && ( + {allowedToProcess && constituencyLists?.length > 0 && ( )} @@ -156,77 +156,80 @@ export const Constituency = ({ }} tag={ !list.reviewed - ? { - label: 'Cancel collection', - renderTag: () => ( - - - - - - } - onConfirm={() => { - removeList({ - variables: { - input: { - listId: list.id, - }, - }, - }) - - if ( + ? allowedToProcess + ? { + label: 'Cancel collection', + renderTag: () => ( + + + + + + } + onConfirm={() => { + removeList({ variables: { input: { - candidateId: list.candidate.id, + listId: list.id, }, }, }) + + if ( + candidatesListCount[list.candidate.id] === + 1 + ) { + removeCandidate({ + variables: { + input: { + candidateId: list.candidate.id, + }, + }, + }) + } + }} + buttonTextConfirm={ + candidatesListCount[list.candidate.id] === 1 + ? formatMessage( + m.cancelCollectionAndCandidateModalConfirmButton, + ) + : formatMessage( + m.cancelCollectionModalConfirmButton, + ) } - }} - buttonTextConfirm={ - candidatesListCount[list.candidate.id] === 1 - ? formatMessage( - m.cancelCollectionAndCandidateModalConfirmButton, - ) - : formatMessage( - m.cancelCollectionModalConfirmButton, - ) - } - buttonPropsConfirm={{ - variant: 'primary', - colorScheme: 'destructive', - }} - buttonTextCancel={formatMessage( - m.cancelCollectionModalCancelButton, - )} - /> - ), - } + buttonPropsConfirm={{ + variant: 'primary', + colorScheme: 'destructive', + }} + buttonTextCancel={formatMessage( + m.cancelCollectionModalCancelButton, + )} + /> + ), + } + : undefined : { label: m.confirmListReviewed.defaultMessage, variant: 'mint', diff --git a/libs/portals/admin/signature-collection/src/screens-parliamentary/List/index.tsx b/libs/portals/admin/signature-collection/src/screens-parliamentary/List/index.tsx index b342542ddc29..adb2eeb15c88 100644 --- a/libs/portals/admin/signature-collection/src/screens-parliamentary/List/index.tsx +++ b/libs/portals/admin/signature-collection/src/screens-parliamentary/List/index.tsx @@ -91,10 +91,18 @@ const List = ({ allowedToProcess }: { allowedToProcess: boolean }) => { } type={listStatus === ListStatus.Reviewed ? 'success' : undefined} /> - + - - + {allowedToProcess && ( + + + + + )} diff --git a/libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx b/libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx index 3a0b0b940abf..cc6f244a3984 100644 --- a/libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx +++ b/libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx @@ -101,10 +101,12 @@ const ParliamentaryRoot = ({ backgroundColor="blue" /> - + {allowedToProcess && ( + + )} {loading && ( @@ -202,7 +204,7 @@ const ParliamentaryRoot = ({ /> ))} - + {allowedToProcess && } diff --git a/libs/portals/admin/signature-collection/src/shared-components/extendDeadline/index.tsx b/libs/portals/admin/signature-collection/src/shared-components/extendDeadline/index.tsx index c37ee13b4141..871f82f9f927 100644 --- a/libs/portals/admin/signature-collection/src/shared-components/extendDeadline/index.tsx +++ b/libs/portals/admin/signature-collection/src/shared-components/extendDeadline/index.tsx @@ -63,14 +63,16 @@ const ActionExtendDeadline = ({ readOnly value={format(new Date(endDate), 'dd.MM.yyyy HH:mm')} /> - - - + {allowedToProcess && ( + + + + )}