-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ojoi): Add involved party to (#16200)
* Involved party client / graphql * WIP: setting up involved party screen * Involved parties now ready * Fixed PR comments. * Fixed more PR comments
- Loading branch information
1 parent
ee301d0
commit b9b67a6
Showing
16 changed files
with
384 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...omains/official-journal-of-iceland-application/src/models/getUserInvolvedParties.input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Field, ID, InputType } from '@nestjs/graphql' | ||
|
||
@InputType('GetUserInvolvedPartiesInput') | ||
export class GetUserInvolvedPartiesInput { | ||
@Field(() => ID) | ||
applicationId!: string | ||
} |
19 changes: 19 additions & 0 deletions
19
...ins/official-journal-of-iceland-application/src/models/getUserInvolvedParties.response.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Field, ObjectType } from '@nestjs/graphql' | ||
|
||
@ObjectType('OfficialJournalOfIcelandApplicationGetUserInvolvedParty') | ||
export class InvolvededParty { | ||
@Field({ description: 'The id of the involved party' }) | ||
id!: string | ||
|
||
@Field({ description: 'The title of the involved party' }) | ||
title!: string | ||
|
||
@Field({ description: 'The slug of the involved party' }) | ||
slug!: string | ||
} | ||
|
||
@ObjectType('OfficialJournalOfIcelandApplicationGetUserInvolvedPartiesResponse') | ||
export class GetUserInvolvedPartiesResponse { | ||
@Field(() => [InvolvededParty]) | ||
involvedParties!: InvolvededParty[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
libs/application/templates/official-journal-of-iceland/src/hooks/useInvolvedParties.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { useQuery } from '@apollo/client' | ||
import { OfficialJournalOfIcelandApplicationGetUserInvolvedPartiesResponse } from '@island.is/api/schema' | ||
import { INVOLVED_PARTIES_QUERY } from '../graphql/queries' | ||
|
||
type Props = { | ||
applicationId?: string | ||
onComplete?: (data: InvolvedPartiesResponse) => void | ||
onError?: (error: Error) => void | ||
} | ||
|
||
type InvolvedPartiesResponse = { | ||
officialJournalOfIcelandApplicationGetUserInvolvedParties: OfficialJournalOfIcelandApplicationGetUserInvolvedPartiesResponse | ||
} | ||
export const useInvolvedParties = ({ | ||
applicationId, | ||
onComplete, | ||
onError, | ||
}: Props) => { | ||
const { data, loading, error } = useQuery<InvolvedPartiesResponse>( | ||
INVOLVED_PARTIES_QUERY, | ||
{ | ||
skip: !applicationId, | ||
fetchPolicy: 'no-cache', | ||
variables: { | ||
input: { | ||
applicationId: applicationId, | ||
}, | ||
}, | ||
onCompleted: (data) => { | ||
onComplete && onComplete(data) | ||
}, | ||
onError: (error) => { | ||
onError && onError(error) | ||
}, | ||
}, | ||
) | ||
|
||
return { | ||
involvedParties: | ||
data?.officialJournalOfIcelandApplicationGetUserInvolvedParties | ||
.involvedParties, | ||
loading, | ||
error, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
libs/application/templates/official-journal-of-iceland/src/lib/messages/involved-parties.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { defineMessages } from 'react-intl' | ||
|
||
export const involvedParty = { | ||
general: defineMessages({ | ||
title: { | ||
id: 'ojoi.application:original.general.title', | ||
defaultMessage: 'Stofnun ', | ||
description: 'Title of the involved party screen', | ||
}, | ||
intro: { | ||
id: 'ojoi.application:original.general.intro', | ||
defaultMessage: | ||
'Hér getur þú valið stofnun sem þú vilt tengja við umsóknina þína.', | ||
description: 'Intro of the involved party form', | ||
}, | ||
section: { | ||
id: 'ojoi.application:original.general.section', | ||
defaultMessage: 'Stofnanir', | ||
description: 'Title of the involved party section', | ||
}, | ||
}), | ||
inputs: { | ||
select: defineMessages({ | ||
placeholder: { | ||
id: 'ojoi.application:original.inputs.select.placeholder', | ||
defaultMessage: 'Veldu stofnun', | ||
description: 'Placeholder for the select input', | ||
}, | ||
}), | ||
}, | ||
|
||
errors: defineMessages({ | ||
title: { | ||
id: 'ojoi.application:original.error.title', | ||
defaultMessage: 'Þú hefur ekki aðgang', | ||
description: 'Title of the error message', | ||
}, | ||
message: { | ||
id: 'ojoi.application:original.error.message', | ||
defaultMessage: | ||
'Ekki tókst að sækja stofnanir fyrir aðganginn þinn, ef þú telur þig eiga að hafa aðgang, vinsamlegast hafðu samband við ritstjóra Stjórnartíðnda.', | ||
description: 'Error message', | ||
}, | ||
noDataTitle: { | ||
id: 'ojoi.application:original.error.noDataTitle', | ||
defaultMessage: 'Engar stofnanir', | ||
description: 'Title of the no data message', | ||
}, | ||
noDataMessage: { | ||
id: 'ojoi.application:original.error.noDataMessage', | ||
defaultMessage: | ||
'Notandinn er ekki tengdur neinum stofnunum, vinsamlegast hafðu samband við ritstjóra Stjórnartíðnda.', | ||
description: 'No data message', | ||
}, | ||
}), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.