@haniffalab/cherita-react 0.2.0-dev.2024-12-16.6be54149 → 0.2.0-dev.2025-01-22.f523ac5e

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.
@@ -43,14 +43,22 @@ function FullPage(_ref) {
43
43
  (0, _react.useLayoutEffect)(() => {
44
44
  function updateDimensions() {
45
45
  if (targetRef.current) {
46
+ // Get the distance from the top of the page to the target element
47
+ const rect = targetRef.current.getBoundingClientRect();
48
+ const distanceFromTop = rect.top + window.scrollY;
49
+
50
+ // Calculate the available height for the Cherita app
51
+ const availableHeight = window.innerHeight - distanceFromTop;
52
+
53
+ // Update the dimensions to fit the viewport minus the navbar height
46
54
  setDimensions({
47
55
  width: targetRef.current.offsetWidth,
48
- height: window.innerHeight - targetRef.current.offsetTop
56
+ height: availableHeight
49
57
  });
50
58
  }
51
59
  }
52
60
  window.addEventListener("resize", updateDimensions);
53
- updateDimensions();
61
+ updateDimensions(); // Initial update
54
62
  return () => window.removeEventListener("resize", updateDimensions);
55
63
  }, []);
56
64
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -145,7 +145,8 @@ function SingleSelectionItem(_ref3) {
145
145
  isPending,
146
146
  serverError
147
147
  } = (0, _requests.useFetch)(ENDPOINT, params, {
148
- refetchOnMount: false
148
+ refetchOnMount: false,
149
+ enabled: !!dataset.diseaseDatasets.length
149
150
  });
150
151
  const hasDiseaseInfo = !isPending && !serverError && !!fetchedData.length;
151
152
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
@@ -19,7 +19,6 @@ var _jsxRuntime = require("react/jsx-runtime");
19
19
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
21
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
- // @TODO: optimize
23
22
  const useVarMean = function (varKeys) {
24
23
  let enabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
25
24
  const ENDPOINT = "matrix/mean";
@@ -177,11 +176,11 @@ function VarNamesList(_ref2) {
177
176
  }, [mode, dataset.selectedMultiVar]);
178
177
  (0, _react.useEffect)(() => {
179
178
  setVarButtons(v => {
180
- const updated = _lodash.default.map(v, i => {
179
+ const updated = _lodash.default.compact(_lodash.default.map(v, i => {
181
180
  if (i.isSet) {
182
181
  return dataset.varSets.find(s => s.name === i.name);
183
182
  } else return i;
184
- });
183
+ }));
185
184
  const newSets = _lodash.default.difference(dataset.varSets, updated);
186
185
  return [...updated, ...newSets];
187
186
  });
@@ -11907,12 +11907,12 @@ textarea.form-control-lg {
11907
11907
  margin-top: 76px;
11908
11908
  padding: 20px;
11909
11909
  position: relative;
11910
- min-height: 500px;
11910
+ min-height: 400px;
11911
11911
  }
11912
11912
 
11913
11913
  .cherita-container-scatterplot {
11914
11914
  position: relative;
11915
- min-height: 500px;
11915
+ min-height: 400px;
11916
11916
  height: 100%;
11917
11917
  }
11918
11918
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haniffalab/cherita-react",
3
- "version": "0.2.0-dev.2024-12-16.6be54149",
3
+ "version": "0.2.0-dev.2025-01-22.f523ac5e",
4
4
  "author": "",
5
5
  "license": "",
6
6
  "main": "dist/index.js",
@@ -101,5 +101,5 @@
101
101
  "url": "https://github.com/haniffalab/cherita-react/issues"
102
102
  },
103
103
  "homepage": "https://github.com/haniffalab/cherita-react#readme",
104
- "prereleaseSha": "6be54149744ec54b8d96989fae19ecd277e68a71"
104
+ "prereleaseSha": "f523ac5e8f96d002ae12a191e96c4eb9729c3f98"
105
105
  }
package/scss/cherita.scss CHANGED
@@ -70,12 +70,12 @@
70
70
  margin-top: 76px;
71
71
  padding: 20px;
72
72
  position: relative;
73
- min-height: 500px;
73
+ min-height: 400px;
74
74
  }
75
75
 
76
76
  .cherita-container-scatterplot {
77
77
  position: relative;
78
- min-height: 500px;
78
+ min-height: 400px;
79
79
  height: 100%;
80
80
  }
81
81