Skip to content

New WebPart: React Carbon Footprint Calculator (by João Livio) #5473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jtlivio
Copy link
Contributor

@jtlivio jtlivio commented May 8, 2025

By submitting this pull request, you agree to the [contribution guidelines](https://github.com/pnp/sp-dev-fx-webparts/blob/main/CONTRIBUTING.md)

What's in this Pull Request?

This PR introduces the React Carbon Footprint Calculator WebPart.

The web part provides an interactive tool that allows users to input their monthly consumption for electricity, car travel, flights (short and long), natural gas, and water. It calculates real-time carbon emissions per person, visualizes them through an interactive bar chart, and highlights sustainable thresholds clearly with color coding (green, yellow, red). Additionally, it provides actionable sustainability tips and enables exporting the results and chart to a PDF document.

Use Case

This solution helps organizations encourage sustainable habits by visualizing individual carbon footprints directly within SharePoint environments. It enhances environmental awareness and motivates positive behavior changes among users.

Built With

  • React (TypeScript)
  • Fluent UI
  • Chart.js
  • jsPDF (for PDF generation)

Author

João Livio, pH7x Systems

Node Version

Node version used: v18.20.2

Checklist

  • My pull request affects only ONE sample.
  • My sample builds without any warnings.
  • I have updated the README.md file's Version history. For new samples, created a new README.md file matching the provided template.
  • My README.md has at least one static high-resolution screenshot located in the assets folder.
  • My README.md contains complete setup instructions, including prerequisites and permissions required.
  • My solution includes a .nvmrc file indicating the version of Node.js.
  • New sample

Copy link

github-actions bot commented May 8, 2025

Sample PR validation for #5473

⚠️ Validation status: warnings

We automatically validate all pull requests against our contribution guidance to ensure that all samples provide a consistent experience to our community.

In order to merge this PR in a timely manner, the following criteria must be met:

Validation Status
Pull request affects only one folder ✅ Succeeded
Sample folder name follows naming convention ✅ Succeeded
README.md contains visitor stat image ⚠️ Warning
Sample requires a .nvmrc file ⚠️ Warning
Sample requires a README.md ✅ Succeeded
Sample requires a screenshot .png in assets folder ✅ Succeeded
No .sppkg file ✅ Succeeded
No node_modules folder ✅ Succeeded
No lib folder ✅ Succeeded

@jtlivio please address the above issues and push new changes to this branch.
For more information, see the contribution guidance.

Copy link

github-actions bot commented May 8, 2025

Sample PR validation for #5473

⚠️ Validation status: warnings

We automatically validate all pull requests against our contribution guidance to ensure that all samples provide a consistent experience to our community.

In order to merge this PR in a timely manner, the following criteria must be met:

Validation Status
Pull request affects only one folder ✅ Succeeded
Sample folder name follows naming convention ✅ Succeeded
README.md contains visitor stat image ⚠️ Warning
Sample requires a .nvmrc file ⚠️ Warning
Sample requires a README.md ✅ Succeeded
Sample requires a screenshot .png in assets folder ✅ Succeeded
No .sppkg file ✅ Succeeded
No node_modules folder ✅ Succeeded
No lib folder ✅ Succeeded

@jtlivio please address the above issues and push new changes to this branch.
For more information, see the contribution guidance.

@jtlivio
Copy link
Contributor Author

jtlivio commented May 8, 2025

Hi,

I have addressed the following issues raised during the validation of the pull request:

README.md:

Added a visitor stat image to comply with the requirements.

.nvmrc file:

Created the .nvmrc file to specify the Node.js version required for this project.

.sppkg file:

No .sppkg file was needed as the solution is not packaged for SharePoint deployment yet. This is an optional step depending on the distribution method.

Additionally, I’ve updated the README.md to clarify the setup instructions and included any missing details.

Please let me know if there are any other issues to address.

Best regards,
João LIVIO

Copy link

github-actions bot commented May 8, 2025

Sample PR validation for #5473

⚠️ Validation status: warnings

We automatically validate all pull requests against our contribution guidance to ensure that all samples provide a consistent experience to our community.

In order to merge this PR in a timely manner, the following criteria must be met:

Validation Status
Pull request affects only one folder ✅ Succeeded
Sample folder name follows naming convention ✅ Succeeded
README.md contains visitor stat image ⚠️ Warning
Sample requires a .nvmrc file ✅ Succeeded
Sample requires a README.md ✅ Succeeded
Sample requires a screenshot .png in assets folder ✅ Succeeded
No .sppkg file ✅ Succeeded
No node_modules folder ✅ Succeeded
No lib folder ✅ Succeeded

@jtlivio please address the above issues and push new changes to this branch.
For more information, see the contribution guidance.

Copy link

github-actions bot commented May 8, 2025

Sample PR validation for #5473

⚠️ Validation status: warnings

We automatically validate all pull requests against our contribution guidance to ensure that all samples provide a consistent experience to our community.

In order to merge this PR in a timely manner, the following criteria must be met:

Validation Status
Pull request affects only one folder ✅ Succeeded
Sample folder name follows naming convention ✅ Succeeded
README.md contains visitor stat image ⚠️ Warning
Sample requires a .nvmrc file ✅ Succeeded
Sample requires a README.md ✅ Succeeded
Sample requires a screenshot .png in assets folder ✅ Succeeded
No .sppkg file ✅ Succeeded
No node_modules folder ✅ Succeeded
No lib folder ✅ Succeeded

@jtlivio please address the above issues and push new changes to this branch.
For more information, see the contribution guidance.

Copy link

github-actions bot commented May 8, 2025

Sample PR validation for #5473

⚠️ Validation status: warnings

We automatically validate all pull requests against our contribution guidance to ensure that all samples provide a consistent experience to our community.

In order to merge this PR in a timely manner, the following criteria must be met:

Validation Status
Pull request affects only one folder ✅ Succeeded
Sample folder name follows naming convention ✅ Succeeded
README.md contains visitor stat image ⚠️ Warning
Sample requires a .nvmrc file ✅ Succeeded
Sample requires a README.md ✅ Succeeded
Sample requires a screenshot .png in assets folder ✅ Succeeded
No .sppkg file ✅ Succeeded
No node_modules folder ✅ Succeeded
No lib folder ✅ Succeeded

@jtlivio please address the above issues and push new changes to this branch.
For more information, see the contribution guidance.

Copy link

github-actions bot commented May 8, 2025

Sample PR validation for #5473

⚠️ Validation status: warnings

We automatically validate all pull requests against our contribution guidance to ensure that all samples provide a consistent experience to our community.

In order to merge this PR in a timely manner, the following criteria must be met:

Validation Status
Pull request affects only one folder ✅ Succeeded
Sample folder name follows naming convention ✅ Succeeded
README.md contains visitor stat image ⚠️ Warning
Sample requires a .nvmrc file ✅ Succeeded
Sample requires a README.md ✅ Succeeded
Sample requires a screenshot .png in assets folder ✅ Succeeded
No .sppkg file ✅ Succeeded
No node_modules folder ✅ Succeeded
No lib folder ✅ Succeeded

@jtlivio please address the above issues and push new changes to this branch.
For more information, see the contribution guidance.

Copy link

Sample PR validation for #5473

✅ Validation status: success

We automatically validate all pull requests against our contribution guidance to ensure that all samples provide a consistent experience to our community.

In order to merge this PR in a timely manner, the following criteria must be met:

Validation Status
Pull request affects only one folder ✅ Succeeded
Sample folder name follows naming convention ✅ Succeeded
README.md contains visitor stat image ✅ Succeeded
Sample requires a .nvmrc file ✅ Succeeded
Sample requires a README.md ✅ Succeeded
Sample requires a screenshot .png in assets folder ✅ Succeeded
No .sppkg file ✅ Succeeded
No node_modules folder ✅ Succeeded
No lib folder ✅ Succeeded

@hugoabernier hugoabernier merged commit d261924 into pnp:main May 16, 2025
4 checks passed
@hugoabernier
Copy link
Collaborator

Thank you @jtlivio for your sample! Much appreciated!

We'd love to have your sample featured in one of our future community calls.

If haven't done so yet, and you'd be interested on showing this great sample in a public community call, please fill in following form and we'll get you scheduled - aka.ms/community/request/demo

Thank you for sharing your sample with others - you rock! 👏🥇👩‍💻

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.

2 participants