-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⛓ Allow linking to candidate preview (#1592)
* Display modal if candidate ID is provided in URL * Use correct modal parameters * Fetch cycleId from Candidate * Remove unneeded mocks from test * Redirect to past elections if applicable * Allow linking to past elections too
- Loading branch information
Showing
14 changed files
with
81 additions
and
66 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
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
17 changes: 17 additions & 0 deletions
17
packages/ui/src/council/hooks/useCandidatePreviewViaUrlParameter.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,17 @@ | ||
import { useEffect } from 'react' | ||
|
||
import { useModal } from '@/common/hooks/useModal' | ||
import { useRouteQuery } from '@/common/hooks/useRouteQuery' | ||
|
||
import { CandidacyPreviewModalCall } from '../modals/CandidacyPreview/types' | ||
|
||
export const useCandidatePreviewViaUrlParameter = () => { | ||
const { showModal } = useModal() | ||
const query = useRouteQuery() | ||
const candidateId = query.get('candidate') | ||
useEffect(() => { | ||
if (candidateId) { | ||
showModal<CandidacyPreviewModalCall>({ modal: 'CandidacyPreview', data: { id: candidateId } }) | ||
} | ||
}, [candidateId]) | ||
} |
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { ModalWithDataCall } from '../../../common/providers/modal/types' | ||
|
||
export type CandidacyPreviewModalCall = ModalWithDataCall<'CandidacyPreview', { id: string; cycleId: number }> | ||
export type CandidacyPreviewModalCall = ModalWithDataCall<'CandidacyPreview', { id: string }> |
17 changes: 11 additions & 6 deletions
17
packages/ui/src/council/queries/__generated__/council.generated.tsx
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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