|
| 1 | +# Carbon Footprint Calculator |
| 2 | + |
| 3 | +## Summary |
| 4 | + |
| 5 | +This SharePoint Framework (SPFx) web part provides users with an interactive calculator to estimate their monthly carbon footprint. |
| 6 | + |
| 7 | +It helps users visualize their CO₂ emissions through intuitive inputs such as electricity usage, transportation habits, and more. |
| 8 | + |
| 9 | +The solution uses **React**, **Fluent UI**, and **Chart.js** for dynamic charts, and supports exporting results to **PDF**. |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +## Compatibility |
| 14 | + |
| 15 | +| :warning: Important | |
| 16 | +|:---------------------------| |
| 17 | +| Every SPFx version is optimally compatible with specific versions of Node.js. In order to be able to build this sample, you need to ensure that the version of Node on your workstation matches one of the versions listed in this section. This sample will not work on a different version of Node.| |
| 18 | +|Refer to <https://aka.ms/spfx-matrix> for more information on SPFx compatibility. | |
| 19 | + |
| 20 | +This sample is optimally compatible with the following environment configuration: |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +-Incompatible-red.svg "SharePoint Server 2016 Feature Pack 2 requires SPFx 1.1") |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | +## Applies to |
| 33 | + |
| 34 | +* [SharePoint Framework](https://aka.ms/spfx) |
| 35 | +* [Microsoft 365 tenant](https://learn.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant) |
| 36 | + |
| 37 | +> Get your own free development tenant by subscribing to the [Microsoft 365 developer program](https://aka.ms/o365devprogram) |
| 38 | +
|
| 39 | +## Prerequisites |
| 40 | + |
| 41 | +* Node.js LTS (v18.x recommended) |
| 42 | +* npm package manager |
| 43 | +* SharePoint Online tenant for testing |
| 44 | + |
| 45 | +## Contributors |
| 46 | + |
| 47 | +* [João LIVIO](https://github.com/jtlivio) |
| 48 | + |
| 49 | +## Version History |
| 50 | + |
| 51 | +| Version | Date | Comments | |
| 52 | +| ------- | ----------- | ------------------------------ | |
| 53 | +| 1.1 | May 8, 2025 | Added PDF export functionality | |
| 54 | +| 1.0 | May 8, 2025 | Initial release | |
| 55 | + |
| 56 | + |
| 57 | + |
| 58 | +## Minimal Path to Awesome |
| 59 | + |
| 60 | +To test this solution in your environment: |
| 61 | + |
| 62 | +```bash |
| 63 | +npm install |
| 64 | +gulp serve |
| 65 | +``` |
| 66 | + |
| 67 | +> Open SharePoint Online Workbench to load the web part. |
| 68 | +
|
| 69 | +## Features |
| 70 | + |
| 71 | +This SPFx web part demonstrates the following features: |
| 72 | + |
| 73 | +* Interactive sliders for real-time emissions calculation |
| 74 | +* Dynamic chart visualization of carbon footprint |
| 75 | +* Sustainable threshold indicators (green, yellow, red) |
| 76 | +* PDF export capability for sharing results |
| 77 | +* Tips for reducing carbon footprint |
| 78 | + |
| 79 | +## References |
| 80 | + |
| 81 | +* [Getting started with SharePoint Framework](https://learn.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant) |
| 82 | +* [Building solutions for Microsoft Teams](https://learn.microsoft.com/en-us/sharepoint/dev/spfx/build-for-teams-overview) |
| 83 | +* [Using Microsoft Graph in SPFx solutions](https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis) |
| 84 | +* [Publishing SPFx applications to Marketplace](https://learn.microsoft.com/en-us/sharepoint/dev/spfx/publish-to-marketplace-overview) |
| 85 | +* [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp) – Community-driven guidance, samples, and open-source tools |
| 86 | + |
| 87 | +## Help |
| 88 | + |
| 89 | +We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues. |
| 90 | + |
| 91 | +If you're having issues building the solution, please run [spfx doctor](https://pnp.github.io/cli-microsoft365/cmd/spfx/spfx-doctor/) from within the solution folder to diagnose incompatibility issues with your environment. |
| 92 | + |
| 93 | +You can try looking at [issues related to this sample](https://github.com/pnp/sp-dev-fx-webparts/issues?q=label%3A%22sample%3A%20react-carbon-footprint-calculator%22) to see if anybody else is having the same issues. |
| 94 | + |
| 95 | +You can also try looking at [discussions related to this sample](https://github.com/pnp/sp-dev-fx-webparts/discussions?discussions_q=react-carbon-footprint-calculator) and see what the community is saying. |
| 96 | + |
| 97 | +If you encounter any issues using this sample, [create a new issue](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected%2Csample%3A%20react-carbon-footprint-calculator&template=bug-report.yml&sample=react-carbon-footprint-calculator&authors=@jtlivio&title=react-carbon-footprint-calculator%20-%20). |
| 98 | + |
| 99 | +For questions regarding this sample, [create a new question](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aquestion%2Csample%3A%20react-carbon-footprint-calculator&template=question.yml&sample=react-carbon-footprint-calculator&authors=@jtlivio&title=react-carbon-footprint-calculator%20-%20). |
| 100 | + |
| 101 | +Finally, if you have an idea for improvement, [make a suggestion](https://github.com/pnp/sp-dev-fx-webparts/issues/new?assignees=&labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Aenhancement%2Csample%3A%20react-carbon-footprint-calculator&template=suggestion.yml&sample=react-carbon-footprint-calculator&authors=@jtlivio&title=react-carbon-footprint-calculator%20-%20). |
| 102 | + |
| 103 | +## Disclaimer |
| 104 | + |
| 105 | +**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** |
| 106 | +<img src="https://m365-visitor-stats.azurewebsites.net/sp-dev-fx-webparts/samples/react-carbon-footprint-calculator" /> |
| 107 | + |
0 commit comments