@zac-apps/helium 1.3.0-beta.3 → 1.3.0-beta.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/index.js +36 -18
- package/package.json +13 -13
package/dist/index.js
CHANGED
|
@@ -33,7 +33,6 @@ import { LineChart, Line, CartesianGrid, XAxis, Label, YAxis, ReferenceLine, Ref
|
|
|
33
33
|
import ButtonGroup from '@mui/material/ButtonGroup';
|
|
34
34
|
import Switch from '@mui/material/Switch';
|
|
35
35
|
import regression from 'regression';
|
|
36
|
-
import 'next/app.js';
|
|
37
36
|
|
|
38
37
|
function NumField(_ref) {
|
|
39
38
|
var input = _ref.input,
|
|
@@ -1334,30 +1333,47 @@ function EstimateConsumption() {
|
|
|
1334
1333
|
|
|
1335
1334
|
function EstimateSlope(_ref) {
|
|
1336
1335
|
var data = _ref.data;
|
|
1336
|
+
_ref.spec;
|
|
1337
1337
|
// define slope and intercept
|
|
1338
1338
|
|
|
1339
1339
|
var slope = 0;
|
|
1340
1340
|
var intercept = 0;
|
|
1341
1341
|
|
|
1342
|
-
//
|
|
1342
|
+
// Define firstMax and firstMaxIndex
|
|
1343
1343
|
|
|
1344
|
-
var
|
|
1345
|
-
var
|
|
1346
|
-
|
|
1344
|
+
var firstMax = Number(data[data.length - 1].level);
|
|
1345
|
+
var firstMaxIndex = data.length - 1;
|
|
1346
|
+
|
|
1347
|
+
// Check if the last time when the spectrometer was filled is more than 45 days ago
|
|
1348
|
+
|
|
1349
|
+
var lastMaxIndex = data.length - 1;
|
|
1350
|
+
var lastMax = Number(data[lastMaxIndex].level);
|
|
1347
1351
|
for (var i = data.length - 2; i >= 0; i--) {
|
|
1348
1352
|
var level = Number(data[i].level);
|
|
1349
|
-
if (level
|
|
1350
|
-
|
|
1351
|
-
|
|
1353
|
+
if (level > firstMax) {
|
|
1354
|
+
lastMax = level;
|
|
1355
|
+
lastMaxIndex = i;
|
|
1352
1356
|
}
|
|
1353
1357
|
|
|
1354
|
-
// stop if level
|
|
1358
|
+
// stop if level decreases from maximum
|
|
1355
1359
|
|
|
1356
|
-
if (level
|
|
1360
|
+
if (level < lastMax) {
|
|
1357
1361
|
break;
|
|
1358
1362
|
}
|
|
1359
1363
|
}
|
|
1360
1364
|
|
|
1365
|
+
// if the last maximum is less than 45 days ago, use the last maximum as the first maximum
|
|
1366
|
+
// otherwise, the initial firstMaxIndex is the last maximum index
|
|
1367
|
+
|
|
1368
|
+
if (lastMaxIndex >= data.length - 45) {
|
|
1369
|
+
firstMaxIndex = lastMaxIndex - 1;
|
|
1370
|
+
firstMax = Number(data[firstMaxIndex].level);
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
// minimum level is the level at firstMaxIndex
|
|
1374
|
+
|
|
1375
|
+
var minLevelIndex = firstMaxIndex - 1;
|
|
1376
|
+
|
|
1361
1377
|
// find previous time when spectrometer was filled - for this start from lastMinimumIndex and go back until a maximum is found or until level reaches 90%
|
|
1362
1378
|
|
|
1363
1379
|
var maxLevel = Number(data[minLevelIndex].level);
|
|
@@ -1429,12 +1445,14 @@ function ShowEstimate(_ref) {
|
|
|
1429
1445
|
}), /*#__PURE__*/jsx(Grid, {
|
|
1430
1446
|
container: true,
|
|
1431
1447
|
children: /*#__PURE__*/jsxs(AppTable, {
|
|
1432
|
-
children: [/*#__PURE__*/
|
|
1433
|
-
children:
|
|
1434
|
-
children:
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1448
|
+
children: [/*#__PURE__*/jsx(TableHead, {
|
|
1449
|
+
children: /*#__PURE__*/jsxs(TableRow, {
|
|
1450
|
+
children: [/*#__PURE__*/jsx(TableHeadCell, {
|
|
1451
|
+
children: "Estimated"
|
|
1452
|
+
}), /*#__PURE__*/jsx(TableHeadCell, {
|
|
1453
|
+
children: "Stored"
|
|
1454
|
+
})]
|
|
1455
|
+
})
|
|
1438
1456
|
}), /*#__PURE__*/jsx(TableBody, {
|
|
1439
1457
|
children: /*#__PURE__*/jsxs(TableRow, {
|
|
1440
1458
|
children: [/*#__PURE__*/jsx(TableCell, {
|
|
@@ -1551,7 +1569,7 @@ function RenderGraph(_ref) {
|
|
|
1551
1569
|
|
|
1552
1570
|
// Get last n elements of array
|
|
1553
1571
|
|
|
1554
|
-
|
|
1572
|
+
var slicedData = data.slice(Math.max(data.length - days, 0));
|
|
1555
1573
|
|
|
1556
1574
|
// Improve visibility of estimate
|
|
1557
1575
|
|
|
@@ -1560,7 +1578,7 @@ function RenderGraph(_ref) {
|
|
|
1560
1578
|
children: [/*#__PURE__*/jsxs(LineChart, {
|
|
1561
1579
|
height: height,
|
|
1562
1580
|
width: width,
|
|
1563
|
-
data:
|
|
1581
|
+
data: slicedData,
|
|
1564
1582
|
margin: {
|
|
1565
1583
|
top: 5,
|
|
1566
1584
|
right: 20,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zac-apps/helium",
|
|
3
|
-
"version": "1.3.0-beta.
|
|
3
|
+
"version": "1.3.0-beta.5",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"rollup": "node_modules/rollup/dist/rollup.js",
|
|
6
6
|
"dev": "next dev",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@mui/material": "^5.17.1",
|
|
33
33
|
"@zac-apps/commons": "^1",
|
|
34
34
|
"moment": "^2.30.1",
|
|
35
|
-
"recharts": "^2.15.
|
|
35
|
+
"recharts": "^2.15.2",
|
|
36
36
|
"regression": "^2.0.1",
|
|
37
37
|
"use-immer": "^0.11.0"
|
|
38
38
|
},
|
|
@@ -47,21 +47,21 @@
|
|
|
47
47
|
"@semantic-release/git": "^10.0.1",
|
|
48
48
|
"@semantic-release/gitlab": "^13.2.4",
|
|
49
49
|
"@semantic-release/npm": "^12.0.1",
|
|
50
|
-
"@storybook/addon-essentials": "^8.6.
|
|
51
|
-
"@storybook/addon-interactions": "^8.6.
|
|
52
|
-
"@storybook/addon-links": "^8.6.
|
|
53
|
-
"@storybook/addon-onboarding": "^8.6.
|
|
54
|
-
"@storybook/blocks": "^8.6.
|
|
55
|
-
"@storybook/nextjs": "^8.6.
|
|
56
|
-
"@storybook/react": "^8.6.
|
|
57
|
-
"@storybook/test": "^8.6.
|
|
50
|
+
"@storybook/addon-essentials": "^8.6.12",
|
|
51
|
+
"@storybook/addon-interactions": "^8.6.12",
|
|
52
|
+
"@storybook/addon-links": "^8.6.12",
|
|
53
|
+
"@storybook/addon-onboarding": "^8.6.12",
|
|
54
|
+
"@storybook/blocks": "^8.6.12",
|
|
55
|
+
"@storybook/nextjs": "^8.6.12",
|
|
56
|
+
"@storybook/react": "^8.6.12",
|
|
57
|
+
"@storybook/test": "^8.6.12",
|
|
58
58
|
"babel-loader": "^10.0.0",
|
|
59
59
|
"eslint": "^9",
|
|
60
|
-
"eslint-config-next": "15.
|
|
60
|
+
"eslint-config-next": "15.3.0",
|
|
61
61
|
"eslint-plugin-storybook": "^0.12.0",
|
|
62
|
-
"rollup": "^4.
|
|
62
|
+
"rollup": "^4.40.0",
|
|
63
63
|
"semantic-release": "^24.2.3",
|
|
64
|
-
"storybook": "^8.6.
|
|
64
|
+
"storybook": "^8.6.12"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"@zac-apps/commons": "^1",
|