Skip to content

[DEV-4454] Add download certificate functionality and changeset - #2298

Open
MarBert wants to merge 2 commits into
DEV-4358-add-certificates-pagefrom
DEV-4454-add-certificate-download
Open

[DEV-4454] Add download certificate functionality and changeset#2298
MarBert wants to merge 2 commits into
DEV-4358-add-certificates-pagefrom
DEV-4454-add-certificate-download

Conversation

@MarBert

@MarBert MarBert commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

List of Changes

This pull request introduces a major new feature to the nextjs-website app: users can now download their webinar participation certificates as PDFs. The implementation leverages the @react-pdf/renderer package to generate certificates dynamically, integrates a new CertificateTemplate component, and updates the UI components to support download actions. Additionally, translation files are enhanced to support certificate text in both English and Italian.

Certificate Download Functionality:

  • Added the @react-pdf/renderer package as a new dependency to enable PDF generation.
  • Created a new CertificateTemplate component using @react-pdf/renderer for rendering certificate PDFs, including custom fonts and layout.
  • Implemented a handleDownload function in CertificatesList.tsx to generate and trigger the download of the certificate PDF when the user clicks the CTA.

UI Component Updates:

  • Updated CtaCard and CardsGrid components to support an onClick handler for CTA buttons, enabling actions like downloading certificates in addition to navigation. [1] [2] [3] [4] [5] [6]
  • Enhanced the CertificatesList logic to correctly filter and display only webinars with available certificates, and to pass the appropriate data to the download handler.

Localization Improvements:

  • Extended English and Italian translation files to include certificate-specific text for use in the generated PDFs. [1] [2]

Changelog:

  • Added a changeset marking this as a major update, documenting the addition of the download PDF functionality.

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

image

Types of changes

  • Chore (nothing changes by a user perspective)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@MarBert
MarBert requested a review from Copilot June 26, 2026 13:00
@MarBert MarBert self-assigned this Jun 26, 2026
@changeset-bot

changeset-bot Bot commented Jun 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bfc8ec1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nextjs-website Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Jira Pull Request Link

This Pull Request refers to the following Jira issue DEV-4454

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds client-side generation and download of webinar participation certificates (PDF) to the apps/nextjs-website Next.js application, integrating @react-pdf/renderer and extending the card CTA components to support action-based CTAs (not just navigation).

Changes:

  • Add @react-pdf/renderer dependency and implement a CertificateTemplate PDF layout.
  • Extend CardsGrid/CtaCard to support CTA onClick handlers and wire a download action from CertificatesList.
  • Add new certificate-related i18n strings in en.json and it.json, plus a changeset entry.

Reviewed changes

Copilot reviewed 8 out of 13 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
package.json Adds @react-pdf/renderer dependency to enable certificate PDF generation.
package-lock.json Locks transitive dependencies introduced by @react-pdf/renderer.
apps/nextjs-website/src/messages/it.json Adds certificate strings (currently needing Italian translations + typo fixes).
apps/nextjs-website/src/messages/en.json Adds certificate strings (minor spacing issue in createdAt).
apps/nextjs-website/src/components/templates/CertificateTemplate/CertificateTemplate.tsx New PDF template used to render the certificate document.
apps/nextjs-website/src/components/organisms/CertificatesList/CertificatesList.tsx Adds download handler and filters webinars to those with available certificates.
apps/nextjs-website/src/components/molecules/CardsGrid/CardsGrid.tsx Extends card props to pass a CTA onClick handler through to CtaCard.
apps/nextjs-website/src/components/atoms/CtaCard/CtaCard.tsx Adds CTA onClick support (button action vs link navigation).
.changeset/early-apes-visit.md Adds a changeset entry for the feature (currently marked as major).

Comment on lines +41 to +48
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
// eslint-disable-next-line functional/immutable-data
link.href = url;
// eslint-disable-next-line functional/immutable-data
link.download = 'documento.pdf';
link.click();
URL.revokeObjectURL(url);
Comment on lines +75 to +78
onClick: () =>
handleDownload(
user?.attributes.given_name + ' ' + user?.attributes.family_name,
webinar.title,
Comment on lines +79 to +82
new Date(certificateCreatedAt || '').toLocaleString('it-IT', {
dateStyle: 'long',
timeStyle: 'short',
}),
Comment on lines +63 to +69
style={{
paddingTop: '-24px',
fontFamily: 'Titillium Sans Pro',
fontWeight: 700,
fontSize: '80px',
color: palette.text.primary,
}}
Comment on lines +74 to +80
style={{
paddingTop: '-48px',
fontFamily: 'Titillium Sans Pro',
fontWeight: 700,
fontSize: '36px',
color: palette.text.primary,
}}
Comment on lines +140 to +141
"attended": "Attended the online webinar via PagoPa's DevPortal:"
}
Comment on lines +136 to +139
"title": "CERTIFICATE",
"subtitle": "OF PARTICIPATION",
"createdAt": "Created at ",
"certification": "This certificate attests that:",
Comment on lines 13 to 18
title: string;
text: string;
href?: string;
onClick?: () => Promise<void>;
ctaLabel?: string;
endIcon?: React.ReactNode;
Comment on lines 23 to 30
readonly cta?: {
readonly target?: '_blank' | '_self' | '_parent' | '_top';
readonly label: string | ReactNode;
readonly href?: string;
readonly onClick?: () => null | Promise<void>;
readonly variant?: 'text' | 'contained' | 'outlined';
readonly endIcon?: ReactNode;
readonly style?: SxProps;
Comment on lines +1 to +3
---
"nextjs-website": major
---
@github-actions

Copy link
Copy Markdown
Contributor

This pull request is stale because it has been open for 14 days with no activity. If the pull request is still valid, please update it within 21 days to keep it open or merge it, otherwise it will be closed automatically.

@github-actions github-actions Bot added the stale label Jul 15, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

This pull request was closed because it has been inactive for 21 days since being marked as stale.

@github-actions github-actions Bot closed this Aug 8, 2026
@github-actions
github-actions Bot deleted the DEV-4454-add-certificate-download branch August 8, 2026 02:42
@uolter uolter removed the stale label Aug 24, 2026
@uolter
uolter restored the DEV-4454-add-certificate-download branch August 24, 2026 10:11
@uolter uolter reopened this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants