@zac-apps/helium 1.0.1 → 1.1.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/dist/index.js +59 -13
- package/package.json +17 -17
package/dist/index.js
CHANGED
|
@@ -1500,6 +1500,29 @@ function HeliumGraph(_ref4) {
|
|
|
1500
1500
|
matches = _ref4.matches;
|
|
1501
1501
|
var height = matches ? 250 : 200;
|
|
1502
1502
|
var width = matches ? 300 : 280;
|
|
1503
|
+
|
|
1504
|
+
// Catch missing data
|
|
1505
|
+
|
|
1506
|
+
if (graphData.error) {
|
|
1507
|
+
return /*#__PURE__*/jsxs(React.Fragment, {
|
|
1508
|
+
children: [/*#__PURE__*/jsx(DivTitle, {
|
|
1509
|
+
children: /*#__PURE__*/jsx("strong", {
|
|
1510
|
+
children: "Helium level monitoring"
|
|
1511
|
+
})
|
|
1512
|
+
}), /*#__PURE__*/jsx(Grid, {
|
|
1513
|
+
sx: {
|
|
1514
|
+
display: "flex",
|
|
1515
|
+
justifyContent: "center"
|
|
1516
|
+
},
|
|
1517
|
+
children: /*#__PURE__*/jsx("em", {
|
|
1518
|
+
children: "No graph data available"
|
|
1519
|
+
})
|
|
1520
|
+
})]
|
|
1521
|
+
});
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
// Render component
|
|
1525
|
+
|
|
1503
1526
|
return /*#__PURE__*/jsxs(React.Fragment, {
|
|
1504
1527
|
children: [/*#__PURE__*/jsxs(DivTitle, {
|
|
1505
1528
|
children: [/*#__PURE__*/jsx("strong", {
|
|
@@ -1540,6 +1563,10 @@ function HeliumGraph(_ref4) {
|
|
|
1540
1563
|
|
|
1541
1564
|
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; }
|
|
1542
1565
|
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; }
|
|
1566
|
+
var heliumLookupData = require("/conf/heliumLookup.json");
|
|
1567
|
+
|
|
1568
|
+
// Principal function
|
|
1569
|
+
|
|
1543
1570
|
function Helium(props) {
|
|
1544
1571
|
var basePath = props.basePath || "";
|
|
1545
1572
|
|
|
@@ -1557,6 +1584,10 @@ function Helium(props) {
|
|
|
1557
1584
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
1558
1585
|
preprocessed = _useState4[0],
|
|
1559
1586
|
SetPreprocessed = _useState4[1];
|
|
1587
|
+
var _useState5 = useState(null),
|
|
1588
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
1589
|
+
heliumError = _useState6[0],
|
|
1590
|
+
SetHeliumError = _useState6[1];
|
|
1560
1591
|
|
|
1561
1592
|
// Query Media size for responsive column wrapping
|
|
1562
1593
|
|
|
@@ -1567,19 +1598,37 @@ function Helium(props) {
|
|
|
1567
1598
|
|
|
1568
1599
|
// fetch data
|
|
1569
1600
|
|
|
1570
|
-
var heliumLookupData = PublicFetch({
|
|
1571
|
-
url: basePath + "/heliumLookup.json"
|
|
1572
|
-
});
|
|
1573
1601
|
var fetchGraph = PublicFetch({
|
|
1574
1602
|
url: basePath + "/graphdata.json"
|
|
1575
1603
|
});
|
|
1576
1604
|
PublicFetch({
|
|
1577
1605
|
url: basePath + "/helium.json",
|
|
1578
|
-
SetState: SetHeliumData
|
|
1606
|
+
SetState: SetHeliumData,
|
|
1607
|
+
SetError: SetHeliumError
|
|
1579
1608
|
});
|
|
1609
|
+
|
|
1610
|
+
// Catch empty data
|
|
1611
|
+
|
|
1580
1612
|
useEffect(function () {
|
|
1581
|
-
if (
|
|
1582
|
-
|
|
1613
|
+
if (heliumError) {
|
|
1614
|
+
SetHeliumData(function (heliumData) {
|
|
1615
|
+
heliumData.helium = {};
|
|
1616
|
+
});
|
|
1617
|
+
Object.keys(heliumLookupData.lookup).map(function (spec) {
|
|
1618
|
+
SetHeliumData(function (heliumData) {
|
|
1619
|
+
heliumData.helium[spec] = 0;
|
|
1620
|
+
});
|
|
1621
|
+
});
|
|
1622
|
+
SetHeliumData(function (heliumData) {
|
|
1623
|
+
heliumData.meta = {};
|
|
1624
|
+
heliumData.meta.date = 0;
|
|
1625
|
+
});
|
|
1626
|
+
SetPreprocessed(true);
|
|
1627
|
+
}
|
|
1628
|
+
}, [heliumError]);
|
|
1629
|
+
useEffect(function () {
|
|
1630
|
+
if (heliumData !== null && heliumError === null) {
|
|
1631
|
+
Object.keys(heliumLookupData.lookup).map(function (spec) {
|
|
1583
1632
|
SetHeliumData(function (heliumData) {
|
|
1584
1633
|
heliumData.helium[spec] = Number(heliumData.helium[spec]);
|
|
1585
1634
|
});
|
|
@@ -1587,17 +1636,14 @@ function Helium(props) {
|
|
|
1587
1636
|
SetPreprocessed(true);
|
|
1588
1637
|
}
|
|
1589
1638
|
}, [heliumData]);
|
|
1590
|
-
|
|
1591
|
-
// Catch empty data
|
|
1592
|
-
|
|
1593
|
-
if (!heliumData || !heliumLookupData || !fetchGraph || preprocessed === false) {
|
|
1639
|
+
if (!heliumData || !fetchGraph || !preprocessed) {
|
|
1594
1640
|
return /*#__PURE__*/jsx(Progress, {});
|
|
1595
1641
|
}
|
|
1596
1642
|
var graphDataMeta = fetchGraph.meta;
|
|
1597
1643
|
var graphData = _objectSpread({}, fetchGraph);
|
|
1598
1644
|
delete graphData.meta;
|
|
1599
1645
|
if (!graphDataMeta) {
|
|
1600
|
-
|
|
1646
|
+
graphDataMeta = {};
|
|
1601
1647
|
}
|
|
1602
1648
|
return /*#__PURE__*/jsx(AppGrid, {
|
|
1603
1649
|
children: /*#__PURE__*/jsxs(LookupContext.Provider, {
|
|
@@ -1626,9 +1672,9 @@ function Helium(props) {
|
|
|
1626
1672
|
children: [/*#__PURE__*/jsx("strong", {
|
|
1627
1673
|
children: "Current levels"
|
|
1628
1674
|
}), " ", /*#__PURE__*/jsxs("em", {
|
|
1629
|
-
children: ["(updated
|
|
1675
|
+
children: [heliumData.meta.date || heliumData.meta.date !== 0 ? "(updated " + moment(heliumData.meta.date).fromNow() + ")" : "(manual)", /*#__PURE__*/jsx(EditAdmon, {
|
|
1630
1676
|
levelsEdited: levelsEdited
|
|
1631
|
-
})
|
|
1677
|
+
})]
|
|
1632
1678
|
})]
|
|
1633
1679
|
})
|
|
1634
1680
|
}), /*#__PURE__*/jsx(Grid, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zac-apps/helium",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"rollup": "node_modules/rollup/dist/rollup.js",
|
|
6
6
|
"dev": "next dev",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"author": "ZAC",
|
|
29
29
|
"license": "CC-BY-SA-4.0",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@mui/icons-material": "^5.15.
|
|
32
|
-
"@mui/material": "^5.15.
|
|
33
|
-
"@zac-apps/commons": "^1.3.
|
|
31
|
+
"@mui/icons-material": "^5.15.14",
|
|
32
|
+
"@mui/material": "^5.15.14",
|
|
33
|
+
"@zac-apps/commons": "^1.3.6",
|
|
34
34
|
"moment": "^2.30.1",
|
|
35
35
|
"recharts": "^2.12.3",
|
|
36
36
|
"use-immer": "^0.9.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@babel/plugin-transform-runtime": "^7.24.
|
|
39
|
+
"@babel/plugin-transform-runtime": "^7.24.3",
|
|
40
40
|
"@emotion/react": "^11.11.4",
|
|
41
41
|
"@emotion/styled": "^11.11.0",
|
|
42
42
|
"@rollup/plugin-babel": "^6.0.4",
|
|
@@ -46,21 +46,21 @@
|
|
|
46
46
|
"@semantic-release/git": "^10.0.1",
|
|
47
47
|
"@semantic-release/gitlab": "^13.0.3",
|
|
48
48
|
"@semantic-release/npm": "^12.0.0",
|
|
49
|
-
"@storybook/addon-essentials": "^8.0.
|
|
50
|
-
"@storybook/addon-interactions": "^8.0.
|
|
51
|
-
"@storybook/addon-links": "^8.0.
|
|
52
|
-
"@storybook/addon-onboarding": "^8.0.
|
|
53
|
-
"@storybook/blocks": "^8.0.
|
|
54
|
-
"@storybook/nextjs": "^8.0.
|
|
55
|
-
"@storybook/react": "^8.0.
|
|
56
|
-
"@storybook/test": "^8.0.
|
|
49
|
+
"@storybook/addon-essentials": "^8.0.5",
|
|
50
|
+
"@storybook/addon-interactions": "^8.0.5",
|
|
51
|
+
"@storybook/addon-links": "^8.0.5",
|
|
52
|
+
"@storybook/addon-onboarding": "^8.0.5",
|
|
53
|
+
"@storybook/blocks": "^8.0.5",
|
|
54
|
+
"@storybook/nextjs": "^8.0.5",
|
|
55
|
+
"@storybook/react": "^8.0.5",
|
|
56
|
+
"@storybook/test": "^8.0.5",
|
|
57
57
|
"babel-loader": "^9.1.3",
|
|
58
58
|
"eslint": "^8",
|
|
59
|
-
"eslint-config-next": "14.1.
|
|
59
|
+
"eslint-config-next": "14.1.4",
|
|
60
60
|
"eslint-plugin-storybook": "^0.8.0",
|
|
61
|
-
"rollup": "^4.13.
|
|
62
|
-
"semantic-release": "^23.0.
|
|
63
|
-
"storybook": "^8.0.
|
|
61
|
+
"rollup": "^4.13.1",
|
|
62
|
+
"semantic-release": "^23.0.6",
|
|
63
|
+
"storybook": "^8.0.5"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"next": "^14.0.4",
|