From 2bd935335ad0cece1246aedc538a66bd46d6227f Mon Sep 17 00:00:00 2001 From: albinagu <47886428+albinagu@users.noreply.github.com> Date: Tue, 24 Sep 2024 15:33:52 +0000 Subject: [PATCH] feat(portals-admin): Set up for Parliamentary Lists (#15892) * feat(portals-admin): Set up for Parliamentary Lists * chore: nx format:write update dirty files * initial page / component setup * linting fix * updates * bera saman description * cleanup * restructure * loaders restructure * addressing coderabbit * tweak * cr * folder rename * lists title * cr * chore: nx format:write update dirty files * tweaks --------- Co-authored-by: andes-it Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- .../signature-collection/src/lib/messages.ts | 54 ++++++++- .../src/lib/navigation.ts | 13 ++- .../signature-collection/src/lib/paths.ts | 10 +- .../AllLists => loaders}/AllLists.loader.ts | 14 +-- .../{screens/List => loaders}/List.loader.ts | 22 ++-- .../getAllSignatureLists.graphql | 0 .../getCollectionStatus.graphql | 0 .../listGraphql}/getListSignees.graphql | 0 .../listGraphql}/getListStatus.graphql | 0 .../listGraphql}/getSignatureList.graphql | 0 .../admin/signature-collection/src/module.tsx | 41 ++++++- .../Constituency/index.tsx | 108 ++++++++++++++++++ .../src/screens-parliamentary/List/index.tsx | 50 ++++++++ .../src/screens-parliamentary/index.tsx | 89 +++++++++++++++ .../finishCollectionProcess.graphql | 0 .../completeCollectionProcessing/index.tsx | 0 .../components/reviewCandidates/index.tsx | 0 .../reviewCandidates/removeCandidate.graphql | 0 .../AllLists/index.tsx | 18 +-- .../List/components/listInfoAlert/index.tsx | 0 .../List/components/paperUpload/index.tsx | 0 .../paperUpload/paperUpload.graphql | 0 .../List/components/skeleton.tsx | 0 .../List/index.tsx | 6 +- .../compareLists/compareLists.graphql | 0 .../compareLists/index.tsx | 16 +-- .../removeSignatureFromList.graphql | 0 .../compareLists/skeleton.tsx | 0 .../completeReview/index.tsx | 12 +- .../completeReview/toggleListReview.graphql | 0 .../createCollection/candidateLookup.graphql | 0 .../createCollection/createCollection.graphql | 0 .../createCollection/index.tsx | 5 +- .../createCollection/utils.ts | 2 +- .../emptyState/EmptyImgSmall.tsx | 0 .../emptyState/index.tsx | 0 .../extendDeadline/extendDeadline.graphql | 0 .../extendDeadline/index.tsx | 4 +- .../signees/index.tsx} | 29 ++--- .../sortSignees/index.tsx | 2 +- 40 files changed, 412 insertions(+), 83 deletions(-) rename libs/portals/admin/signature-collection/src/{screens/AllLists => loaders}/AllLists.loader.ts (89%) rename libs/portals/admin/signature-collection/src/{screens/List => loaders}/List.loader.ts (85%) rename libs/portals/admin/signature-collection/src/{screens/AllLists/graphql => loaders/allListsGraphql}/getAllSignatureLists.graphql (100%) rename libs/portals/admin/signature-collection/src/{screens/AllLists/graphql => loaders/allListsGraphql}/getCollectionStatus.graphql (100%) rename libs/portals/admin/signature-collection/src/{screens/List/graphql => loaders/listGraphql}/getListSignees.graphql (100%) rename libs/portals/admin/signature-collection/src/{screens/List/graphql => loaders/listGraphql}/getListStatus.graphql (100%) rename libs/portals/admin/signature-collection/src/{screens/List/graphql => loaders/listGraphql}/getSignatureList.graphql (100%) create mode 100644 libs/portals/admin/signature-collection/src/screens-parliamentary/Constituency/index.tsx create mode 100644 libs/portals/admin/signature-collection/src/screens-parliamentary/List/index.tsx create mode 100644 libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx rename libs/portals/admin/signature-collection/src/{screens => screens-presidential}/AllLists/components/completeCollectionProcessing/finishCollectionProcess.graphql (100%) rename libs/portals/admin/signature-collection/src/{screens => screens-presidential}/AllLists/components/completeCollectionProcessing/index.tsx (100%) rename libs/portals/admin/signature-collection/src/{screens => screens-presidential}/AllLists/components/reviewCandidates/index.tsx (100%) rename libs/portals/admin/signature-collection/src/{screens => screens-presidential}/AllLists/components/reviewCandidates/removeCandidate.graphql (100%) rename libs/portals/admin/signature-collection/src/{screens => screens-presidential}/AllLists/index.tsx (95%) rename libs/portals/admin/signature-collection/src/{screens => screens-presidential}/List/components/listInfoAlert/index.tsx (100%) rename libs/portals/admin/signature-collection/src/{screens => screens-presidential}/List/components/paperUpload/index.tsx (100%) rename libs/portals/admin/signature-collection/src/{screens => screens-presidential}/List/components/paperUpload/paperUpload.graphql (100%) rename libs/portals/admin/signature-collection/src/{screens => screens-presidential}/List/components/skeleton.tsx (100%) rename libs/portals/admin/signature-collection/src/{screens => screens-presidential}/List/index.tsx (95%) rename libs/portals/admin/signature-collection/src/{screens/AllLists/components => shared-components}/compareLists/compareLists.graphql (100%) rename libs/portals/admin/signature-collection/src/{screens/AllLists/components => shared-components}/compareLists/index.tsx (93%) rename libs/portals/admin/signature-collection/src/{screens/AllLists/components => shared-components}/compareLists/removeSignatureFromList.graphql (100%) rename libs/portals/admin/signature-collection/src/{screens/AllLists/components => shared-components}/compareLists/skeleton.tsx (100%) rename libs/portals/admin/signature-collection/src/{screens/List/components => shared-components}/completeReview/index.tsx (92%) rename libs/portals/admin/signature-collection/src/{screens/List/components => shared-components}/completeReview/toggleListReview.graphql (100%) rename libs/portals/admin/signature-collection/src/{screens/AllLists/components => shared-components}/createCollection/candidateLookup.graphql (100%) rename libs/portals/admin/signature-collection/src/{screens/AllLists/components => shared-components}/createCollection/createCollection.graphql (100%) rename libs/portals/admin/signature-collection/src/{screens/AllLists/components => shared-components}/createCollection/index.tsx (98%) rename libs/portals/admin/signature-collection/src/{screens/AllLists/components => shared-components}/createCollection/utils.ts (93%) rename libs/portals/admin/signature-collection/src/{screens/AllLists/components => shared-components}/emptyState/EmptyImgSmall.tsx (100%) rename libs/portals/admin/signature-collection/src/{screens/AllLists/components => shared-components}/emptyState/index.tsx (100%) rename libs/portals/admin/signature-collection/src/{screens/List/components => shared-components}/extendDeadline/extendDeadline.graphql (100%) rename libs/portals/admin/signature-collection/src/{screens/List/components => shared-components}/extendDeadline/index.tsx (97%) rename libs/portals/admin/signature-collection/src/{screens/List/components/signees.tsx => shared-components/signees/index.tsx} (88%) rename libs/portals/admin/signature-collection/src/{screens/List/components => shared-components}/sortSignees/index.tsx (96%) diff --git a/libs/portals/admin/signature-collection/src/lib/messages.ts b/libs/portals/admin/signature-collection/src/lib/messages.ts index 5f2efaaa5285..a74985c729d8 100644 --- a/libs/portals/admin/signature-collection/src/lib/messages.ts +++ b/libs/portals/admin/signature-collection/src/lib/messages.ts @@ -9,7 +9,12 @@ export const m = defineMessages({ }, signatureListsTitle: { id: 'admin-portal.signature-collection:signatureLists', - defaultMessage: 'Meðmælasafnanir', + defaultMessage: 'Forsetakosningar', + description: '', + }, + signatureListsConstituencyTitle: { + id: 'admin-portal.signature-collection:signatureListsConstituencyTitle', + defaultMessage: 'Kjördæmi', description: '', }, signatureListsDescription: { @@ -150,6 +155,11 @@ export const m = defineMessages({ defaultMessage: 'Skoða söfnun', description: '', }, + viewConstituency: { + id: 'admin-portal.signature-collection:viewConstituency', + defaultMessage: 'Skoða kjördæmi', + description: '', + }, noLists: { id: 'admin-portal.signature-collection:noLists', defaultMessage: 'Engin söfnun í gangi', @@ -417,7 +427,7 @@ export const m = defineMessages({ compareListsDescription: { id: 'admin-portal.signature-collection:compareListsDescription', defaultMessage: - 'Fulltrúar í yfirkjörstjórnum og frambjóðendur geta ekki mælt með framboði.', + 'Fulltrúar í yfirkjörstjórnum og frambjóðendur geta ekki mælt með framboði', description: '', }, compareListsModalDescription: { @@ -482,6 +492,46 @@ export const m = defineMessages({ }, }) +export const parliamentaryMessages = defineMessages({ + listTitle: { + id: 'admin-portal.signature-collection-parliamentary:listTitle', + defaultMessage: 'Alþingiskosningar', + description: '', + }, + 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: + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed etiam, ut inquit, in vita et in voluptate locum ponamus, isdem et in dolore et in odio.', + 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: { id: 'admin-portal.signature-collection:error.age', diff --git a/libs/portals/admin/signature-collection/src/lib/navigation.ts b/libs/portals/admin/signature-collection/src/lib/navigation.ts index 3fd05cb1b1c7..62626e9198c8 100644 --- a/libs/portals/admin/signature-collection/src/lib/navigation.ts +++ b/libs/portals/admin/signature-collection/src/lib/navigation.ts @@ -1,18 +1,23 @@ import { PortalNavigationItem } from '@island.is/portals/core' import { SignatureCollectionPaths } from './paths' -import { m } from './messages' +import { m, parliamentaryMessages } from './messages' export const signatureCollectionNavigation: PortalNavigationItem = { name: m.signatureListsTitle, icon: { - icon: 'settings', + icon: 'receipt', }, description: m.signatureListsDescription, - path: SignatureCollectionPaths.SignatureLists, + path: SignatureCollectionPaths.ParliamentaryRoot, children: [ + { + name: parliamentaryMessages.listTitle, + path: SignatureCollectionPaths.ParliamentaryRoot, + activeIfExact: true, + }, { name: m.collectionTitle, - path: SignatureCollectionPaths.SignatureLists, + path: SignatureCollectionPaths.PresidentialLists, activeIfExact: true, }, ], diff --git a/libs/portals/admin/signature-collection/src/lib/paths.ts b/libs/portals/admin/signature-collection/src/lib/paths.ts index de55e159b3e2..4627cffeaa4c 100644 --- a/libs/portals/admin/signature-collection/src/lib/paths.ts +++ b/libs/portals/admin/signature-collection/src/lib/paths.ts @@ -1,4 +1,10 @@ export enum SignatureCollectionPaths { - SignatureLists = '/medmaelasofnun', - SignatureList = '/medmaelasofnun/:id', + // Presidential + PresidentialLists = '/medmaelasofnun', + PresidentialList = '/medmaelasofnun/:listId', + + // Parliamentary + ParliamentaryRoot = '/althingiskosningar', + ParliamentaryConstituency = '/althingiskosningar/:constituencyName', + ParliamentaryConstituencyList = '/althingiskosningar/:constituencyName/:listId', } diff --git a/libs/portals/admin/signature-collection/src/screens/AllLists/AllLists.loader.ts b/libs/portals/admin/signature-collection/src/loaders/AllLists.loader.ts similarity index 89% rename from libs/portals/admin/signature-collection/src/screens/AllLists/AllLists.loader.ts rename to libs/portals/admin/signature-collection/src/loaders/AllLists.loader.ts index ce93146aa674..9b123c9a44f2 100644 --- a/libs/portals/admin/signature-collection/src/screens/AllLists/AllLists.loader.ts +++ b/libs/portals/admin/signature-collection/src/loaders/AllLists.loader.ts @@ -1,8 +1,4 @@ import type { WrappedLoaderFn } from '@island.is/portals/core' -import { - AllListsDocument, - AllListsQuery, -} from './graphql/getAllSignatureLists.generated' import { SignatureCollection, SignatureCollectionList, @@ -10,7 +6,11 @@ import { import { CollectionDocument, CollectionQuery, -} from './graphql/getCollectionStatus.generated' +} from './allListsGraphql/getCollectionStatus.generated' +import { + AllListsDocument, + AllListsQuery, +} from './allListsGraphql/getAllSignatureLists.generated' export interface ListsLoaderReturn { allLists: SignatureCollectionList[] @@ -19,9 +19,7 @@ export interface ListsLoaderReturn { } export const listsLoader: WrappedLoaderFn = ({ client }) => { - return async ({ - params, - }): Promise<{ + return async (): Promise<{ allLists: SignatureCollectionList[] collectionStatus: string collection: SignatureCollection diff --git a/libs/portals/admin/signature-collection/src/screens/List/List.loader.ts b/libs/portals/admin/signature-collection/src/loaders/List.loader.ts similarity index 85% rename from libs/portals/admin/signature-collection/src/screens/List/List.loader.ts rename to libs/portals/admin/signature-collection/src/loaders/List.loader.ts index 174eb769cc41..67ca3e477350 100644 --- a/libs/portals/admin/signature-collection/src/screens/List/List.loader.ts +++ b/libs/portals/admin/signature-collection/src/loaders/List.loader.ts @@ -1,20 +1,20 @@ import type { WrappedLoaderFn } from '@island.is/portals/core' -import { - ListbyidDocument, - ListbyidQuery, -} from './graphql/getSignatureList.generated' import { SignatureCollectionList, SignatureCollectionSignature, } from '@island.is/api/schema' import { - ListStatusDocument, - ListStatusQuery, -} from './graphql/getListStatus.generated' + ListbyidDocument, + ListbyidQuery, +} from './listGraphql/getSignatureList.generated' import { SignaturesDocument, SignaturesQuery, -} from './graphql/getListSignees.generated' +} from './listGraphql/getListSignees.generated' +import { + ListStatusDocument, + ListStatusQuery, +} from './listGraphql/getListStatus.generated' export const listLoader: WrappedLoaderFn = ({ client }) => { return async ({ @@ -29,7 +29,7 @@ export const listLoader: WrappedLoaderFn = ({ client }) => { fetchPolicy: 'network-only', variables: { input: { - listId: params.id, + listId: params.listId, }, }, }) @@ -39,7 +39,7 @@ export const listLoader: WrappedLoaderFn = ({ client }) => { fetchPolicy: 'network-only', variables: { input: { - listId: params.id, + listId: params.listId, }, }, }) @@ -49,7 +49,7 @@ export const listLoader: WrappedLoaderFn = ({ client }) => { fetchPolicy: 'network-only', variables: { input: { - listId: params.id, + listId: params.listId, }, }, }) diff --git a/libs/portals/admin/signature-collection/src/screens/AllLists/graphql/getAllSignatureLists.graphql b/libs/portals/admin/signature-collection/src/loaders/allListsGraphql/getAllSignatureLists.graphql similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/AllLists/graphql/getAllSignatureLists.graphql rename to libs/portals/admin/signature-collection/src/loaders/allListsGraphql/getAllSignatureLists.graphql diff --git a/libs/portals/admin/signature-collection/src/screens/AllLists/graphql/getCollectionStatus.graphql b/libs/portals/admin/signature-collection/src/loaders/allListsGraphql/getCollectionStatus.graphql similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/AllLists/graphql/getCollectionStatus.graphql rename to libs/portals/admin/signature-collection/src/loaders/allListsGraphql/getCollectionStatus.graphql diff --git a/libs/portals/admin/signature-collection/src/screens/List/graphql/getListSignees.graphql b/libs/portals/admin/signature-collection/src/loaders/listGraphql/getListSignees.graphql similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/List/graphql/getListSignees.graphql rename to libs/portals/admin/signature-collection/src/loaders/listGraphql/getListSignees.graphql diff --git a/libs/portals/admin/signature-collection/src/screens/List/graphql/getListStatus.graphql b/libs/portals/admin/signature-collection/src/loaders/listGraphql/getListStatus.graphql similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/List/graphql/getListStatus.graphql rename to libs/portals/admin/signature-collection/src/loaders/listGraphql/getListStatus.graphql diff --git a/libs/portals/admin/signature-collection/src/screens/List/graphql/getSignatureList.graphql b/libs/portals/admin/signature-collection/src/loaders/listGraphql/getSignatureList.graphql similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/List/graphql/getSignatureList.graphql rename to libs/portals/admin/signature-collection/src/loaders/listGraphql/getSignatureList.graphql diff --git a/libs/portals/admin/signature-collection/src/module.tsx b/libs/portals/admin/signature-collection/src/module.tsx index 7bd7a7a410b1..3bdd8fd55999 100644 --- a/libs/portals/admin/signature-collection/src/module.tsx +++ b/libs/portals/admin/signature-collection/src/module.tsx @@ -2,12 +2,20 @@ import { PortalModule } from '@island.is/portals/core' import { lazy } from 'react' import { m } from './lib/messages' import { SignatureCollectionPaths } from './lib/paths' -import { listsLoader } from './screens/AllLists/AllLists.loader' import { AdminPortalScope } from '@island.is/auth/scopes' -import { listLoader } from './screens/List/List.loader' +import { listsLoader } from './loaders/AllLists.loader' +import { listLoader } from './loaders/List.loader' -const AllLists = lazy(() => import('./screens/AllLists')) -const List = lazy(() => import('./screens/List')) +/* parliamentary */ +const ParliamentaryRoot = lazy(() => import('./screens-parliamentary')) +const ParliamentaryConstituency = lazy(() => + import('./screens-parliamentary/Constituency'), +) +const ParliamentaryList = lazy(() => import('./screens-parliamentary/List')) + +/* presidential */ +const AllLists = lazy(() => import('./screens-presidential/AllLists')) +const List = lazy(() => import('./screens-presidential/List')) const allowedScopes: string[] = [ AdminPortalScope.signatureCollectionManage, @@ -20,9 +28,30 @@ export const signatureCollectionModule: PortalModule = { enabled: ({ userInfo }) => userInfo.scopes.some((scope) => allowedScopes.includes(scope)), routes: (props) => [ + /* ------ Parliamentary ------ */ + { + name: m.signatureListsTitle, + path: SignatureCollectionPaths.ParliamentaryRoot, + element: , + loader: listsLoader(props), + }, + { + name: m.signatureListsConstituencyTitle, + path: SignatureCollectionPaths.ParliamentaryConstituency, + element: , + loader: listsLoader(props), + }, + { + name: m.singleList, + path: SignatureCollectionPaths.ParliamentaryConstituencyList, + element: , + loader: listLoader(props), + }, + + /* ------ Presidential ------ */ { name: m.signatureListsTitle, - path: SignatureCollectionPaths.SignatureLists, + path: SignatureCollectionPaths.PresidentialLists, element: ( { + const { formatMessage } = useLocale() + const navigate = useNavigate() + + const { collection, allLists } = useLoaderData() as ListsLoaderReturn + const { constituencyName } = useParams() as { constituencyName: string } + + const constituencyLists = allLists.filter( + (list) => list.area.name === constituencyName, + ) + + return ( + + + + + + + + + + + + {formatMessage(m.totalListResults) + + ': ' + + constituencyLists.length} + + {constituencyLists?.length > 0 && ( + + )} + + + {constituencyLists.map((list) => ( + { + navigate( + SignatureCollectionPaths.ParliamentaryConstituencyList.replace( + ':constituencyName', + constituencyName, + ).replace(':listId', list.id), + ) + }, + }} + /> + ))} + + + + + + + ) +} + +export default Constituency 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 new file mode 100644 index 000000000000..9f0cca263f80 --- /dev/null +++ b/libs/portals/admin/signature-collection/src/screens-parliamentary/List/index.tsx @@ -0,0 +1,50 @@ +import { GridColumn, GridContainer, GridRow } from '@island.is/island-ui/core' +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 { useLoaderData } from 'react-router-dom' +import { SignatureCollectionList } from '@island.is/api/schema' +import ActionExtendDeadline from '../../shared-components/extendDeadline' +import Signees from '../../shared-components/signees' +import ActionReviewComplete from '../../shared-components/completeReview' + +const List = () => { + const { formatMessage } = useLocale() + const { list } = useLoaderData() as { + list: SignatureCollectionList + } + + return ( + + + + + + + + + + + + + + ) +} + +export default List diff --git a/libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx b/libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx new file mode 100644 index 000000000000..54b6428860c7 --- /dev/null +++ b/libs/portals/admin/signature-collection/src/screens-parliamentary/index.tsx @@ -0,0 +1,89 @@ +import { + ActionCard, + FilterInput, + GridColumn, + GridContainer, + GridRow, + Stack, + Box, + Text, +} from '@island.is/island-ui/core' +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 { useLoaderData, useNavigate } from 'react-router-dom' +import { SignatureCollectionPaths } from '../lib/paths' +import CompareLists from '../shared-components/compareLists' +import { ListsLoaderReturn } from '../loaders/AllLists.loader' + +const ParliamentaryRoot = () => { + const { formatMessage } = useLocale() + + const navigate = useNavigate() + const { collection } = useLoaderData() as ListsLoaderReturn + + return ( + + + + + + + + + console.log('search')} + placeholder={formatMessage(m.searchInListPlaceholder)} + backgroundColor="blue" + /> + + + {formatMessage(m.totalListResults) + ' ' + collection?.areas.length} + + + {collection?.areas.map((area) => ( + { + navigate( + SignatureCollectionPaths.ParliamentaryConstituency.replace( + ':constituencyName', + area.name, + ), + ) + }, + }} + /> + ))} + + + + + + ) +} + +export default ParliamentaryRoot diff --git a/libs/portals/admin/signature-collection/src/screens/AllLists/components/completeCollectionProcessing/finishCollectionProcess.graphql b/libs/portals/admin/signature-collection/src/screens-presidential/AllLists/components/completeCollectionProcessing/finishCollectionProcess.graphql similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/AllLists/components/completeCollectionProcessing/finishCollectionProcess.graphql rename to libs/portals/admin/signature-collection/src/screens-presidential/AllLists/components/completeCollectionProcessing/finishCollectionProcess.graphql diff --git a/libs/portals/admin/signature-collection/src/screens/AllLists/components/completeCollectionProcessing/index.tsx b/libs/portals/admin/signature-collection/src/screens-presidential/AllLists/components/completeCollectionProcessing/index.tsx similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/AllLists/components/completeCollectionProcessing/index.tsx rename to libs/portals/admin/signature-collection/src/screens-presidential/AllLists/components/completeCollectionProcessing/index.tsx diff --git a/libs/portals/admin/signature-collection/src/screens/AllLists/components/reviewCandidates/index.tsx b/libs/portals/admin/signature-collection/src/screens-presidential/AllLists/components/reviewCandidates/index.tsx similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/AllLists/components/reviewCandidates/index.tsx rename to libs/portals/admin/signature-collection/src/screens-presidential/AllLists/components/reviewCandidates/index.tsx diff --git a/libs/portals/admin/signature-collection/src/screens/AllLists/components/reviewCandidates/removeCandidate.graphql b/libs/portals/admin/signature-collection/src/screens-presidential/AllLists/components/reviewCandidates/removeCandidate.graphql similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/AllLists/components/reviewCandidates/removeCandidate.graphql rename to libs/portals/admin/signature-collection/src/screens-presidential/AllLists/components/reviewCandidates/removeCandidate.graphql diff --git a/libs/portals/admin/signature-collection/src/screens/AllLists/index.tsx b/libs/portals/admin/signature-collection/src/screens-presidential/AllLists/index.tsx similarity index 95% rename from libs/portals/admin/signature-collection/src/screens/AllLists/index.tsx rename to libs/portals/admin/signature-collection/src/screens-presidential/AllLists/index.tsx index 624dadff74a1..b10fd2ce50a5 100644 --- a/libs/portals/admin/signature-collection/src/screens/AllLists/index.tsx +++ b/libs/portals/admin/signature-collection/src/screens-presidential/AllLists/index.tsx @@ -26,16 +26,16 @@ import { countryAreas, pageSize, } from '../../lib/utils' -import CompareLists from './components/compareLists' import { format as formatNationalId } from 'kennitala' -import CreateCollection from './components/createCollection' import electionsCommitteeLogo from '../../../assets/electionsCommittee.svg' import nationalRegistryLogo from '../../../assets/nationalRegistry.svg' import ActionCompleteCollectionProcessing from './components/completeCollectionProcessing' import ListInfo from '../List/components/listInfoAlert' -import { ListsLoaderReturn } from './AllLists.loader' -import EmptyState from './components/emptyState' +import EmptyState from '../../shared-components/emptyState' import ReviewCandidates from './components/reviewCandidates' +import CompareLists from '../../shared-components/compareLists' +import { ListsLoaderReturn } from '../../loaders/AllLists.loader' +import CreateCollection from '../../shared-components/createCollection' const Lists = ({ allowedToProcess }: { allowedToProcess: boolean }) => { const { formatMessage } = useLocale() @@ -226,7 +226,7 @@ const Lists = ({ allowedToProcess }: { allowedToProcess: boolean }) => { - {lists?.length > 0 ? ( + {lists?.length > 0 && collection.isPresidential ? ( <> {filters.input.length > 0 || @@ -282,8 +282,8 @@ const Lists = ({ allowedToProcess }: { allowedToProcess: boolean }) => { icon: 'arrowForward', onClick: () => { navigate( - SignatureCollectionPaths.SignatureList.replace( - ':id', + SignatureCollectionPaths.PresidentialList.replace( + ':listId', list.id, ), ) @@ -311,7 +311,7 @@ const Lists = ({ allowedToProcess }: { allowedToProcess: boolean }) => { /> )} - {lists?.length > 0 && ( + {lists?.length > 0 && collection.isPresidential && ( { )} - {lists?.length > 0 && ( + {lists?.length > 0 && collection.isPresidential && ( )} diff --git a/libs/portals/admin/signature-collection/src/screens/List/components/listInfoAlert/index.tsx b/libs/portals/admin/signature-collection/src/screens-presidential/List/components/listInfoAlert/index.tsx similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/List/components/listInfoAlert/index.tsx rename to libs/portals/admin/signature-collection/src/screens-presidential/List/components/listInfoAlert/index.tsx diff --git a/libs/portals/admin/signature-collection/src/screens/List/components/paperUpload/index.tsx b/libs/portals/admin/signature-collection/src/screens-presidential/List/components/paperUpload/index.tsx similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/List/components/paperUpload/index.tsx rename to libs/portals/admin/signature-collection/src/screens-presidential/List/components/paperUpload/index.tsx diff --git a/libs/portals/admin/signature-collection/src/screens/List/components/paperUpload/paperUpload.graphql b/libs/portals/admin/signature-collection/src/screens-presidential/List/components/paperUpload/paperUpload.graphql similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/List/components/paperUpload/paperUpload.graphql rename to libs/portals/admin/signature-collection/src/screens-presidential/List/components/paperUpload/paperUpload.graphql diff --git a/libs/portals/admin/signature-collection/src/screens/List/components/skeleton.tsx b/libs/portals/admin/signature-collection/src/screens-presidential/List/components/skeleton.tsx similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/List/components/skeleton.tsx rename to libs/portals/admin/signature-collection/src/screens-presidential/List/components/skeleton.tsx diff --git a/libs/portals/admin/signature-collection/src/screens/List/index.tsx b/libs/portals/admin/signature-collection/src/screens-presidential/List/index.tsx similarity index 95% rename from libs/portals/admin/signature-collection/src/screens/List/index.tsx rename to libs/portals/admin/signature-collection/src/screens-presidential/List/index.tsx index 4610b450ad2d..89d3aca6dc65 100644 --- a/libs/portals/admin/signature-collection/src/screens/List/index.tsx +++ b/libs/portals/admin/signature-collection/src/screens-presidential/List/index.tsx @@ -11,15 +11,15 @@ import { GridRow, Text, } from '@island.is/island-ui/core' -import Signees from './components/signees' -import ActionExtendDeadline from './components/extendDeadline' -import ActionReviewComplete from './components/completeReview' import PaperUpload from './components/paperUpload' import ListInfo from './components/listInfoAlert' import electionsCommitteeLogo from '../../../assets/electionsCommittee.svg' import nationalRegistryLogo from '../../../assets/nationalRegistry.svg' import { format as formatNationalId } from 'kennitala' import { ListStatus } from '../../lib/utils' +import ActionReviewComplete from '../../shared-components/completeReview' +import Signees from '../../shared-components/signees' +import ActionExtendDeadline from '../../shared-components/extendDeadline' export const List = ({ allowedToProcess }: { allowedToProcess: boolean }) => { const { list, listStatus } = useLoaderData() as { diff --git a/libs/portals/admin/signature-collection/src/screens/AllLists/components/compareLists/compareLists.graphql b/libs/portals/admin/signature-collection/src/shared-components/compareLists/compareLists.graphql similarity index 100% rename from libs/portals/admin/signature-collection/src/screens/AllLists/components/compareLists/compareLists.graphql rename to libs/portals/admin/signature-collection/src/shared-components/compareLists/compareLists.graphql diff --git a/libs/portals/admin/signature-collection/src/screens/AllLists/components/compareLists/index.tsx b/libs/portals/admin/signature-collection/src/shared-components/compareLists/index.tsx similarity index 93% rename from libs/portals/admin/signature-collection/src/screens/AllLists/components/compareLists/index.tsx rename to libs/portals/admin/signature-collection/src/shared-components/compareLists/index.tsx index 9ede275c65a1..4dd05e5091d1 100644 --- a/libs/portals/admin/signature-collection/src/screens/AllLists/components/compareLists/index.tsx +++ b/libs/portals/admin/signature-collection/src/shared-components/compareLists/index.tsx @@ -8,15 +8,15 @@ import { toast, } from '@island.is/island-ui/core' import { useLocale } from '@island.is/localization' -import { m } from '../../../../lib/messages' import { useState } from 'react' import { Modal } from '@island.is/react/components' import { useBulkCompareMutation } from './compareLists.generated' import { format as formatNationalId } from 'kennitala' import { SignatureCollectionSignature } from '@island.is/api/schema' -import { createFileList, getFileData } from '../../../../lib/utils' import { Skeleton } from './skeleton' import { useUnsignAdminMutation } from './removeSignatureFromList.generated' +import { m } from '../../lib/messages' +import { createFileList, getFileData } from '../../lib/utils' const CompareLists = ({ collectionId }: { collectionId: string }) => { const { formatMessage } = useLocale() @@ -57,7 +57,7 @@ const CompareLists = ({ collectionId }: { collectionId: string }) => { }, }) - if (res.data && res.data.signatureCollectionAdminUnsign.success) { + if (res.data?.signatureCollectionAdminUnsign.success) { toast.success(formatMessage(m.unsignFromListSuccess)) setUploadResults( uploadResults?.filter((result: SignatureCollectionSignature) => { @@ -84,20 +84,20 @@ const CompareLists = ({ collectionId }: { collectionId: string }) => { return ( - + {formatMessage(m.compareListsDescription)}