@aclymatepackages/modules 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/babel.config.json +18 -0
- package/dist/components/CompaniesAutocomplete.js +126 -0
- package/dist/components/CompanyOnboardingInput.js +116 -0
- package/dist/components/ComparisonChart.js +200 -0
- package/dist/components/CustomTooltipDisplayRow.js +59 -0
- package/dist/components/EmissionsChart.js +467 -0
- package/dist/components/EmissionsCustomTooltip.js +181 -0
- package/dist/components/EmissionsPieChart.js +130 -0
- package/dist/components/EmissionsReductionGraph.js +118 -0
- package/dist/components/FootprintEquivalencies.js +181 -0
- package/dist/components/FootprintVideo.js +262 -0
- package/dist/components/FuelTypesSelect.js +36 -0
- package/dist/components/IndustryAutocomplete.js +58 -0
- package/dist/components/PlacesAutocomplete.js +173 -0
- package/dist/components/StripeElements.js +95 -0
- package/dist/components/YesNoQuestion.js +88 -0
- package/dist/components/stripeInput.js +293 -0
- package/dist/components/useChartWarningLabels.js +143 -0
- package/dist/index.js +118 -0
- package/package.json +74 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/src/components/CompaniesAutocomplete.js +125 -0
- package/src/components/CompanyOnboardingInput.js +113 -0
- package/src/components/ComparisonChart.js +236 -0
- package/src/components/CustomTooltipDisplayRow.js +41 -0
- package/src/components/EmissionsChart.js +579 -0
- package/src/components/EmissionsCustomTooltip.js +146 -0
- package/src/components/EmissionsPieChart.js +120 -0
- package/src/components/EmissionsReductionGraph.js +107 -0
- package/src/components/FootprintEquivalencies.js +203 -0
- package/src/components/FootprintVideo.js +328 -0
- package/src/components/FuelTypesSelect.js +29 -0
- package/src/components/IndustryAutocomplete.js +56 -0
- package/src/components/PlacesAutocomplete.js +174 -0
- package/src/components/StripeElements.js +95 -0
- package/src/components/YesNoQuestion.js +68 -0
- package/src/components/stripeInput.js +288 -0
- package/src/components/useChartWarningLabels.js +139 -0
- package/src/index.js +35 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.symbol.description.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _recharts = require("recharts");
|
|
11
|
+
var _material = require("@mui/material");
|
|
12
|
+
var _atoms = require("@aclymatepackages/atoms");
|
|
13
|
+
var _formatters = require("@aclymatepackages/formatters");
|
|
14
|
+
var _otherHelpers = require("@aclymatepackages/other-helpers");
|
|
15
|
+
var _subcategories = require("@aclymatepackages/subcategories");
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
21
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
22
|
+
const PieChartCustomTooltip = _ref => {
|
|
23
|
+
let {
|
|
24
|
+
payload: passedPayload
|
|
25
|
+
} = _ref;
|
|
26
|
+
const [payloadObj] = passedPayload;
|
|
27
|
+
const {
|
|
28
|
+
payload = {}
|
|
29
|
+
} = payloadObj || [{}];
|
|
30
|
+
const {
|
|
31
|
+
name,
|
|
32
|
+
emissionPercentage,
|
|
33
|
+
color,
|
|
34
|
+
icon,
|
|
35
|
+
Icon
|
|
36
|
+
} = payload;
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_atoms.DefaultPaper, null, /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
38
|
+
container: true,
|
|
39
|
+
spacing: 2,
|
|
40
|
+
alignItems: "center"
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
42
|
+
item: true
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Avatar, {
|
|
44
|
+
style: {
|
|
45
|
+
backgroundColor: color,
|
|
46
|
+
color: "white"
|
|
47
|
+
}
|
|
48
|
+
}, icon, Icon && /*#__PURE__*/_react.default.createElement(Icon, {
|
|
49
|
+
style: {
|
|
50
|
+
color: "inherit"
|
|
51
|
+
}
|
|
52
|
+
}))), /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
53
|
+
item: true
|
|
54
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
55
|
+
variant: "subtitle1",
|
|
56
|
+
color: "textPrimary"
|
|
57
|
+
}, name), /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
58
|
+
variant: "caption",
|
|
59
|
+
color: "textSecondary"
|
|
60
|
+
}, "".concat((0, _formatters.formatDecimal)(emissionPercentage), "% of total emissions")))));
|
|
61
|
+
};
|
|
62
|
+
const EmissionsPieChart = _ref2 => {
|
|
63
|
+
let {
|
|
64
|
+
dataArray: emissions,
|
|
65
|
+
viewMode = "subcategories",
|
|
66
|
+
pieChartRef
|
|
67
|
+
} = _ref2;
|
|
68
|
+
const subcategoriesArray = (0, _subcategories.buildSubcategoriesArray)(emissions);
|
|
69
|
+
const scopesArray = (0, _subcategories.buildScopesArray)();
|
|
70
|
+
const emissionsSum = (0, _otherHelpers.sumTonsCo2e)(emissions);
|
|
71
|
+
const formatChartPieSlices = () => {
|
|
72
|
+
const filterFunction = subcategory => emission => {
|
|
73
|
+
if (viewMode === "subcategories") {
|
|
74
|
+
return emission.subcategory === subcategory;
|
|
75
|
+
}
|
|
76
|
+
const scopeNumber = Number(subcategory.charAt(subcategory.length - 1));
|
|
77
|
+
return emission.scope === scopeNumber;
|
|
78
|
+
};
|
|
79
|
+
const slicesArray = viewMode === "subcategories" ? subcategoriesArray : scopesArray;
|
|
80
|
+
const unProjectedSlices = slicesArray.filter(_ref3 => {
|
|
81
|
+
let {
|
|
82
|
+
subcategory
|
|
83
|
+
} = _ref3;
|
|
84
|
+
const projectedStringArray = subcategory.split("_");
|
|
85
|
+
return projectedStringArray.length === 1;
|
|
86
|
+
});
|
|
87
|
+
return unProjectedSlices.map(subcategoryObj => {
|
|
88
|
+
const {
|
|
89
|
+
subcategory
|
|
90
|
+
} = subcategoryObj;
|
|
91
|
+
const emissionsWithThisCategory = emissions.filter(filterFunction(subcategory));
|
|
92
|
+
const categoryEmissionsSum = (0, _otherHelpers.sumTonsCo2e)(emissionsWithThisCategory);
|
|
93
|
+
return _objectSpread(_objectSpread({}, subcategoryObj), {}, {
|
|
94
|
+
emissionPercentage: categoryEmissionsSum / emissionsSum * 100
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
const pieSlicesWithPercentages = formatChartPieSlices();
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
|
|
100
|
+
height: "100%",
|
|
101
|
+
aspect: 1.5
|
|
102
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.PieChart, {
|
|
103
|
+
ref: pieChartRef
|
|
104
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.Pie, {
|
|
105
|
+
data: pieSlicesWithPercentages,
|
|
106
|
+
outerRadius: "100%",
|
|
107
|
+
fill: "#8884d8",
|
|
108
|
+
dataKey: "emissionPercentage",
|
|
109
|
+
cx: "50%",
|
|
110
|
+
cy: "50%"
|
|
111
|
+
}, pieSlicesWithPercentages.map(_ref4 => {
|
|
112
|
+
let {
|
|
113
|
+
category,
|
|
114
|
+
name,
|
|
115
|
+
color
|
|
116
|
+
} = _ref4;
|
|
117
|
+
return /*#__PURE__*/_react.default.createElement(_recharts.Cell, {
|
|
118
|
+
key: "emissions-pie-chart-cell-".concat(category),
|
|
119
|
+
name: name,
|
|
120
|
+
fill: color
|
|
121
|
+
});
|
|
122
|
+
})), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
|
|
123
|
+
wrapperStyle: {
|
|
124
|
+
zIndex: 99
|
|
125
|
+
},
|
|
126
|
+
content: /*#__PURE__*/_react.default.createElement(PieChartCustomTooltip, null)
|
|
127
|
+
})));
|
|
128
|
+
};
|
|
129
|
+
var _default = EmissionsPieChart;
|
|
130
|
+
exports.default = _default;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("core-js/modules/es.number.to-fixed.js");
|
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _material = require("@mui/material");
|
|
11
|
+
var _styles = require("@mui/styles");
|
|
12
|
+
var _recharts = require("recharts");
|
|
13
|
+
var _otherHelpers = require("@aclymatepackages/other-helpers");
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
const CustomTooltip = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
active,
|
|
18
|
+
payload,
|
|
19
|
+
label
|
|
20
|
+
} = _ref;
|
|
21
|
+
if (active && payload && payload.length) {
|
|
22
|
+
const {
|
|
23
|
+
remainingAmount
|
|
24
|
+
} = payload[0].payload;
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
26
|
+
style: {
|
|
27
|
+
background: "#fff",
|
|
28
|
+
border: "1px solid #ccc",
|
|
29
|
+
padding: "10px",
|
|
30
|
+
borderRadius: "5px",
|
|
31
|
+
boxShadow: "0 2px 5px rgba(0, 0, 0, 0.3)",
|
|
32
|
+
fontSize: "14px"
|
|
33
|
+
}
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
35
|
+
variant: "body2",
|
|
36
|
+
style: {
|
|
37
|
+
marginBottom: "5px",
|
|
38
|
+
fontWeight: "bold"
|
|
39
|
+
}
|
|
40
|
+
}, "Year: ", label), /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
41
|
+
variant: "body2",
|
|
42
|
+
style: {
|
|
43
|
+
marginBottom: "5px"
|
|
44
|
+
}
|
|
45
|
+
}, "Remaining Amount: ", remainingAmount.toFixed(2)));
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
49
|
+
const EmissionsReductionGraph = _ref2 => {
|
|
50
|
+
let {
|
|
51
|
+
initialEmissionAmount = 100,
|
|
52
|
+
desiredReductionPercentage = 0.5,
|
|
53
|
+
targetYear = 2030,
|
|
54
|
+
startYear = new Date().getFullYear(),
|
|
55
|
+
lineColor = null,
|
|
56
|
+
width = "100%",
|
|
57
|
+
height = 450,
|
|
58
|
+
carbonUnit = "lbs"
|
|
59
|
+
} = _ref2;
|
|
60
|
+
const {
|
|
61
|
+
palette
|
|
62
|
+
} = (0, _styles.useTheme)();
|
|
63
|
+
const totalYears = targetYear - startYear;
|
|
64
|
+
const buildDecayLineArray = () => {
|
|
65
|
+
const decayRate = (0, _otherHelpers.calculateEmissionsDecayRate)(desiredReductionPercentage, totalYears);
|
|
66
|
+
return [...new Array(totalYears + 1)].map((_, idx) => ({
|
|
67
|
+
year: startYear + idx,
|
|
68
|
+
remainingAmount: initialEmissionAmount * Math.exp(decayRate * idx),
|
|
69
|
+
decayRate
|
|
70
|
+
}));
|
|
71
|
+
};
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
|
|
73
|
+
width: width,
|
|
74
|
+
height: height
|
|
75
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.LineChart, {
|
|
76
|
+
data: buildDecayLineArray(),
|
|
77
|
+
margin: {
|
|
78
|
+
top: 20,
|
|
79
|
+
right: 30,
|
|
80
|
+
left: 10,
|
|
81
|
+
bottom: 10
|
|
82
|
+
}
|
|
83
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.CartesianGrid, {
|
|
84
|
+
strokeDasharray: "3 3",
|
|
85
|
+
stroke: "#bbb"
|
|
86
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.XAxis, {
|
|
87
|
+
dataKey: "year",
|
|
88
|
+
stroke: "#333",
|
|
89
|
+
tick: {
|
|
90
|
+
fill: "#333",
|
|
91
|
+
fontSize: 12
|
|
92
|
+
}
|
|
93
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.YAxis, {
|
|
94
|
+
tickFormatter: value => "".concat(value, " ").concat(carbonUnit),
|
|
95
|
+
stroke: "#333",
|
|
96
|
+
tick: {
|
|
97
|
+
fill: "#333",
|
|
98
|
+
fontSize: 12
|
|
99
|
+
}
|
|
100
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
|
|
101
|
+
content: /*#__PURE__*/_react.default.createElement(CustomTooltip, null)
|
|
102
|
+
}), /*#__PURE__*/_react.default.createElement(_recharts.Line, {
|
|
103
|
+
type: "monotone",
|
|
104
|
+
dataKey: "remainingAmount",
|
|
105
|
+
stroke: lineColor || palette.error.main,
|
|
106
|
+
strokeWidth: 2,
|
|
107
|
+
dot: {
|
|
108
|
+
stroke: lineColor || palette.error.main,
|
|
109
|
+
strokeWidth: 2,
|
|
110
|
+
r: 6
|
|
111
|
+
},
|
|
112
|
+
activeDot: {
|
|
113
|
+
r: 8
|
|
114
|
+
}
|
|
115
|
+
})));
|
|
116
|
+
};
|
|
117
|
+
var _default = EmissionsReductionGraph;
|
|
118
|
+
exports.default = _default;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.weak-map.js");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
require("core-js/modules/es.number.to-fixed.js");
|
|
9
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
10
|
+
require("core-js/modules/es.array.includes.js");
|
|
11
|
+
require("core-js/modules/es.string.includes.js");
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _material = require("@mui/material");
|
|
14
|
+
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _reactFontawesome = require("@fortawesome/react-fontawesome");
|
|
16
|
+
var _proSolidSvgIcons = require("@fortawesome/pro-solid-svg-icons");
|
|
17
|
+
var _converters = require("@aclymatepackages/converters");
|
|
18
|
+
var _formatters = require("@aclymatepackages/formatters");
|
|
19
|
+
var _themes = require("@aclymatepackages/themes");
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
|
+
//source: Google Drive: Aclymate Team\Climate Accounting\Data\Tree Carbon Calculator\CarbonCalculator31.xls
|
|
23
|
+
const convertFootprintToTreeYears = footprintTons => {
|
|
24
|
+
const treeYearsDecimal = footprintTons / (0, _converters.kgsToTons)(160.6);
|
|
25
|
+
return (0, _formatters.formatDecimal)(treeYearsDecimal.toFixed(1));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//source: https://shrinkthatfootprint.com/carbon-targets-for-your-footprint/
|
|
29
|
+
const footprintToCarbonBudgetPercent = footprintTons => "".concat((0, _formatters.formatDecimal)(footprintTons / 4.1 * 100), "%");
|
|
30
|
+
|
|
31
|
+
//SOURCE: https://news.energysage.com/how-many-watts-does-a-phone-charger-use/
|
|
32
|
+
//US average carbon intensity comes from carbon intensity data in app backend
|
|
33
|
+
const footprintToCellphoneYears = footprintTons => {
|
|
34
|
+
const US_AVG_TONS_CO2E_PER_KWH = 0.00043222913699413057;
|
|
35
|
+
const CELLPHONE_KWH_PER_YEAR = 1.83;
|
|
36
|
+
const footprintYears = footprintTons / US_AVG_TONS_CO2E_PER_KWH / CELLPHONE_KWH_PER_YEAR;
|
|
37
|
+
return (0, _formatters.formatDecimal)(footprintYears.toFixed(1));
|
|
38
|
+
};
|
|
39
|
+
const FootprintEquivalencies = _ref => {
|
|
40
|
+
let {
|
|
41
|
+
footprintTons,
|
|
42
|
+
exclusionCategories = []
|
|
43
|
+
} = _ref;
|
|
44
|
+
const {
|
|
45
|
+
theme,
|
|
46
|
+
isMobile,
|
|
47
|
+
isMedium
|
|
48
|
+
} = (0, _themes.useLayoutHelpers)();
|
|
49
|
+
const [selectedCategoryIdx, setSelectedCategoryIdx] = (0, _react.useState)(0);
|
|
50
|
+
const footprintEquivalentsCategories = [{
|
|
51
|
+
type: "driving-emissions",
|
|
52
|
+
icon: _proSolidSvgIcons.faSteeringWheel,
|
|
53
|
+
buildString: (carbon, equivalency) => "Your ".concat(carbon, " lbs. of carbon is like driving a car ").concat(equivalency, " miles."),
|
|
54
|
+
equivalency: (0, _converters.convertFootprintToDriving)(footprintTons),
|
|
55
|
+
color: "vehicles",
|
|
56
|
+
backgroundOpacity: 0.5
|
|
57
|
+
}, {
|
|
58
|
+
type: "tree-sequestration",
|
|
59
|
+
icon: _proSolidSvgIcons.faTrees,
|
|
60
|
+
buildString: (carbon, equivalency) => "It would take an average oak tree ".concat(equivalency, " years to absorb your ").concat(carbon, " lbs. of carbon"),
|
|
61
|
+
equivalency: convertFootprintToTreeYears(footprintTons),
|
|
62
|
+
color: "secondary",
|
|
63
|
+
backgroundOpacity: 0.3
|
|
64
|
+
}, {
|
|
65
|
+
type: "melting-polar-bear",
|
|
66
|
+
icon: _proSolidSvgIcons.faIcicles,
|
|
67
|
+
buildString: (carbon, equivalency) => "Your ".concat(carbon, " lbs. of carbon is enough to permanently melt ").concat(equivalency, " square ").concat(equivalency === "1" ? "foot" : "feet", " of Arctic sea ice"),
|
|
68
|
+
equivalency: (0, _formatters.formatDecimal)((0, _converters.convertFootprintToIce)(footprintTons)),
|
|
69
|
+
color: "travel",
|
|
70
|
+
backgroundOpacity: 0.3
|
|
71
|
+
}, {
|
|
72
|
+
type: "eating-hamburgers",
|
|
73
|
+
icon: _proSolidSvgIcons.faHamburger,
|
|
74
|
+
buildString: (carbon, equivalency) => "Your ".concat(carbon, " lbs. of carbon is equivalent to the emissions of eating ").concat(equivalency, " hamburgers"),
|
|
75
|
+
equivalency: (0, _formatters.formatDecimal)((0, _converters.footprintToHamburgers)(footprintTons)),
|
|
76
|
+
color: "mileage",
|
|
77
|
+
backgroundOpacity: 0.4
|
|
78
|
+
}, {
|
|
79
|
+
type: "carbon-budget",
|
|
80
|
+
icon: _proSolidSvgIcons.faPiggyBank,
|
|
81
|
+
buildString: (carbon, equivalency) => "Your ".concat(carbon, " lbs. of carbon is ").concat(equivalency, " of the annual carbon budget that we all need to achieve to reach our global climate goals."),
|
|
82
|
+
equivalency: footprintToCarbonBudgetPercent(footprintTons),
|
|
83
|
+
color: "offices",
|
|
84
|
+
backgroundOpacity: 0.5
|
|
85
|
+
}, {
|
|
86
|
+
type: "cell-phone-charging",
|
|
87
|
+
icon: _proSolidSvgIcons.faMobile,
|
|
88
|
+
buildString: (carbon, equivalency) => "Your ".concat(carbon, " lbs. of carbon is enough to keep your cellphone charged for ").concat(equivalency, " years"),
|
|
89
|
+
equivalency: footprintToCellphoneYears(footprintTons),
|
|
90
|
+
color: "rides",
|
|
91
|
+
backgroundOpacity: 0.5
|
|
92
|
+
}];
|
|
93
|
+
const filteredEquivalentCategories = footprintEquivalentsCategories.filter(_ref2 => {
|
|
94
|
+
let {
|
|
95
|
+
type
|
|
96
|
+
} = _ref2;
|
|
97
|
+
return !exclusionCategories.includes(type);
|
|
98
|
+
});
|
|
99
|
+
const {
|
|
100
|
+
type,
|
|
101
|
+
color,
|
|
102
|
+
buildString,
|
|
103
|
+
equivalency
|
|
104
|
+
} = filteredEquivalentCategories[selectedCategoryIdx];
|
|
105
|
+
return /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
106
|
+
container: true,
|
|
107
|
+
spacing: 2,
|
|
108
|
+
alignItems: "stretch",
|
|
109
|
+
justifyContent: "center"
|
|
110
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
111
|
+
item: true,
|
|
112
|
+
lg: 2,
|
|
113
|
+
xs: 12
|
|
114
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
115
|
+
container: true,
|
|
116
|
+
direction: isMedium ? "row" : "column",
|
|
117
|
+
spacing: 2,
|
|
118
|
+
justifyContent: isMedium ? "space-around" : "center",
|
|
119
|
+
wrap: "nowrap"
|
|
120
|
+
}, filteredEquivalentCategories.map((_ref3, idx) => {
|
|
121
|
+
let {
|
|
122
|
+
icon,
|
|
123
|
+
color
|
|
124
|
+
} = _ref3;
|
|
125
|
+
return /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
126
|
+
item: true,
|
|
127
|
+
key: "grid-equivalency-carousel-icon-".concat(idx)
|
|
128
|
+
}, /*#__PURE__*/_react.default.createElement(_material.ButtonBase, {
|
|
129
|
+
onClick: () => setSelectedCategoryIdx(idx)
|
|
130
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
131
|
+
style: {
|
|
132
|
+
height: "50px",
|
|
133
|
+
width: "50px",
|
|
134
|
+
backgroundColor: idx === selectedCategoryIdx ? theme.palette[color].main : "white",
|
|
135
|
+
borderRadius: "50%"
|
|
136
|
+
},
|
|
137
|
+
display: "flex",
|
|
138
|
+
alignItems: "center",
|
|
139
|
+
justifyContent: "center"
|
|
140
|
+
}, /*#__PURE__*/_react.default.createElement(_reactFontawesome.FontAwesomeIcon, {
|
|
141
|
+
icon: icon,
|
|
142
|
+
size: "2x",
|
|
143
|
+
style: {
|
|
144
|
+
color: idx === selectedCategoryIdx ? "white" : theme.palette[color].main
|
|
145
|
+
}
|
|
146
|
+
}))));
|
|
147
|
+
}))), /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
148
|
+
item: true,
|
|
149
|
+
lg: 6,
|
|
150
|
+
xs: 12
|
|
151
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
152
|
+
display: "flex",
|
|
153
|
+
justifyContent: "center"
|
|
154
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
155
|
+
position: "relative"
|
|
156
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
157
|
+
alt: "".concat(type, "-image"),
|
|
158
|
+
src: "https://dashboard.aclymate.com/images/footprint-equivalencies/".concat(type, ".svg"),
|
|
159
|
+
style: {
|
|
160
|
+
width: "100%"
|
|
161
|
+
}
|
|
162
|
+
}), /*#__PURE__*/_react.default.createElement(_material.Paper, {
|
|
163
|
+
style: {
|
|
164
|
+
backgroundColor: (0, _converters.hexToRgba)(theme.palette[color].main, 0.85),
|
|
165
|
+
position: "absolute",
|
|
166
|
+
bottom: 0,
|
|
167
|
+
left: 0,
|
|
168
|
+
right: 0
|
|
169
|
+
}
|
|
170
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
171
|
+
p: isMobile ? 0.25 : 1
|
|
172
|
+
}, /*#__PURE__*/_react.default.createElement(_styles.ThemeProvider, {
|
|
173
|
+
theme: _themes.mergeDarkTheme
|
|
174
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
175
|
+
variant: isMobile ? "subtitle2" : "subtitle1",
|
|
176
|
+
align: "center",
|
|
177
|
+
color: "textPrimary"
|
|
178
|
+
}, buildString((0, _formatters.formatDecimal)((0, _converters.tonsToLbs)(footprintTons)), equivalency)))))))));
|
|
179
|
+
};
|
|
180
|
+
var _default = FootprintEquivalencies;
|
|
181
|
+
exports.default = _default;
|