Once Dan provides the background SVG files for each NEAR University program that offers a certificate, and the designs of what those certificates should look like with all of their text fields populated, we need to implement this function.
Wait for Dan's files and designs. (Well, while you're waiting, read through everything, look through the code, pretend that he's already given you what you need, and see if you have any questions about the steps you'll need to take.)
With git, checkout the 'develop' branch to your local machine
Create a branch from that branch, and name it 'feature/generateImage'.
Review /web-app/README.md to learn about the project and how to run it.
When you receive the files from Dan, save them to /web-app/public/certificate-backgrounds/
You can leave fetchCertificateDetails (mostly) stubbed out how it is (rather than trying to figure out how to fetch real data from the blockchain; we can work on that later).
Edit /web-app/pages/api/cert/[imageFileName].ts as appropriate. You'll need to temporarily add to fetchCertificateDetails a property called 'program', the value of which will determine which background file to use and the styles of the text to add. Think about possible ways to do this. Maybe generateImage needs to have a switch or "if" statements that call addText differently based on 'program' codenames / nicknames (such as 'NCD').
You'll commit code as you make progress and push those commits up to your remote branch. Eventually, when ready, you'll submit a Pull Request that we can review together.
This ticket / issue will be complete when we can visit http://localhost:3000/api/cert/017717dc-1e06-48d0-af2f-eb03b3dc5f9c.svg and see a production-ready image, and then temporarily changing the 'program' value within fetchCertificateDetails (to any program codename value that we offer) and refreshing that URL would always appropriately generate a good-looking certificate for the appropriate program.
See this file, especially the highlighted lines: https://github.com/NEAR-Edu/near-certification-tools/blob/5958befba192dd824bf4341699f0b65665a6a77d/web-app/pages/api/cert/%5BimageFileName%5D.ts#L50-L80
Once Dan provides the background SVG files for each NEAR University program that offers a certificate, and the designs of what those certificates should look like with all of their text fields populated, we need to implement this function.
/web-app/public/certificate-backgrounds/
fetchCertificateDetails
(mostly) stubbed out how it is (rather than trying to figure out how to fetch real data from the blockchain; we can work on that later)./web-app/pages/api/cert/[imageFileName].ts
as appropriate. You'll need to temporarily add tofetchCertificateDetails
a property called 'program', the value of which will determine which background file to use and the styles of the text to add. Think about possible ways to do this. Maybe generateImage needs to have a switch or "if" statements that call addText differently based on 'program' codenames / nicknames (such as 'NCD').This ticket / issue will be complete when we can visit http://localhost:3000/api/cert/017717dc-1e06-48d0-af2f-eb03b3dc5f9c.svg and see a production-ready image, and then temporarily changing the 'program' value within fetchCertificateDetails (to any program codename value that we offer) and refreshing that URL would always appropriately generate a good-looking certificate for the appropriate program.