feat(pdf): add index section with bookmarks and page numbers to PDF report#1635
Open
AlexanderArce wants to merge 4 commits into
Open
feat(pdf): add index section with bookmarks and page numbers to PDF report#1635AlexanderArce wants to merge 4 commits into
AlexanderArce wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the voting report PDF with a table-of-contents/index experience, adding localized strings plus PDF bookmarks, links, and visible page numbers in the report output.
Changes:
- Add new
process_pdf.document.bookmarksandprocess_pdf.document.indexlocale strings in all supported languages. - Update
VotingReportPdf.tsxto insert an index page and render bookmark/page-number metadata in the PDF. - Expand
VotingReportPdf.test.tsxto account for the extra page and new index/page-number structure.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/i18n/locales/it/common.json |
Adds Italian strings for PDF bookmarks and index text. |
src/i18n/locales/es/common.json |
Adds Spanish strings for PDF bookmarks and index text. |
src/i18n/locales/en/common.json |
Adds English strings for PDF bookmarks and index text. |
src/i18n/locales/ca/common.json |
Adds Catalan strings for PDF bookmarks and index text. |
src/components/Process/VotingReportPdf.tsx |
Implements the new index page, bookmark metadata, internal links, and report page numbers. |
src/components/Process/VotingReportPdf.test.tsx |
Updates unit coverage for the extra PDF page and TOC/page-number rendering. |
Comment on lines
+759
to
+763
| <Page | ||
| size='A4' | ||
| style={styles.page} | ||
| bookmark={t('process_pdf.document.bookmarks.index', { defaultValue: 'Index' })} | ||
| > |
Comment on lines
+690
to
+734
| const buildReportSections = (t: TFunction): ReportSection[] => [ | ||
| { | ||
| title: t('process_pdf.document.sections.general_information', { defaultValue: '1. General Information' }), | ||
| page: 1, | ||
| href: '#report-page-3', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.authentication', { defaultValue: '2. Authentication' }), | ||
| page: 1, | ||
| href: '#report-page-3', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.voting_system', { defaultValue: '3. Voting System' }), | ||
| page: 1, | ||
| href: '#report-page-3', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.electoral_census', { defaultValue: '4. Electoral Census' }), | ||
| page: 1, | ||
| href: '#report-page-3', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.turnout_participation', { defaultValue: '5. Turnout and Participation' }), | ||
| page: 1, | ||
| href: '#report-page-3', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.voting_process', { defaultValue: '6. Voting Process' }), | ||
| page: 2, | ||
| href: '#report-page-4', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.verification', { defaultValue: '7. Verification' }), | ||
| page: 2, | ||
| href: '#report-page-4', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.certification_scope', { defaultValue: '8. Certification Scope' }), | ||
| page: 2, | ||
| href: '#report-page-4', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.issuer', { defaultValue: '9. Issuer' }), | ||
| page: 3, | ||
| href: '#report-page-5', |
Comment on lines
+690
to
+737
| const buildReportSections = (t: TFunction): ReportSection[] => [ | ||
| { | ||
| title: t('process_pdf.document.sections.general_information', { defaultValue: '1. General Information' }), | ||
| page: 1, | ||
| href: '#report-page-3', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.authentication', { defaultValue: '2. Authentication' }), | ||
| page: 1, | ||
| href: '#report-page-3', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.voting_system', { defaultValue: '3. Voting System' }), | ||
| page: 1, | ||
| href: '#report-page-3', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.electoral_census', { defaultValue: '4. Electoral Census' }), | ||
| page: 1, | ||
| href: '#report-page-3', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.turnout_participation', { defaultValue: '5. Turnout and Participation' }), | ||
| page: 1, | ||
| href: '#report-page-3', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.voting_process', { defaultValue: '6. Voting Process' }), | ||
| page: 2, | ||
| href: '#report-page-4', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.verification', { defaultValue: '7. Verification' }), | ||
| page: 2, | ||
| href: '#report-page-4', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.certification_scope', { defaultValue: '8. Certification Scope' }), | ||
| page: 2, | ||
| href: '#report-page-4', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.issuer', { defaultValue: '9. Issuer' }), | ||
| page: 3, | ||
| href: '#report-page-5', | ||
| }, | ||
| ] | ||
|
|
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.
Comments suppressed due to low confidence (1)
src/components/Process/VotingReportPdf.tsx:749
- This PR removes the “Encryption method” row from
generalInformation. Since the PR is focused on adding an index/bookmarks/page numbers, please confirm this removal is intentional; otherwise, re-add the encryption method field to avoid an unrelated report regression.
generalInformation: [
{
label: t('process_pdf.general.organization', { defaultValue: 'Organization' }),
value: organizationName || notAvailableLabel,
},
{ label: t('process_pdf.general.event_name', { defaultValue: 'Event name' }), value: eventReference },
{
label: t('process_pdf.general.voting_period_start', { defaultValue: 'Voting period (start)' }),
value: startDatetime,
},
{
label: t('process_pdf.general.voting_period_end', { defaultValue: 'Voting period (end)' }),
value: endDatetime,
},
{
label: t('process_pdf.general.results_visibility', { defaultValue: 'Results visibility' }),
value: resultsVisibility,
},
{
label: t('process_pdf.general.network', { defaultValue: 'Network' }),
value: blockchainNetwork,
},
{
label: t('process_pdf.general.extended_process_details', { defaultValue: 'Extended process details' }),
value: verificationExplorerLink,
},
{
| <Page | ||
| size='A4' | ||
| style={styles.coverPage} | ||
| bookmark={t('process_pdf.document.bookmarks.index', { defaultValue: 'Index' })} |
| const SectionTitle = ({ children }: { children: string }) => <PdfText style={styles.sectionTitle}>{children}</PdfText> | ||
|
|
||
| const ReportSectionBlock = ({ children }: { children: ReactNode }) => ( | ||
| <View wrap={false} style={styles.section}> |
Comment on lines
+966
to
+1006
| page: '1', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.authentication', { defaultValue: '2. Authentication' }), | ||
| href: '#report-page-3', | ||
| page: '1', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.voting_system', { defaultValue: '3. Voting System' }), | ||
| href: '#report-page-3', | ||
| page: '1', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.electoral_census', { defaultValue: '4. Electoral Census' }), | ||
| href: '#report-page-3', | ||
| page: '1', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.turnout_participation', { defaultValue: '5. Turnout and Participation' }), | ||
| href: '#report-page-3', | ||
| page: '1', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.voting_process', { defaultValue: '6. Voting Process' }), | ||
| href: '#report-page-4', | ||
| page: '2', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.verification', { defaultValue: '7. Verification' }), | ||
| href: '#report-page-4', | ||
| page: '2', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.certification_scope', { defaultValue: '8. Certification Scope' }), | ||
| href: '#report-page-5', | ||
| page: '3', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.issuer', { defaultValue: '9. Issuer' }), | ||
| href: '#report-page-5', | ||
| page: '3', |
Comment on lines
+1483
to
+1486
| "question": "Question: {{question}}", | ||
| "results": "Results:" | ||
| "results": "Results:", | ||
| "share": "Share", | ||
| "votes": "Votes" |
Comment on lines
+1506
to
+1509
| "question": "Pregunta: {{question}}", | ||
| "results": "Resultados:" | ||
| "results": "Resultados:", | ||
| "share": "Porcentaje", | ||
| "votes": "Votos" |
Comment on lines
+1506
to
+1509
| "question": "Pregunta: {{question}}", | ||
| "results": "Resultats:" | ||
| "results": "Resultats:", | ||
| "share": "Percentatge", | ||
| "votes": "Vots" |
Comment on lines
+1506
to
+1509
| "question": "Domanda: {{question}}", | ||
| "results": "Risultati:" | ||
| "results": "Risultati:", | ||
| "share": "Quota", | ||
| "votes": "Voti" |
4fa84a9 to
f4576c0
Compare
| <Page | ||
| size='A4' | ||
| style={styles.coverPage} | ||
| bookmark={t('process_pdf.document.bookmarks.index', { defaultValue: 'Index' })} |
Comment on lines
1129
to
+1134
| <Page size='A4' style={styles.page}> | ||
| <View style={styles.pageBrand}> | ||
| <Image src={vocdoniIcon} style={styles.pageBrandIcon} /> | ||
| </View> | ||
| <RunningHeader /> | ||
|
|
||
| <ReportSectionBlock> | ||
| <SectionTitle>{t('process_pdf.document.index.title', { defaultValue: 'Index' })}</SectionTitle> | ||
| <PdfText style={styles.indexIntro}> |
| const SectionTitle = ({ children }: { children: string }) => <PdfText style={styles.sectionTitle}>{children}</PdfText> | ||
|
|
||
| const ReportSectionBlock = ({ children }: { children: ReactNode }) => ( | ||
| <View wrap={false} style={styles.section}> |
Comment on lines
+965
to
+1006
| href: '#report-page-3', | ||
| page: '1', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.authentication', { defaultValue: '2. Authentication' }), | ||
| href: '#report-page-3', | ||
| page: '1', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.voting_system', { defaultValue: '3. Voting System' }), | ||
| href: '#report-page-3', | ||
| page: '1', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.electoral_census', { defaultValue: '4. Electoral Census' }), | ||
| href: '#report-page-3', | ||
| page: '1', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.turnout_participation', { defaultValue: '5. Turnout and Participation' }), | ||
| href: '#report-page-3', | ||
| page: '1', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.voting_process', { defaultValue: '6. Voting Process' }), | ||
| href: '#report-page-4', | ||
| page: '2', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.verification', { defaultValue: '7. Verification' }), | ||
| href: '#report-page-4', | ||
| page: '2', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.certification_scope', { defaultValue: '8. Certification Scope' }), | ||
| href: '#report-page-5', | ||
| page: '3', | ||
| }, | ||
| { | ||
| title: t('process_pdf.document.sections.issuer', { defaultValue: '9. Issuer' }), | ||
| href: '#report-page-5', | ||
| page: '3', |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.