@wandelbots/wandelbots-js-react-components 1.16.1 → 1.16.2

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.16.1",
3
+ "version": "1.16.2",
4
4
  "description": "React UI toolkit for building applications on top of the Wandelbots platform",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,5 +1,6 @@
1
1
  import { makeErrorMessage } from "./utils/errorHandling"
2
- import { CircularProgress, Stack, useTheme } from "@mui/material"
2
+ import { capitalize, CircularProgress, Stack, useTheme } from "@mui/material"
3
+ import { lowerFirst } from "lodash-es"
3
4
  import { useEffect, useState } from "react"
4
5
 
5
6
  export const LoadingCover = (props: {
@@ -27,7 +28,10 @@ export const LoadingCover = (props: {
27
28
  justifyContent="center"
28
29
  >
29
30
  {props.error ? (
30
- <LoadingErrorMessage message={props.message} error={props.error} />
31
+ <LoadingErrorMessage
32
+ loadingMessage={props.message}
33
+ error={props.error}
34
+ />
31
35
  ) : (
32
36
  <>
33
37
  <CircularProgress sx={{ marginBottom: "24px" }} />
@@ -47,7 +51,10 @@ export const LoadingCover = (props: {
47
51
  )
48
52
  }
49
53
 
50
- const LoadingErrorMessage = (props: { message?: string; error: unknown }) => {
54
+ export const LoadingErrorMessage = (props: {
55
+ loadingMessage?: string
56
+ error: unknown
57
+ }) => {
51
58
  const errorMessage = makeErrorMessage(props.error)
52
59
  const stack = props.error instanceof Error ? props.error.stack : null
53
60
  const theme = useTheme()
@@ -67,7 +74,9 @@ const LoadingErrorMessage = (props: { message?: string; error: unknown }) => {
67
74
  },
68
75
  }}
69
76
  >
70
- {`Error while: ${props.message} - ${errorMessage}`}
77
+ {(props.loadingMessage
78
+ ? `Error while ${lowerFirst(capitalize(props.loadingMessage))} - `
79
+ : "") + errorMessage}
71
80
  <br />
72
81
  {stack && <pre>{stack}</pre>}
73
82
  </Stack>
package/src/index.ts CHANGED
@@ -11,4 +11,5 @@ export * from "./components/VelocitySlider"
11
11
  export * from "./components/modal/NoMotionGroupModal"
12
12
  export * from "./components/utils/hooks"
13
13
  export * from "./components/robots/AxisConfig"
14
+ export * from "./components/LoadingCover"
14
15
  export { createNovaMuiTheme } from "./themes/theming"