@zac-apps/helium 1.0.2-beta.1 → 1.2.0-beta.1

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.
Files changed (2) hide show
  1. package/dist/index.js +30 -30
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1564,6 +1564,7 @@ function HeliumGraph(_ref4) {
1564
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; }
1565
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
1566
  var heliumLookupData = require("/conf/heliumLookup.json");
1567
+ var site = require("/conf/site.json");
1567
1568
 
1568
1569
  // Principal function
1569
1570
 
@@ -1572,7 +1573,7 @@ function Helium(props) {
1572
1573
 
1573
1574
  // State
1574
1575
 
1575
- var _useImmer = useImmer({}),
1576
+ var _useImmer = useImmer(null),
1576
1577
  _useImmer2 = _slicedToArray(_useImmer, 2),
1577
1578
  heliumData = _useImmer2[0],
1578
1579
  SetHeliumData = _useImmer2[1];
@@ -1584,10 +1585,10 @@ function Helium(props) {
1584
1585
  _useState4 = _slicedToArray(_useState3, 2),
1585
1586
  preprocessed = _useState4[0],
1586
1587
  SetPreprocessed = _useState4[1];
1587
- var _useState5 = useState({}),
1588
- _useState6 = _slicedToArray(_useState5, 2);
1589
- _useState6[0];
1590
- var SetHeliumError = _useState6[1];
1588
+ var _useState5 = useState(null),
1589
+ _useState6 = _slicedToArray(_useState5, 2),
1590
+ heliumError = _useState6[0],
1591
+ SetHeliumError = _useState6[1];
1591
1592
 
1592
1593
  // Query Media size for responsive column wrapping
1593
1594
 
@@ -1606,9 +1607,29 @@ function Helium(props) {
1606
1607
  SetState: SetHeliumData,
1607
1608
  SetError: SetHeliumError
1608
1609
  });
1610
+
1611
+ // Catch empty data
1612
+
1609
1613
  useEffect(function () {
1610
- if (heliumData && heliumData.helium) {
1611
- Object.keys(heliumData.helium).map(function (spec) {
1614
+ if (heliumError) {
1615
+ SetHeliumData(function (heliumData) {
1616
+ heliumData.helium = {};
1617
+ });
1618
+ Object.keys(heliumLookupData.lookup).map(function (spec) {
1619
+ SetHeliumData(function (heliumData) {
1620
+ heliumData.helium[spec] = 0;
1621
+ });
1622
+ });
1623
+ SetHeliumData(function (heliumData) {
1624
+ heliumData.meta = {};
1625
+ heliumData.meta.date = 0;
1626
+ });
1627
+ SetPreprocessed(true);
1628
+ }
1629
+ }, [heliumError]);
1630
+ useEffect(function () {
1631
+ if (heliumData !== null && heliumError === null) {
1632
+ Object.keys(heliumLookupData.lookup).map(function (spec) {
1612
1633
  SetHeliumData(function (heliumData) {
1613
1634
  heliumData.helium[spec] = Number(heliumData.helium[spec]);
1614
1635
  });
@@ -1616,27 +1637,6 @@ function Helium(props) {
1616
1637
  SetPreprocessed(true);
1617
1638
  }
1618
1639
  }, [heliumData]);
1619
-
1620
- // Catch empty data
1621
-
1622
- // useEffect(() => {
1623
- // if (heliumData) {
1624
- // SetHeliumData((heliumData) => {
1625
- // heliumData.helium = {};
1626
- // });
1627
- // Object.keys(heliumLookupData.lookup).map((spec) => {
1628
- // SetHeliumData((heliumData) => {
1629
- // heliumData.helium[spec] = 0;
1630
- // });
1631
- // });
1632
- // SetHeliumData((heliumData) => {
1633
- // heliumData.meta = {};
1634
- // heliumData.meta.date = 0;
1635
- // });
1636
- // SetPreprocessed(true);
1637
- // }
1638
- // }, [heliumError]);
1639
-
1640
1640
  if (!heliumData || !fetchGraph || !preprocessed) {
1641
1641
  return /*#__PURE__*/jsx(Progress, {});
1642
1642
  }
@@ -1649,7 +1649,7 @@ function Helium(props) {
1649
1649
  return /*#__PURE__*/jsx(AppGrid, {
1650
1650
  children: /*#__PURE__*/jsxs(LookupContext.Provider, {
1651
1651
  value: heliumLookupData,
1652
- children: [/*#__PURE__*/jsx(AppCard, {
1652
+ children: [site.showGraphs ? /*#__PURE__*/jsx(AppCard, {
1653
1653
  title: "Helium Graphs",
1654
1654
  size: 12,
1655
1655
  collapsed: collapsed,
@@ -1658,7 +1658,7 @@ function Helium(props) {
1658
1658
  graphDataMeta: graphDataMeta,
1659
1659
  matches: matches
1660
1660
  })
1661
- }), /*#__PURE__*/jsxs(Grid, {
1661
+ }) : null, /*#__PURE__*/jsxs(Grid, {
1662
1662
  sx: {
1663
1663
  display: "flex",
1664
1664
  flexFlow: "column wrap",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zac-apps/helium",
3
- "version": "1.0.2-beta.1",
3
+ "version": "1.2.0-beta.1",
4
4
  "scripts": {
5
5
  "rollup": "node_modules/rollup/dist/rollup.js",
6
6
  "dev": "next dev",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@mui/icons-material": "^5.15.14",
32
32
  "@mui/material": "^5.15.14",
33
- "@zac-apps/commons": "^1.3.5-beta.2",
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"