Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
albinagu committed Oct 21, 2024
1 parent c910dd7 commit 22f9810
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export const Constituency = ({
': ' +
constituencyLists.length}
</Text>
{constituencyLists?.length > 0 && (
{allowedToProcess && constituencyLists?.length > 0 && (
<CreateCollection collectionId={collection?.id} />
)}
</Box>
Expand Down Expand Up @@ -156,77 +156,80 @@ export const Constituency = ({
}}
tag={
!list.reviewed
? {
label: 'Cancel collection',
renderTag: () => (
<DialogPrompt
baseId="cancel_collection_dialog"
title={
formatMessage(m.cancelCollectionButton) +
' - ' +
list.area?.name
}
description={
candidatesListCount[list.candidate.id] === 1
? formatMessage(
m.cancelCollectionModalMessageLastList,
)
: formatMessage(
m.cancelCollectionModalMessage,
)
}
ariaLabel="delete"
disclosureElement={
<Tag outlined variant="red">
<Box display="flex" alignItems="center">
<Icon
icon="trash"
size="small"
type="outline"
/>
</Box>
</Tag>
}
onConfirm={() => {
removeList({
variables: {
input: {
listId: list.id,
},
},
})

if (
? allowedToProcess
? {
label: 'Cancel collection',
renderTag: () => (
<DialogPrompt
baseId="cancel_collection_dialog"
title={
formatMessage(m.cancelCollectionButton) +
' - ' +
list.area?.name
}
description={
candidatesListCount[list.candidate.id] === 1
) {
removeCandidate({
? formatMessage(
m.cancelCollectionModalMessageLastList,
)
: formatMessage(
m.cancelCollectionModalMessage,
)
}
ariaLabel="delete"
disclosureElement={
<Tag outlined variant="red">
<Box display="flex" alignItems="center">
<Icon
icon="trash"
size="small"
type="outline"
/>
</Box>
</Tag>
}
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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,18 @@ const List = ({ allowedToProcess }: { allowedToProcess: boolean }) => {
}
type={listStatus === ListStatus.Reviewed ? 'success' : undefined}
/>
<ActionExtendDeadline listId={list.id} endTime={list.endTime} />
<ActionExtendDeadline
listId={list.id}
endTime={list.endTime}
allowedToProcess={allowedToProcess}
/>
<Signees numberOfSignatures={list.numberOfSignatures ?? 0} />
<PaperSignees listId={list.id} />
<ActionReviewComplete listId={list.id} listStatus={listStatus} />
{allowedToProcess && (
<Box>
<PaperSignees listId={list.id} />
<ActionReviewComplete listId={list.id} listStatus={listStatus} />
</Box>
)}
</GridColumn>
</GridRow>
</GridContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ const ParliamentaryRoot = ({
backgroundColor="blue"
/>
</Box>
<DownloadReports
areas={collection.areas}
collectionId={collection?.id}
/>
{allowedToProcess && (
<DownloadReports
areas={collection.areas}
collectionId={collection?.id}
/>
)}
</Box>
{loading && (
<Box marginBottom={6}>
Expand Down Expand Up @@ -202,7 +204,7 @@ const ParliamentaryRoot = ({
/>
))}
</Stack>
<CompareLists collectionId={collection?.id} />
{allowedToProcess && <CompareLists collectionId={collection?.id} />}
</GridColumn>
</GridRow>
</GridContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,16 @@ const ActionExtendDeadline = ({
readOnly
value={format(new Date(endDate), 'dd.MM.yyyy HH:mm')}
/>
<Box marginLeft={3}>
<Button
icon="calendar"
iconType="outline"
variant="ghost"
onClick={() => setModalChangeDateIsOpen(true)}
></Button>
</Box>
{allowedToProcess && (
<Box marginLeft={3}>
<Button
icon="calendar"
iconType="outline"
variant="ghost"
onClick={() => setModalChangeDateIsOpen(true)}
></Button>
</Box>
)}
</Box>
<Modal
id="extendDeadline"
Expand Down

0 comments on commit 22f9810

Please sign in to comment.