@wandelbots/wandelbots-js-react-components 1.17.2 → 1.17.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wandelbots/wandelbots-js-react-components",
3
- "version": "1.17.2",
3
+ "version": "1.17.3",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,23 +1,23 @@
1
1
  import {
2
- ToggleButtonGroup,
3
- ToggleButton,
4
2
  Stack,
3
+ ToggleButton,
4
+ ToggleButtonGroup,
5
5
  Typography,
6
6
  } from "@mui/material"
7
- import { observer } from "mobx-react-lite"
8
- import { JoggingCartesianAxisControl } from "./JoggingCartesianAxisControl"
9
7
  import { degreesToRadians, radiansToDegrees } from "@wandelbots/wandelbots-js"
8
+ import { observer } from "mobx-react-lite"
10
9
  import { useTranslation } from "react-i18next"
11
- import RotationIcon from "../../icons/rotation.svg"
12
10
  import XAxisIcon from "../../icons/axis-x.svg"
13
11
  import YAxisIcon from "../../icons/axis-y.svg"
14
12
  import ZAxisIcon from "../../icons/axis-z.svg"
15
- import type { JoggingStore, DiscreteIncrementOption } from "./JoggingStore"
16
- import { JoggingOptions } from "./JoggingOptions"
17
- import { JoggingVelocitySlider } from "./JoggingVelocitySlider"
13
+ import RotationIcon from "../../icons/rotation.svg"
18
14
  import { useReaction } from "../utils/hooks"
15
+ import { JoggingCartesianAxisControl } from "./JoggingCartesianAxisControl"
19
16
  import { JoggingCartesianValues } from "./JoggingCartesianValues"
20
17
  import { JoggingJointLimitDetector } from "./JoggingJointLimitDetector"
18
+ import { JoggingOptions } from "./JoggingOptions"
19
+ import type { DiscreteIncrementOption, JoggingStore } from "./JoggingStore"
20
+ import { JoggingVelocitySlider } from "./JoggingVelocitySlider"
21
21
 
22
22
  type JoggingCartesianOpts = {
23
23
  axis: "x" | "y" | "z"
@@ -247,11 +247,11 @@ export const JoggingCartesianTab = observer(
247
247
  ))}
248
248
  </Stack>
249
249
 
250
- {/* Velocity slider */}
251
- <JoggingVelocitySlider store={store} />
252
-
253
250
  {/* Show message if joint limits reached */}
254
251
  <JoggingJointLimitDetector store={store} />
252
+
253
+ {/* Velocity slider */}
254
+ <JoggingVelocitySlider store={store} />
255
255
  </Stack>
256
256
  )
257
257
  },
@@ -1,7 +1,7 @@
1
1
  import { Typography } from "@mui/material"
2
- import { useTranslation } from "react-i18next"
3
- import { useState } from "react"
4
2
  import isEqual from "lodash-es/isEqual"
3
+ import { useRef, useState } from "react"
4
+ import { useTranslation } from "react-i18next"
5
5
  import { useAnimationFrame } from "../utils/hooks"
6
6
  import type { JoggingStore } from "./JoggingStore"
7
7
 
@@ -20,30 +20,31 @@ export const JoggingJointLimitDetector = ({
20
20
  store.jogger.motionStream.rapidlyChangingMotionState.state
21
21
  .joint_limit_reached.limit_reached,
22
22
  )
23
+ const jointLimitsReachedRef = useRef(jointLimitsReached)
23
24
 
24
25
  useAnimationFrame(() => {
25
26
  const newLimitsReached =
26
27
  store.jogger.motionStream.rapidlyChangingMotionState.state
27
28
  .joint_limit_reached.limit_reached
28
29
 
29
- if (!isEqual(jointLimitsReached, newLimitsReached)) {
30
+ if (!isEqual(jointLimitsReachedRef.current, newLimitsReached)) {
31
+ jointLimitsReachedRef.current = newLimitsReached
30
32
  setJointLimitsReached(newLimitsReached)
31
33
  }
32
34
  })
33
35
 
34
36
  const jointLimitReachedIndices: number[] = []
35
- jointLimitsReached.forEach((limitReached, index) => {
37
+ for (const [index, limitReached] of jointLimitsReached.entries()) {
36
38
  if (limitReached) jointLimitReachedIndices.push(index)
37
- })
38
-
39
- if (!jointLimitReachedIndices.length) return null
39
+ }
40
40
 
41
41
  return (
42
42
  <Typography
43
43
  color="error"
44
44
  sx={{
45
- padding: "1rem",
45
+ margin: "0.5rem 1rem",
46
46
  textAlign: "center",
47
+ visibility: jointLimitReachedIndices.length ? "visible" : "hidden",
47
48
  }}
48
49
  >
49
50
  {t("Jogging.JointLimitsReached.lb", {
@@ -1,17 +1,17 @@
1
1
  import { Button, Paper, Stack, Tab, Tabs } from "@mui/material"
2
+ import { NovaClient } from "@wandelbots/wandelbots-js"
3
+ import { isString } from "lodash-es"
4
+ import { runInAction } from "mobx"
2
5
  import { observer, useLocalObservable } from "mobx-react-lite"
3
6
  import { useEffect } from "react"
4
- import { JoggingCartesianTab } from "./JoggingCartesianTab"
5
- import { JoggingJointTab } from "./JoggingJointTab"
6
- import { JoggingStore } from "./JoggingStore"
7
+ import { useTranslation } from "react-i18next"
8
+ import { externalizeComponent } from "../../externalizeComponent"
7
9
  import { LoadingCover } from "../LoadingCover"
8
10
  import { TransparentOverlay } from "../TransparentOverlay"
9
- import { runInAction } from "mobx"
10
- import { NovaClient } from "@wandelbots/wandelbots-js"
11
- import { externalizeComponent } from "../../externalizeComponent"
12
- import { isString } from "lodash-es"
13
11
  import { useReaction } from "../utils/hooks"
14
- import { useTranslation } from "react-i18next"
12
+ import { JoggingCartesianTab } from "./JoggingCartesianTab"
13
+ import { JoggingJointTab } from "./JoggingJointTab"
14
+ import { JoggingStore } from "./JoggingStore"
15
15
 
16
16
  export type JoggingPanelProps = {
17
17
  /** Either an existing NovaClient or the base url of a deployed Nova instance */
@@ -31,8 +31,6 @@ export type JoggingPanelProps = {
31
31
  */
32
32
  export const JoggingPanel = externalizeComponent(
33
33
  observer((props: JoggingPanelProps) => {
34
- const { t } = useTranslation()
35
-
36
34
  const nova = isString(props.nova)
37
35
  ? new NovaClient({ instanceUrl: props.nova })
38
36
  : props.nova
@@ -1,8 +1,8 @@
1
- import { Stack, Typography } from "@mui/material"
1
+ import { Stack } from "@mui/material"
2
2
  import { observer, useLocalObservable } from "mobx-react-lite"
3
- import type { JoggingStore } from "./JoggingStore"
4
- import { VelocitySlider } from "../VelocitySlider"
5
3
  import { useTranslation } from "react-i18next"
4
+ import { VelocitySlider } from "../VelocitySlider"
5
+ import type { JoggingStore } from "./JoggingStore"
6
6
 
7
7
  export const JoggingVelocitySlider = observer(
8
8
  ({ store }: { store: JoggingStore }) => {
@@ -24,8 +24,7 @@ export const JoggingVelocitySlider = observer(
24
24
  <Stack
25
25
  sx={{
26
26
  margin: "0px 20px",
27
- marginTop: "24px",
28
- marginBottom: "24px",
27
+ marginBottom: "12px",
29
28
  }}
30
29
  >
31
30
  <Stack sx={{ width: "380px", maxWidth: "90%", margin: "auto" }}>
@@ -1,27 +1,23 @@
1
- import deJSON from "./locales/de/translations.json"
2
- import enJSON from "./locales/en/translations.json"
3
- import i18next from "i18next"
4
1
  import type { i18n } from "i18next"
2
+ import i18next from "i18next"
5
3
  import LanguageDetector from "i18next-browser-languagedetector"
6
- import { initReactI18next } from "react-i18next"
4
+ import deJSON from "./locales/de/translations.json"
5
+ import enJSON from "./locales/en/translations.json"
7
6
 
8
7
  const i18n: i18n = i18next.createInstance()
9
8
 
10
- i18n
11
- .use(LanguageDetector)
12
- .use(initReactI18next)
13
- .init({
14
- supportedLngs: ["en", "de"],
15
- resources: {
16
- en: {
17
- translations: enJSON,
18
- },
19
- de: {
20
- translations: deJSON,
21
- },
9
+ i18n.use(LanguageDetector).init({
10
+ supportedLngs: ["en", "de"],
11
+ resources: {
12
+ en: {
13
+ translations: enJSON,
14
+ },
15
+ de: {
16
+ translations: deJSON,
22
17
  },
23
- ns: ["translations"],
24
- defaultNS: "translations",
25
- })
18
+ },
19
+ ns: ["translations"],
20
+ defaultNS: "translations",
21
+ })
26
22
 
27
23
  export default i18n
@@ -11,5 +11,6 @@
11
11
  "Jogging.Increment.Continuous.dd": "Fortlaufend",
12
12
  "Jogging.Cartesian.Orientation.lb": "Orientierung",
13
13
  "Jogging.Activate.bt": "Jogging activieren",
14
- "Jogging.Activating.lb": "Jogging wird aktivieren"
14
+ "Jogging.Activating.lb": "Jogging wird aktivieren",
15
+ "Jogging.JointLimitsReached.lb": "Joint-Limit für Joint {{jointNumbers}} erreicht"
15
16
  }
@@ -11,5 +11,6 @@
11
11
  "Jogging.Increment.Continuous.dd": "Continuous",
12
12
  "Jogging.Cartesian.Orientation.lb": "Orientation",
13
13
  "Jogging.Activate.bt": "Activate jogging",
14
- "Jogging.Activating.lb": "Activating jogging"
14
+ "Jogging.Activating.lb": "Activating jogging",
15
+ "Jogging.JointLimitsReached.lb": "Joint limit reached for joint {{jointNumbers}}"
15
16
  }