@wandelbots/wandelbots-js-react-components 2.32.0-pr.feature-robot-precondition-list.372.8ed54a6 → 2.32.0-pr.feature-robot-precondition-list.372.5d8a86e
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/components/ProgramControl.d.ts +6 -1
- package/dist/components/ProgramControl.d.ts.map +1 -1
- package/dist/components/ProgramStateIndicator.d.ts +1 -1
- package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
- package/dist/components/RobotCard.d.ts +8 -6
- package/dist/components/RobotCard.d.ts.map +1 -1
- package/dist/components/robots/Robot.d.ts +3 -2
- package/dist/components/robots/Robot.d.ts.map +1 -1
- package/dist/index.cjs +43 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4740 -4713
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ProgramControl.tsx +20 -10
- package/src/components/ProgramStateIndicator.tsx +5 -5
- package/src/components/RobotCard.tsx +240 -179
- package/src/components/robots/Robot.tsx +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wandelbots/wandelbots-js-react-components",
|
|
3
|
-
"version": "2.32.0-pr.feature-robot-precondition-list.372.
|
|
3
|
+
"version": "2.32.0-pr.feature-robot-precondition-list.372.5d8a86e",
|
|
4
4
|
"description": "React UI toolkit for building applications on top of the Wandelbots platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -4,7 +4,12 @@ import { observer } from "mobx-react-lite"
|
|
|
4
4
|
import { useTranslation } from "react-i18next"
|
|
5
5
|
import { externalizeComponent } from "../externalizeComponent"
|
|
6
6
|
|
|
7
|
-
export
|
|
7
|
+
export enum ProgramState {
|
|
8
|
+
IDLE = "idle",
|
|
9
|
+
RUNNING = "running",
|
|
10
|
+
PAUSED = "paused",
|
|
11
|
+
STOPPING = "stopping",
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
export interface ProgramControlProps {
|
|
10
15
|
/** The current state of the program control */
|
|
@@ -70,22 +75,24 @@ export const ProgramControl = externalizeComponent(
|
|
|
70
75
|
const getButtonConfigs = (): ButtonConfig[] => {
|
|
71
76
|
const baseConfigs: Record<string, ButtonConfig> = {
|
|
72
77
|
run: {
|
|
73
|
-
enabled:
|
|
78
|
+
enabled:
|
|
79
|
+
state === ProgramState.IDLE || state === ProgramState.PAUSED,
|
|
74
80
|
label:
|
|
75
|
-
state ===
|
|
81
|
+
state === ProgramState.PAUSED
|
|
76
82
|
? t("ProgramControl.Resume.bt")
|
|
77
83
|
: t("ProgramControl.Start.bt"),
|
|
78
84
|
color: theme.palette.success.main,
|
|
79
85
|
onClick: onRun,
|
|
80
86
|
},
|
|
81
87
|
pause: {
|
|
82
|
-
enabled: state ===
|
|
88
|
+
enabled: state === ProgramState.RUNNING,
|
|
83
89
|
label: t("ProgramControl.Pause.bt"),
|
|
84
90
|
color: "#FFFFFF33",
|
|
85
91
|
onClick: onPause || (() => {}),
|
|
86
92
|
},
|
|
87
93
|
stop: {
|
|
88
|
-
enabled:
|
|
94
|
+
enabled:
|
|
95
|
+
state === ProgramState.RUNNING || state === ProgramState.PAUSED,
|
|
89
96
|
label: t("ProgramControl.Stop.bt"),
|
|
90
97
|
color: theme.palette.error.main,
|
|
91
98
|
onClick: onStop,
|
|
@@ -157,7 +164,7 @@ export const ProgramControl = externalizeComponent(
|
|
|
157
164
|
variant="contained"
|
|
158
165
|
disabled={
|
|
159
166
|
!config.enabled ||
|
|
160
|
-
(state ===
|
|
167
|
+
(state === ProgramState.STOPPING && !requiresManualReset)
|
|
161
168
|
}
|
|
162
169
|
onClick={config.onClick}
|
|
163
170
|
sx={{
|
|
@@ -167,14 +174,17 @@ export const ProgramControl = externalizeComponent(
|
|
|
167
174
|
backgroundColor: config.color,
|
|
168
175
|
opacity:
|
|
169
176
|
config.enabled &&
|
|
170
|
-
!(state ===
|
|
177
|
+
!(state === ProgramState.STOPPING && !requiresManualReset)
|
|
171
178
|
? 1
|
|
172
179
|
: 0.3,
|
|
173
180
|
"&:hover": {
|
|
174
181
|
backgroundColor: config.color,
|
|
175
182
|
opacity:
|
|
176
183
|
config.enabled &&
|
|
177
|
-
!(
|
|
184
|
+
!(
|
|
185
|
+
state === ProgramState.STOPPING &&
|
|
186
|
+
!requiresManualReset
|
|
187
|
+
)
|
|
178
188
|
? 0.8
|
|
179
189
|
: 0.3,
|
|
180
190
|
},
|
|
@@ -194,13 +204,13 @@ export const ProgramControl = externalizeComponent(
|
|
|
194
204
|
sx={{
|
|
195
205
|
color:
|
|
196
206
|
config.enabled &&
|
|
197
|
-
!(state ===
|
|
207
|
+
!(state === ProgramState.STOPPING && !requiresManualReset)
|
|
198
208
|
? config.color
|
|
199
209
|
: theme.palette.text.disabled,
|
|
200
210
|
textAlign: "center",
|
|
201
211
|
opacity:
|
|
202
212
|
config.enabled &&
|
|
203
|
-
!(state ===
|
|
213
|
+
!(state === ProgramState.STOPPING && !requiresManualReset)
|
|
204
214
|
? 1
|
|
205
215
|
: 0.3,
|
|
206
216
|
}}
|
|
@@ -6,7 +6,7 @@ import type {
|
|
|
6
6
|
import { observer } from "mobx-react-lite"
|
|
7
7
|
import { useTranslation } from "react-i18next"
|
|
8
8
|
import { externalizeComponent } from "../externalizeComponent"
|
|
9
|
-
import
|
|
9
|
+
import { ProgramState } from "./ProgramControl"
|
|
10
10
|
|
|
11
11
|
export interface ProgramStateIndicatorProps {
|
|
12
12
|
/** The current state of the program */
|
|
@@ -77,22 +77,22 @@ export const ProgramStateIndicator = externalizeComponent(
|
|
|
77
77
|
// For normal safety states, check program state
|
|
78
78
|
if (safetyState === "SAFETY_STATE_NORMAL") {
|
|
79
79
|
switch (programState) {
|
|
80
|
-
case
|
|
80
|
+
case ProgramState.RUNNING:
|
|
81
81
|
return {
|
|
82
82
|
label: t("ProgramStateIndicator.Running.lb"),
|
|
83
83
|
color: theme.palette.success.main,
|
|
84
84
|
}
|
|
85
|
-
case
|
|
85
|
+
case ProgramState.PAUSED:
|
|
86
86
|
return {
|
|
87
87
|
label: t("ProgramStateIndicator.Paused.lb"),
|
|
88
88
|
color: theme.palette.grey[600],
|
|
89
89
|
}
|
|
90
|
-
case
|
|
90
|
+
case ProgramState.STOPPING:
|
|
91
91
|
return {
|
|
92
92
|
label: t("ProgramStateIndicator.Stopped.lb"),
|
|
93
93
|
color: theme.palette.error.main,
|
|
94
94
|
}
|
|
95
|
-
case
|
|
95
|
+
case ProgramState.IDLE:
|
|
96
96
|
default:
|
|
97
97
|
return {
|
|
98
98
|
label: t("ProgramStateIndicator.Ready.lb"),
|