Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(admin): sc - lista læst tag #16494

Merged
merged 6 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libs/portals/admin/signature-collection/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,11 @@ export const m = defineMessages({
defaultMessage: 'Læsa söfnun',
description: '',
},
listLocked: {
id: 'admin-portal.signature-collection:listLocked',
defaultMessage: 'Lista læst',
description: '',
},
lockListDescription: {
id: 'admin-portal.signature-collection:lockListDescription',
defaultMessage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,86 +153,91 @@ export const Constituency = ({
},
}}
tag={
!list.reviewed
? allowedToProcess
? {
label: 'Cancel collection',
renderTag: () => (
<DialogPrompt
baseId="cancel_collection_dialog"
title={
formatMessage(m.cancelCollectionButton) +
' - ' +
list.area?.name
}
description={
allowedToProcess && list.active
? {
label: 'Cancel collection',
albinagu marked this conversation as resolved.
Show resolved Hide resolved
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 (
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({
) {
removeCandidate({
variables: {
input: {
listId: list.id,
candidateId: list.candidate.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,
)
}
albinagu marked this conversation as resolved.
Show resolved Hide resolved
buttonPropsConfirm={{
variant: 'primary',
colorScheme: 'destructive',
}}
buttonTextCancel={formatMessage(
m.cancelCollectionModalCancelButton,
)}
/>
),
}
: undefined
: {
}}
buttonTextConfirm={
candidatesListCount[list.candidate.id] === 1
? formatMessage(
m.cancelCollectionAndCandidateModalConfirmButton,
)
: formatMessage(
m.cancelCollectionModalConfirmButton,
)
}
buttonPropsConfirm={{
variant: 'primary',
colorScheme: 'destructive',
}}
buttonTextCancel={formatMessage(
m.cancelCollectionModalCancelButton,
)}
/>
),
}
: !list.active && !list.reviewed
? {
label: formatMessage(m.listLocked),
variant: 'blueberry',
outlined: false,
}
: !list.active && list.reviewed
? {
label: formatMessage(m.confirmListReviewed),
variant: 'mint',
outlined: false,
}
: undefined
albinagu marked this conversation as resolved.
Show resolved Hide resolved
}
/>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,12 @@ const List = ({ allowedToProcess }: { allowedToProcess: boolean }) => {
<ActionExtendDeadline
listId={list.id}
endTime={list.endTime}
allowedToProcess={
allowedToProcess && listStatus === ListStatus.Extendable
}
allowedToProcess={allowedToProcess}
/>
{(allowedToProcess && !list.active) ||
(!allowedToProcess && (
{(allowedToProcess && !list.active ||
!allowedToProcess) && (
<Signees numberOfSignatures={list.numberOfSignatures ?? 0} />
))}
)}
{allowedToProcess && (
<Box>
{!list.active && <PaperSignees listId={list.id} />}
Expand Down
Loading