@aclymatepackages/modules 1.0.3 → 1.0.5
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/dist/components/EmissionsSummarySentence.js +21 -0
- package/dist/components/EmissionsSummaryTable.js +52 -0
- package/dist/components/ReportContentTitle.js +18 -0
- package/dist/components/ReportGraphContentLayout.js +59 -0
- package/dist/components/SummaryBlock.js +41 -0
- package/dist/index.js +28 -0
- package/package.json +3 -2
- package/src/components/EmissionsSummarySentence.js +12 -0
- package/src/components/EmissionsSummaryTable.js +75 -0
- package/src/components/ReportContentTitle.js +8 -0
- package/src/components/ReportGraphContentLayout.js +48 -0
- package/src/components/SummaryBlock.js +37 -0
- package/src/index.js +8 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _formatters = require("@aclymatepackages/formatters");
|
|
9
|
+
var _otherHelpers = require("@aclymatepackages/other-helpers");
|
|
10
|
+
var _material = require("@mui/material");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
const EmissionsSummarySentence = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
label,
|
|
15
|
+
emissions
|
|
16
|
+
} = _ref;
|
|
17
|
+
return /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
18
|
+
variant: "body2"
|
|
19
|
+
}, label, ": ", (0, _formatters.formatDecimal)((0, _otherHelpers.sumTonsCo2e)(emissions)), " tons CO2e");
|
|
20
|
+
};
|
|
21
|
+
var _default = exports.default = EmissionsSummarySentence;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _chartHelpers = require("@aclymatepackages/chart-helpers");
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
const SummaryTableRow = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
name,
|
|
15
|
+
data
|
|
16
|
+
} = _ref;
|
|
17
|
+
return /*#__PURE__*/_react.default.createElement(_material.TableRow, null, /*#__PURE__*/_react.default.createElement(_material.TableCell, null, name), data.map((value, idx) => /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
18
|
+
key: "table-row-cell-".concat(idx)
|
|
19
|
+
}, value)));
|
|
20
|
+
};
|
|
21
|
+
const EmissionsSummaryTable = _ref2 => {
|
|
22
|
+
let {
|
|
23
|
+
emissions,
|
|
24
|
+
rows,
|
|
25
|
+
interval,
|
|
26
|
+
blockTitle,
|
|
27
|
+
tableTitle = "",
|
|
28
|
+
rowType,
|
|
29
|
+
startDate
|
|
30
|
+
} = _ref2;
|
|
31
|
+
const {
|
|
32
|
+
groupedEmissions,
|
|
33
|
+
chartLabelsArray
|
|
34
|
+
} = (0, _chartHelpers.buildEmissionGroupData)(emissions, interval, startDate);
|
|
35
|
+
const summaryTableData = groupedEmissions.map(emission => rowType === "scopes" ? (0, _chartHelpers.buildScopesRealDataObj)(emission) : (0, _chartHelpers.buildSubcategoriesDataObj)(emission));
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_material.Box, null, /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
37
|
+
variant: "h6"
|
|
38
|
+
}, blockTitle), /*#__PURE__*/_react.default.createElement(_material.TableContainer, null, /*#__PURE__*/_react.default.createElement(_material.Table, null, /*#__PURE__*/_react.default.createElement(_material.TableHead, null, /*#__PURE__*/_react.default.createElement(_material.TableRow, null, [tableTitle, ...chartLabelsArray].map((label, idx) => /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
39
|
+
key: "table-head-cell-".concat(idx)
|
|
40
|
+
}, label)))), /*#__PURE__*/_react.default.createElement(_material.TableBody, null, rows.map((_ref3, idx) => {
|
|
41
|
+
let {
|
|
42
|
+
name,
|
|
43
|
+
subcategory
|
|
44
|
+
} = _ref3;
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement(SummaryTableRow, {
|
|
46
|
+
name: name,
|
|
47
|
+
data: summaryTableData.map(dataRow => dataRow[subcategory]),
|
|
48
|
+
key: "summary-table-row-".concat(idx)
|
|
49
|
+
});
|
|
50
|
+
})))));
|
|
51
|
+
};
|
|
52
|
+
var _default = exports.default = EmissionsSummaryTable;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _material = require("@mui/material");
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
const ReportContentTitle = _ref => {
|
|
11
|
+
let {
|
|
12
|
+
title
|
|
13
|
+
} = _ref;
|
|
14
|
+
return /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
15
|
+
variant: "subtitle1"
|
|
16
|
+
}, title);
|
|
17
|
+
};
|
|
18
|
+
var _default = exports.default = ReportContentTitle;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _material = require("@mui/material");
|
|
9
|
+
var _ReportContentTitle = _interopRequireDefault(require("./ReportContentTitle"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const ReportGraphContentLayout = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
EmissionsChart,
|
|
14
|
+
contentTitle,
|
|
15
|
+
contentRows = [],
|
|
16
|
+
chartType = "bar",
|
|
17
|
+
chartViewMode = "scopes",
|
|
18
|
+
emissions,
|
|
19
|
+
interval = "quarter",
|
|
20
|
+
isPercentageChart,
|
|
21
|
+
height
|
|
22
|
+
} = _ref;
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
24
|
+
p: 2,
|
|
25
|
+
style: {
|
|
26
|
+
height: height || "auto"
|
|
27
|
+
}
|
|
28
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
29
|
+
container: true,
|
|
30
|
+
spacing: 2
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
32
|
+
item: true,
|
|
33
|
+
sm: 4,
|
|
34
|
+
container: true,
|
|
35
|
+
direction: "column",
|
|
36
|
+
spacing: 2
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
38
|
+
item: true
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement(_ReportContentTitle.default, {
|
|
40
|
+
title: contentTitle
|
|
41
|
+
})), contentRows.map((row, idx) => /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
42
|
+
item: true,
|
|
43
|
+
key: "content-row-".concat(idx)
|
|
44
|
+
}, row))), /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
45
|
+
item: true,
|
|
46
|
+
sm: 8
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement(EmissionsChart, {
|
|
48
|
+
dataArray: emissions,
|
|
49
|
+
type: chartType,
|
|
50
|
+
viewMode: chartViewMode,
|
|
51
|
+
graphPeriod: interval,
|
|
52
|
+
displayUnit: "tons",
|
|
53
|
+
unitConverter: tons => tons,
|
|
54
|
+
aspect: 2,
|
|
55
|
+
isPercentageChart: isPercentageChart,
|
|
56
|
+
showTooltip: false
|
|
57
|
+
}))));
|
|
58
|
+
};
|
|
59
|
+
var _default = exports.default = ReportGraphContentLayout;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _EmissionsChart = require("./EmissionsChart");
|
|
9
|
+
var _emissionsCalcs = require("@aclymatepackages/emissions-calcs");
|
|
10
|
+
var _EmissionsPieChart = _interopRequireDefault(require("./EmissionsPieChart"));
|
|
11
|
+
var _ReportContentTitle = _interopRequireDefault(require("./ReportContentTitle"));
|
|
12
|
+
var _EmissionsSummarySentence = _interopRequireDefault(require("./EmissionsSummarySentence"));
|
|
13
|
+
var _ReportGraphContentLayout = _interopRequireDefault(require("./ReportGraphContentLayout"));
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
const SummaryBlock = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
emissions,
|
|
18
|
+
interval,
|
|
19
|
+
EmissionsChart
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement(_ReportGraphContentLayout.default, {
|
|
22
|
+
EmissionsChart: EmissionsChart || _EmissionsChart.EmissionsChart,
|
|
23
|
+
contentTitle: "Summary",
|
|
24
|
+
interval: interval,
|
|
25
|
+
emissions: emissions,
|
|
26
|
+
contentRows: [/*#__PURE__*/_react.default.createElement(_EmissionsPieChart.default, {
|
|
27
|
+
dataArray: emissions,
|
|
28
|
+
viewMode: "scopes"
|
|
29
|
+
}), /*#__PURE__*/_react.default.createElement(_ReportContentTitle.default, {
|
|
30
|
+
title: "Emissions Summary"
|
|
31
|
+
}), /*#__PURE__*/_react.default.createElement(_EmissionsSummarySentence.default, {
|
|
32
|
+
label: "Total Emissions",
|
|
33
|
+
emissions: emissions
|
|
34
|
+
}), [1, 2, 3].map((scope, idx) => /*#__PURE__*/_react.default.createElement(_EmissionsSummarySentence.default, {
|
|
35
|
+
key: "summary-sentence-".concat(idx),
|
|
36
|
+
label: "Total Scope ".concat(scope),
|
|
37
|
+
emissions: (0, _emissionsCalcs.filterEmissionsByScope)(emissions, scope)
|
|
38
|
+
}))]
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
var _default = exports.default = SummaryBlock;
|
package/dist/index.js
CHANGED
|
@@ -51,6 +51,18 @@ Object.defineProperty(exports, "EmissionsReductionGraph", {
|
|
|
51
51
|
return _EmissionsReductionGraph.default;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
+
Object.defineProperty(exports, "EmissionsSummarySentence", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function get() {
|
|
57
|
+
return _EmissionsSummarySentence.default;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "EmissionsSummaryTable", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function get() {
|
|
63
|
+
return _EmissionsSummaryTable.default;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
54
66
|
Object.defineProperty(exports, "FootprintEquivalencies", {
|
|
55
67
|
enumerable: true,
|
|
56
68
|
get: function get() {
|
|
@@ -75,12 +87,24 @@ Object.defineProperty(exports, "PlacesAutocomplete", {
|
|
|
75
87
|
return _PlacesAutocomplete.default;
|
|
76
88
|
}
|
|
77
89
|
});
|
|
90
|
+
Object.defineProperty(exports, "ReportContentTitle", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function get() {
|
|
93
|
+
return _ReportContentTitle.default;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
78
96
|
Object.defineProperty(exports, "StripeElements", {
|
|
79
97
|
enumerable: true,
|
|
80
98
|
get: function get() {
|
|
81
99
|
return _StripeElements.default;
|
|
82
100
|
}
|
|
83
101
|
});
|
|
102
|
+
Object.defineProperty(exports, "SummaryBlock", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function get() {
|
|
105
|
+
return _SummaryBlock.default;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
84
108
|
Object.defineProperty(exports, "YesNoQuestion", {
|
|
85
109
|
enumerable: true,
|
|
86
110
|
get: function get() {
|
|
@@ -115,4 +139,8 @@ var _EmissionsChart = _interopRequireDefault(require("./components/EmissionsChar
|
|
|
115
139
|
var _EmissionsCustomTooltip = _interopRequireDefault(require("./components/EmissionsCustomTooltip"));
|
|
116
140
|
var _EmissionsPieChart = _interopRequireDefault(require("./components/EmissionsPieChart"));
|
|
117
141
|
var _useChartWarningLabels = _interopRequireDefault(require("./components/useChartWarningLabels"));
|
|
142
|
+
var _EmissionsSummaryTable = _interopRequireDefault(require("./components/EmissionsSummaryTable"));
|
|
143
|
+
var _EmissionsSummarySentence = _interopRequireDefault(require("./components/EmissionsSummarySentence"));
|
|
144
|
+
var _ReportContentTitle = _interopRequireDefault(require("./components/ReportContentTitle"));
|
|
145
|
+
var _SummaryBlock = _interopRequireDefault(require("./components/SummaryBlock"));
|
|
118
146
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aclymatepackages/modules",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Aclymate modules",
|
|
5
5
|
"author": "William Loopesko",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@aclymatepackages/array-immutability-helpers": "^1.0.0",
|
|
9
9
|
"@aclymatepackages/atoms": "^1.0.0",
|
|
10
|
-
"@aclymatepackages/chart-helpers": "^1.0.
|
|
10
|
+
"@aclymatepackages/chart-helpers": "^1.0.3",
|
|
11
11
|
"@aclymatepackages/constants": "^1.0.0",
|
|
12
12
|
"@aclymatepackages/converters": "^1.0.0",
|
|
13
13
|
"@aclymatepackages/date-helpers": "^1.0.0",
|
|
14
|
+
"@aclymatepackages/emissions-calcs": "^1.1.1",
|
|
14
15
|
"@aclymatepackages/fetch-aclymate-api": "^1.0.0",
|
|
15
16
|
"@aclymatepackages/formatters": "^1.0.0",
|
|
16
17
|
"@aclymatepackages/lists": "^1.0.0",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { formatDecimal } from "@aclymatepackages/formatters";
|
|
3
|
+
import { sumTonsCo2e } from "@aclymatepackages/other-helpers";
|
|
4
|
+
import { Typography } from "@mui/material";
|
|
5
|
+
|
|
6
|
+
const EmissionsSummarySentence = ({ label, emissions }) => (
|
|
7
|
+
<Typography variant="body2">
|
|
8
|
+
{label}: {formatDecimal(sumTonsCo2e(emissions))} tons CO2e
|
|
9
|
+
</Typography>
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
export default EmissionsSummarySentence;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Table,
|
|
5
|
+
TableBody,
|
|
6
|
+
TableCell,
|
|
7
|
+
TableContainer,
|
|
8
|
+
TableHead,
|
|
9
|
+
TableRow,
|
|
10
|
+
Typography,
|
|
11
|
+
} from "@mui/material";
|
|
12
|
+
import {
|
|
13
|
+
buildScopesRealDataObj,
|
|
14
|
+
buildSubcategoriesDataObj,
|
|
15
|
+
buildEmissionGroupData,
|
|
16
|
+
} from "@aclymatepackages/chart-helpers";
|
|
17
|
+
|
|
18
|
+
const SummaryTableRow = ({ name, data }) => (
|
|
19
|
+
<TableRow>
|
|
20
|
+
<TableCell>{name}</TableCell>
|
|
21
|
+
{data.map((value, idx) => (
|
|
22
|
+
<TableCell key={`table-row-cell-${idx}`}>{value}</TableCell>
|
|
23
|
+
))}
|
|
24
|
+
</TableRow>
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const EmissionsSummaryTable = ({
|
|
28
|
+
emissions,
|
|
29
|
+
rows,
|
|
30
|
+
interval,
|
|
31
|
+
blockTitle,
|
|
32
|
+
tableTitle = "",
|
|
33
|
+
rowType,
|
|
34
|
+
startDate,
|
|
35
|
+
}) => {
|
|
36
|
+
const { groupedEmissions, chartLabelsArray } = buildEmissionGroupData(
|
|
37
|
+
emissions,
|
|
38
|
+
interval,
|
|
39
|
+
startDate
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const summaryTableData = groupedEmissions.map((emission) =>
|
|
43
|
+
rowType === "scopes"
|
|
44
|
+
? buildScopesRealDataObj(emission)
|
|
45
|
+
: buildSubcategoriesDataObj(emission)
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Box>
|
|
50
|
+
<Typography variant="h6">{blockTitle}</Typography>
|
|
51
|
+
<TableContainer>
|
|
52
|
+
<Table>
|
|
53
|
+
<TableHead>
|
|
54
|
+
<TableRow>
|
|
55
|
+
{[tableTitle, ...chartLabelsArray].map((label, idx) => (
|
|
56
|
+
<TableCell key={`table-head-cell-${idx}`}>{label}</TableCell>
|
|
57
|
+
))}
|
|
58
|
+
</TableRow>
|
|
59
|
+
</TableHead>
|
|
60
|
+
<TableBody>
|
|
61
|
+
{rows.map(({ name, subcategory }, idx) => (
|
|
62
|
+
<SummaryTableRow
|
|
63
|
+
name={name}
|
|
64
|
+
data={summaryTableData.map((dataRow) => dataRow[subcategory])}
|
|
65
|
+
key={`summary-table-row-${idx}`}
|
|
66
|
+
/>
|
|
67
|
+
))}
|
|
68
|
+
</TableBody>
|
|
69
|
+
</Table>
|
|
70
|
+
</TableContainer>
|
|
71
|
+
</Box>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default EmissionsSummaryTable;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, Grid } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
import ReportContentTitle from "./ReportContentTitle";
|
|
5
|
+
|
|
6
|
+
const ReportGraphContentLayout = ({
|
|
7
|
+
EmissionsChart,
|
|
8
|
+
contentTitle,
|
|
9
|
+
contentRows = [],
|
|
10
|
+
chartType = "bar",
|
|
11
|
+
chartViewMode = "scopes",
|
|
12
|
+
emissions,
|
|
13
|
+
interval = "quarter",
|
|
14
|
+
isPercentageChart,
|
|
15
|
+
height,
|
|
16
|
+
}) => {
|
|
17
|
+
return (
|
|
18
|
+
<Box p={2} style={{ height: height || "auto" }}>
|
|
19
|
+
<Grid container spacing={2}>
|
|
20
|
+
<Grid item sm={4} container direction="column" spacing={2}>
|
|
21
|
+
<Grid item>
|
|
22
|
+
<ReportContentTitle title={contentTitle} />
|
|
23
|
+
</Grid>
|
|
24
|
+
{contentRows.map((row, idx) => (
|
|
25
|
+
<Grid item key={`content-row-${idx}`}>
|
|
26
|
+
{row}
|
|
27
|
+
</Grid>
|
|
28
|
+
))}
|
|
29
|
+
</Grid>
|
|
30
|
+
<Grid item sm={8}>
|
|
31
|
+
<EmissionsChart
|
|
32
|
+
dataArray={emissions}
|
|
33
|
+
type={chartType}
|
|
34
|
+
viewMode={chartViewMode}
|
|
35
|
+
graphPeriod={interval}
|
|
36
|
+
displayUnit={"tons"}
|
|
37
|
+
unitConverter={(tons) => tons}
|
|
38
|
+
aspect={2}
|
|
39
|
+
isPercentageChart={isPercentageChart}
|
|
40
|
+
showTooltip={false}
|
|
41
|
+
/>
|
|
42
|
+
</Grid>
|
|
43
|
+
</Grid>
|
|
44
|
+
</Box>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default ReportGraphContentLayout;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { EmissionsChart as EmissionsChartModule } from "./EmissionsChart";
|
|
4
|
+
|
|
5
|
+
import { filterEmissionsByScope } from "@aclymatepackages/emissions-calcs";
|
|
6
|
+
import EmissionsPieChart from "./EmissionsPieChart";
|
|
7
|
+
import ReportContentTitle from "./ReportContentTitle";
|
|
8
|
+
import EmissionsSummarySentence from "./EmissionsSummarySentence";
|
|
9
|
+
import ReportGraphContentLayout from "./ReportGraphContentLayout";
|
|
10
|
+
|
|
11
|
+
const SummaryBlock = ({ emissions, interval, EmissionsChart }) => {
|
|
12
|
+
return (
|
|
13
|
+
<ReportGraphContentLayout
|
|
14
|
+
EmissionsChart={EmissionsChart || EmissionsChartModule}
|
|
15
|
+
contentTitle="Summary"
|
|
16
|
+
interval={interval}
|
|
17
|
+
emissions={emissions}
|
|
18
|
+
contentRows={[
|
|
19
|
+
<EmissionsPieChart dataArray={emissions} viewMode="scopes" />,
|
|
20
|
+
<ReportContentTitle title="Emissions Summary" />,
|
|
21
|
+
<EmissionsSummarySentence
|
|
22
|
+
label="Total Emissions"
|
|
23
|
+
emissions={emissions}
|
|
24
|
+
/>,
|
|
25
|
+
[1, 2, 3].map((scope, idx) => (
|
|
26
|
+
<EmissionsSummarySentence
|
|
27
|
+
key={`summary-sentence-${idx}`}
|
|
28
|
+
label={`Total Scope ${scope}`}
|
|
29
|
+
emissions={filterEmissionsByScope(emissions, scope)}
|
|
30
|
+
/>
|
|
31
|
+
)),
|
|
32
|
+
]}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default SummaryBlock;
|
package/src/index.js
CHANGED
|
@@ -14,6 +14,10 @@ import EmissionsChart from "./components/EmissionsChart";
|
|
|
14
14
|
import EmissionsCustomTooltip from "./components/EmissionsCustomTooltip";
|
|
15
15
|
import EmissionsPieChart from "./components/EmissionsPieChart";
|
|
16
16
|
import useChartWarningLabels from "./components/useChartWarningLabels";
|
|
17
|
+
import EmissionsSummaryTable from "./components/EmissionsSummaryTable";
|
|
18
|
+
import EmissionsSummarySentence from "./components/EmissionsSummarySentence";
|
|
19
|
+
import ReportContentTitle from "./components/ReportContentTitle";
|
|
20
|
+
import SummaryBlock from "./components/SummaryBlock";
|
|
17
21
|
|
|
18
22
|
export {
|
|
19
23
|
FootprintVideo,
|
|
@@ -32,4 +36,8 @@ export {
|
|
|
32
36
|
EmissionsCustomTooltip,
|
|
33
37
|
EmissionsPieChart,
|
|
34
38
|
useChartWarningLabels,
|
|
39
|
+
EmissionsSummaryTable,
|
|
40
|
+
EmissionsSummarySentence,
|
|
41
|
+
ReportContentTitle,
|
|
42
|
+
SummaryBlock,
|
|
35
43
|
};
|