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): Collection admin touchups #16195

Merged
merged 5 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
13 changes: 7 additions & 6 deletions libs/portals/admin/signature-collection/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,13 @@ export const m = defineMessages({
},
createCollectionModalDescription: {
id: 'admin-portal.signature-collection:createCollectionModalDescription',
defaultMessage: 'Sláðu inn kennitölu frambjóðanda',
defaultMessage:
'Til þess að stofna meðmælasöfnun þarf að slá inn kennitölu frambjóðs.',
description: '',
},
candidateNationalId: {
id: 'admin-portal.signature-collection:candidateNationalId',
defaultMessage: 'Kennitala frambjóðanda',
defaultMessage: 'Kennitala frambjóðs',
albinagu marked this conversation as resolved.
Show resolved Hide resolved
description: '',
},
candidateNationalIdNotFound: {
Expand All @@ -142,7 +143,7 @@ export const m = defineMessages({
},
candidateName: {
id: 'admin-portal.signature-collection:candidateName',
defaultMessage: 'Nafn frambjóðanda',
defaultMessage: 'Nafn frambjóðs',
albinagu marked this conversation as resolved.
Show resolved Hide resolved
description: '',
},
listEndTime: {
Expand Down Expand Up @@ -275,7 +276,7 @@ export const m = defineMessages({
downloadReportsDescription: {
id: 'admin-portal.signature-collection:downloadReportsDescription',
defaultMessage:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus nec odio ultricies ultricies. Nullam nec purus nec odio ultricies ultricies.',
'Hlaðið niður yfirlitsskýrslum yfir stöðu safnana í hverju kjördæmi fyrir sig eftir yfirferð.',
description: '',
},
downloadButton: {
Expand All @@ -285,7 +286,7 @@ export const m = defineMessages({
},
searchInListPlaceholder: {
id: 'admin-portal.signature-collection:searchInListPlaceholder',
defaultMessage: 'Leitaðu að nafni eða kennitölu',
defaultMessage: 'Leita eftir nafni eða kennitölu',
description: '',
},
sortBy: {
Expand Down Expand Up @@ -639,7 +640,7 @@ export const parliamentaryMessages = defineMessages({
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.',
'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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const Constituency = () => {
marginBottom={3}
display="flex"
justifyContent="spaceBetween"
alignItems="center"
alignItems="flexEnd"
>
<Text variant="eyebrow">
{formatMessage(m.totalListResults) +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ export const DownloadReports = ({
closeButtonLabel={''}
>
<Text>{formatMessage(m.downloadReportsDescription)}</Text>
<Box marginTop={5}>
<Box marginY={5}>
<Stack space={3}>
{areas.map((area) => (
<ActionCard
key={area.id}
heading={formatMessage(area.name)}
headingVariant="h4"
backgroundColor="blue"
cta={{
label: formatMessage(m.downloadButton),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ 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 } from 'react-router-dom'
import { SignatureCollectionList } from '@island.is/api/schema'
import { ListStatus, SignatureCollectionList } from '@island.is/api/schema'
import { PaperSignees } from './paperSignees'
import { SignatureCollectionPaths } from '../../lib/paths'
import ActionExtendDeadline from '../../shared-components/extendDeadline'
import Signees from '../../shared-components/signees'
import ActionReviewComplete from '../../shared-components/completeReview'
import ListInfo from '../../shared-components/listInfoAlert'

const List = () => {
const { formatMessage } = useLocale()
const { list } = useLoaderData() as {
const { list, listStatus } = useLoaderData() as {
list: SignatureCollectionList
listStatus: string
}

return (
Expand Down Expand Up @@ -60,10 +62,23 @@ const List = () => {
</Box>
<IntroHeader
title={list?.title}
intro={formatMessage(parliamentaryMessages.signatureListsIntro)}
imgPosition="right"
imgHiddenBelow="sm"
/>
<ListInfo
message={
listStatus === ListStatus.Extendable
? formatMessage(m.listStatusExtendableAlert)
: listStatus === ListStatus.InReview
? formatMessage(m.listStatusInReviewAlert)
: listStatus === ListStatus.Reviewed
? formatMessage(m.listStatusReviewedStatusAlert)
: listStatus === ListStatus.Inactive
? formatMessage(m.listStatusReviewedStatusAlert)
: formatMessage(m.listStatusActiveAlert)
}
type={listStatus === ListStatus.Reviewed ? 'success' : undefined}
/>
albinagu marked this conversation as resolved.
Show resolved Hide resolved
<ActionExtendDeadline listId={list.id} endTime={list.endTime} />
<Signees numberOfSignatures={list.numberOfSignatures ?? 0} />
<PaperSignees listId={list.id} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { format as formatNationalId } from 'kennitala'
import electionsCommitteeLogo from '../../../assets/electionsCommittee.svg'
import nationalRegistryLogo from '../../../assets/nationalRegistry.svg'
import ActionCompleteCollectionProcessing from './components/completeCollectionProcessing'
import ListInfo from '../List/components/listInfoAlert'
import ListInfo from '../../shared-components/listInfoAlert'
import EmptyState from '../../shared-components/emptyState'
import ReviewCandidates from './components/reviewCandidates'
import CompareLists from '../../shared-components/compareLists'
Expand Down Expand Up @@ -163,7 +163,7 @@ const Lists = ({ allowedToProcess }: { allowedToProcess: boolean }) => {
placeholder={formatMessage(m.searchInAllListsPlaceholder)}
value={filters.input}
onChange={(value) => setFilters({ ...filters, input: value })}
backgroundColor="white"
backgroundColor="blue"
/>
</GridColumn>
<GridColumn span={['12/12', '12/12', '12/12', '6/12']}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
Text,
} from '@island.is/island-ui/core'
import PaperUpload from './components/paperUpload'
import ListInfo from './components/listInfoAlert'
import ListInfo from '../../shared-components/listInfoAlert'
albinagu marked this conversation as resolved.
Show resolved Hide resolved
import electionsCommitteeLogo from '../../../assets/electionsCommittee.svg'
import nationalRegistryLogo from '../../../assets/nationalRegistry.svg'
import { format as formatNationalId } from 'kennitala'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ const ActionReviewComplete = ({
<Button
iconType="outline"
variant="ghost"
/*disabled={
disabled={
listStatus !== ListStatus.Reviewed &&
listStatus !== ListStatus.InReview
}*/
}
icon={listReviewed ? 'lockOpened' : 'lockClosed'}
colorScheme={listReviewed ? 'default' : 'destructive'}
onClick={() => setModalSubmitReviewIsOpen(true)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
Input,
AlertMessage,
toast,
GridRow,
GridColumn,
} from '@island.is/island-ui/core'
import { useLocale } from '@island.is/localization'
import { useEffect, useState } from 'react'
Expand Down Expand Up @@ -126,52 +128,56 @@ const CreateCollection = ({ collectionId }: { collectionId: string }) => {
<Text marginBottom={5}>
{formatMessage(m.createCollectionModalDescription)}
</Text>
<Stack space={3}>
<InputController
control={control as unknown as Control}
type="tel"
id="candidateNationalId"
label={formatMessage(m.candidateNationalId)}
format="######-####"
defaultValue={nationalIdInput}
onChange={(v) =>
setNationalIdInput(v.target.value.replace(/\W/g, ''))
}
loading={loadingCandidate}
error={
nationalIdNotFound
? formatMessage(m.candidateNationalIdNotFound)
: undefined
}
/>
<Input
name="candidateName"
label={formatMessage(m.candidateName)}
readOnly
value={name}
placeholder={loadingCandidate ? 'Sæki nafn...' : ''}
/>
</Stack>
{!canCreate && (
<Box marginTop={3}>
<AlertMessage
type="error"
title={''}
message={canCreateErrorReason}
/>
</Box>
)}
<Box display="flex" justifyContent="center" marginY={5}>
<Button
onClick={() => {
createNewCollection()
}}
disabled={!canCreate}
loading={loading}
>
{formatMessage(m.createCollection)}
</Button>
</Box>
<GridRow>
<GridColumn span="10/12" offset="1/12">
<Stack space={3}>
<InputController
control={control as unknown as Control}
type="tel"
id="candidateNationalId"
label={formatMessage(m.candidateNationalId)}
format="######-####"
defaultValue={nationalIdInput}
onChange={(v) =>
setNationalIdInput(v.target.value.replace(/\W/g, ''))
}
loading={loadingCandidate}
error={
nationalIdNotFound
? formatMessage(m.candidateNationalIdNotFound)
: undefined
}
/>
<Input
name="candidateName"
label={formatMessage(m.candidateName)}
readOnly
value={name}
placeholder={loadingCandidate ? 'Sæki nafn...' : ''}
/>
</Stack>
{!canCreate && (
<Box marginTop={3}>
<AlertMessage
type="error"
title={''}
message={canCreateErrorReason}
/>
</Box>
)}
<Box display="flex" justifyContent="center" marginY={5}>
<Button
onClick={() => {
createNewCollection()
}}
disabled={!canCreate}
loading={loading}
>
{formatMessage(m.createCollection)}
</Button>
</Box>
</GridColumn>
</GridRow>
</Modal>
</Box>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,14 @@ const ActionExtendDeadline = ({
readOnly
value={format(new Date(endDate), 'dd.MM.yyyy HH:mm')}
/>
{allowedToProcess && (
<Box marginLeft={2}>
<Button
icon="calendar"
iconType="outline"
variant="ghost"
onClick={() => setModalChangeDateIsOpen(true)}
></Button>
</Box>
)}
<Box marginLeft={2}>
<Button
icon="calendar"
iconType="outline"
variant="ghost"
onClick={() => setModalChangeDateIsOpen(true)}
></Button>
</Box>
albinagu marked this conversation as resolved.
Show resolved Hide resolved
</Box>
<Modal
id="extendDeadline"
Expand Down