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(portals-admin): tweaks lks vs þí #16484

Merged
merged 16 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 10 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
52 changes: 17 additions & 35 deletions libs/portals/admin/signature-collection/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const m = defineMessages({
description: '',
},
signatureListsTitlePresidential: {
id: 'admin-portal.signature-collection-parliamentary:signatureLists',
id: 'admin-portal.signature-collection:signatureListsTitlePresidential',
defaultMessage: 'Forsetakosningar',
description: '',
},
Expand Down Expand Up @@ -166,6 +166,22 @@ export const m = defineMessages({
defaultMessage: 'Forsetakosningar 2024',
description: '',
},
parliamentaryCollectionTitle: {
id: 'admin-portal.signature-collection:parliamentaryCollectionTitle',
defaultMessage: 'Alþingiskosningar',
description: '',
},
parliamentaryCollectionIntro: {
id: 'admin-portal.signature-collection:parliamentaryCollectionIntro',
defaultMessage: 'Hér er yfirlit yfir kjördæmin sex. Ýttu á viðeigandi kjördæmi til að sjá meðmælendalista í því kjördæmi.',
description: '',
},
parliamentaryConstituencyIntro: {
id: 'admin-portal.signature-collection:parliamentaryConstituencyIntro',
defaultMessage:
'Hér er yfirlit yfir allar meðmælasafnanir sem stofnaðar hafa verið í',
description: '',
},
viewList: {
id: 'admin-portal.signature-collection:viewList',
defaultMessage: 'Skoða söfnun',
Expand Down Expand Up @@ -713,40 +729,6 @@ export const m = defineMessages({
},
})

export const parliamentaryMessages = defineMessages({
signatureListsTitle: {
id: 'admin-portal.signature-collection-parliamentary:signatureLists',
defaultMessage: 'Alþingiskosningar',
description: '',
},
signatureListsDescription: {
id: 'admin-portal.signature-collection-parliamentary:signatureListsDescription',
defaultMessage: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
description: '',
},
signatureListsIntro: {
id: 'admin-portal.signature-collection-parliamentary:signatureListsIntro',
defaultMessage:
'Hér er yfirlit yfir kjördæmin sex. Ýttu á viðeigandi kjördæmi til að sjá meðmælendalista í því kjördæmi.',
description: '',
},
compareListsButton: {
id: 'admin-portal.signature-collection-parliamentary:compareListsButton',
defaultMessage: 'Bera saman',
description: '',
},
compareListsDescription: {
id: 'admin-portal.signature-collection-parliamentary:compareListsDescription',
defaultMessage: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
description: '',
},
singleConstituencyIntro: {
id: 'admin-portal.signature-collection-parliamentary:singleConstituencyIntro',
defaultMessage:
'Hér er yfirlit yfir allar meðmælasafnanir sem stofnaðar hafa verið í',
description: '',
},
})

export const createCollectionErrorMessages = defineMessages({
age: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PortalNavigationItem } from '@island.is/portals/core'
import { SignatureCollectionPaths } from './paths'
import { m, parliamentaryMessages } from './messages'
import { m } from './messages'

export const signatureCollectionNavigation: PortalNavigationItem = {
name: m.signatureListsTitle,
Expand All @@ -11,7 +11,7 @@ export const signatureCollectionNavigation: PortalNavigationItem = {
path: SignatureCollectionPaths.ParliamentaryRoot,
children: [
{
name: parliamentaryMessages.signatureListsTitle,
name: m.parliamentaryCollectionTitle,
path: SignatureCollectionPaths.ParliamentaryRoot,
activeIfExact: true,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IntroHeader, PortalNavigation } from '@island.is/portals/core'
import { signatureCollectionNavigation } from '../../lib/navigation'
import { useLocale } from '@island.is/localization'
import { m, parliamentaryMessages } from '../../lib/messages'
import { m } from '../../lib/messages'
import {
ActionCard,
Box,
Expand Down Expand Up @@ -91,7 +91,7 @@ export const Constituency = ({
items={[
{
title: formatMessage(
parliamentaryMessages.signatureListsTitle,
m.parliamentaryCollectionTitle,
),
href: `/stjornbord${SignatureCollectionPaths.ParliamentaryRoot}`,
},
Expand All @@ -104,7 +104,7 @@ export const Constituency = ({
<IntroHeader
title={constituencyName}
intro={
formatMessage(parliamentaryMessages.singleConstituencyIntro) +
formatMessage(m.parliamentaryConstituencyIntro) +
' ' +
constituencyName
}
Expand All @@ -127,7 +127,7 @@ export const Constituency = ({
': ' +
constituencyLists.length}
</Text>
{constituencyLists?.length > 0 && (
{allowedToProcess && constituencyLists?.length > 0 && (
<CreateCollection collectionId={collection?.id} />
)}
</Box>
Expand All @@ -142,97 +142,96 @@ export const Constituency = ({
maxProgress: list.area.min,
withLabel: true,
}}
cta={
(allowedToProcess && !list.active) || !allowedToProcess
? {
label: formatMessage(m.viewList),
variant: 'text',
onClick: () => {
navigate(
SignatureCollectionPaths.ParliamentaryConstituencyList.replace(
':constituencyName',
constituencyName,
).replace(':listId', list.id),
)
},
}
: undefined
}
cta={{
label: formatMessage(m.viewList),
variant: 'text',
onClick: () => {
navigate(
SignatureCollectionPaths.ParliamentaryConstituencyList.replace(
':constituencyName',
constituencyName,
).replace(':listId', list.id),
)
},
}}
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,
label: formatMessage(m.confirmListReviewed),
variant: 'mint',
outlined: false,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,23 @@ const List = ({ allowedToProcess }: { allowedToProcess: boolean }) => {
}
type={listStatus === ListStatus.Reviewed ? 'success' : undefined}
/>
<ActionExtendDeadline listId={list.id} endTime={list.endTime} />
<Signees numberOfSignatures={list.numberOfSignatures ?? 0} />
<PaperSignees listId={list.id} />
<ActionReviewComplete listId={list.id} listStatus={listStatus} />
<ActionExtendDeadline
listId={list.id}
endTime={list.endTime}
allowedToProcess={
allowedToProcess && listStatus === ListStatus.Extendable
}
/>
{(allowedToProcess && !list.active) ||
(!allowedToProcess && (
<Signees numberOfSignatures={list.numberOfSignatures ?? 0} />
))}
{allowedToProcess && (
<Box>
{!list.active && <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 @@ -13,7 +13,7 @@ import {
import { useLocale } from '@island.is/localization'
import { IntroHeader, PortalNavigation } from '@island.is/portals/core'
import { signatureCollectionNavigation } from '../lib/navigation'
import { m, parliamentaryMessages } from '../lib/messages'
import { m } from '../lib/messages'
import { useLoaderData, useNavigate } from 'react-router-dom'
import { SignatureCollectionPaths } from '../lib/paths'
import CompareLists from '../shared-components/compareLists'
Expand Down Expand Up @@ -69,15 +69,15 @@ const ParliamentaryRoot = ({
items={[
{
title: formatMessage(
parliamentaryMessages.signatureListsTitle,
m.parliamentaryCollectionTitle,
),
},
]}
/>
</Box>
<IntroHeader
title={formatMessage(parliamentaryMessages.signatureListsTitle)}
intro={formatMessage(parliamentaryMessages.signatureListsIntro)}
title={formatMessage(m.parliamentaryCollectionTitle)}
intro={formatMessage(m.parliamentaryCollectionIntro)}
imgPosition="right"
imgHiddenBelow="sm"
img={
Expand All @@ -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 @@ -265,7 +265,7 @@ const Lists = ({ allowedToProcess }: { allowedToProcess: boolean }) => {
tag={
list.reviewed
? {
label: m.confirmListReviewed.defaultMessage,
label: formatMessage(m.confirmListReviewed),
variant: 'mint',
outlined: false,
}
Expand Down
Loading
Loading