@wandelbots/wandelbots-js-react-components 2.33.0-pr.feature-robot-precondition-list.372.cb78a22 → 2.33.0

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 (45) hide show
  1. package/dist/components/CycleTimer.d.ts.map +1 -1
  2. package/dist/components/ProgramControl.d.ts +1 -6
  3. package/dist/components/ProgramControl.d.ts.map +1 -1
  4. package/dist/components/ProgramStateIndicator.d.ts +1 -1
  5. package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
  6. package/dist/components/robots/Robot.d.ts +2 -3
  7. package/dist/components/robots/Robot.d.ts.map +1 -1
  8. package/dist/index.cjs +48 -48
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.ts +0 -7
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +7196 -8357
  13. package/dist/index.js.map +1 -1
  14. package/package.json +1 -2
  15. package/src/components/CycleTimer.tsx +64 -43
  16. package/src/components/ProgramControl.tsx +10 -20
  17. package/src/components/ProgramStateIndicator.tsx +8 -20
  18. package/src/components/robots/Robot.tsx +2 -5
  19. package/src/i18n/locales/de/translations.json +1 -6
  20. package/src/i18n/locales/en/translations.json +1 -6
  21. package/src/index.ts +0 -7
  22. package/dist/components/DataGrid.d.ts +0 -61
  23. package/dist/components/DataGrid.d.ts.map +0 -1
  24. package/dist/components/LogPanel.d.ts +0 -54
  25. package/dist/components/LogPanel.d.ts.map +0 -1
  26. package/dist/components/LogStore.d.ts +0 -11
  27. package/dist/components/LogStore.d.ts.map +0 -1
  28. package/dist/components/LogViewer.d.ts +0 -26
  29. package/dist/components/LogViewer.d.ts.map +0 -1
  30. package/dist/components/RobotCard.d.ts +0 -84
  31. package/dist/components/RobotCard.d.ts.map +0 -1
  32. package/dist/components/RobotListItem.d.ts +0 -34
  33. package/dist/components/RobotListItem.d.ts.map +0 -1
  34. package/dist/components/RobotSetupReadinessIndicator.d.ts +0 -31
  35. package/dist/components/RobotSetupReadinessIndicator.d.ts.map +0 -1
  36. package/dist/components/RobotSetupReadinessIndicator.test.d.ts +0 -2
  37. package/dist/components/RobotSetupReadinessIndicator.test.d.ts.map +0 -1
  38. package/src/components/DataGrid.tsx +0 -454
  39. package/src/components/LogPanel.tsx +0 -85
  40. package/src/components/LogStore.ts +0 -40
  41. package/src/components/LogViewer.tsx +0 -297
  42. package/src/components/RobotCard.tsx +0 -576
  43. package/src/components/RobotListItem.tsx +0 -152
  44. package/src/components/RobotSetupReadinessIndicator.test.tsx +0 -60
  45. package/src/components/RobotSetupReadinessIndicator.tsx +0 -124
@@ -1,152 +0,0 @@
1
- import ErrorIcon from "@mui/icons-material/Error"
2
- import { Box, Divider, Typography, useTheme } from "@mui/material"
3
- import { observer } from "mobx-react-lite"
4
- import type { ComponentType } from "react"
5
- import { externalizeComponent } from "../externalizeComponent"
6
- import { RobotIcon } from "../icons"
7
- import {
8
- RobotSetupReadinessIndicator,
9
- RobotSetupReadinessState,
10
- } from "./RobotSetupReadinessIndicator"
11
-
12
- export interface RobotListItemProps {
13
- /** The name of the robot */
14
- robotName: string
15
- /** The type/model of the robot (will try to derive from nova if not provided) */
16
- robotType?: string
17
- /** The current setup readiness state of the robot */
18
- setupState: RobotSetupReadinessState
19
- /**
20
- * Component to render for the precondition indicator.
21
- * Defaults to RobotSetupReadinessIndicator.
22
- * Pass null or undefined to hide the indicator.
23
- */
24
- PreconditionComponent?: ComponentType<{
25
- setupState: RobotSetupReadinessState
26
- }> | null
27
- /** Additional CSS class name */
28
- className?: string
29
- }
30
-
31
- /**
32
- * A list item component that displays robot information and setup readiness state.
33
- *
34
- * Features:
35
- * - Shows robot name, type, and customizable precondition component
36
- * - Color-coded icon based on readiness state (robot icon for ready, warning for issues)
37
- * - Styled with consistent border, background, and spacing
38
- * - Responsive layout with proper spacing and alignment
39
- * - Flexible precondition component that can be customized or hidden
40
- */
41
- export const RobotListItem = externalizeComponent(
42
- observer(
43
- ({
44
- robotName,
45
- robotType,
46
- setupState,
47
- PreconditionComponent = RobotSetupReadinessIndicator,
48
- className,
49
- }: RobotListItemProps) => {
50
- const theme = useTheme()
51
-
52
- // Use provided robot type or default
53
- const displayRobotType = robotType || "Robot"
54
-
55
- const isReady = setupState === RobotSetupReadinessState.READY
56
-
57
- return (
58
- <Box
59
- className={className}
60
- sx={{
61
- border:
62
- "1px solid var(--secondary-_states-outlinedBorder, #FFFFFF1F)",
63
- background: "var(--background-paper-elevation-8, #292B3E)",
64
- height: 80,
65
- minHeight: "80px",
66
- borderRadius: "8px",
67
- padding: "20px",
68
- display: "flex",
69
- alignItems: "center",
70
- justifyContent: "space-between",
71
- opacity: 1,
72
- }}
73
- >
74
- <Box
75
- sx={{
76
- display: "flex",
77
- alignItems: "center",
78
- gap: 2,
79
- flex: 1,
80
- }}
81
- >
82
- {/* Robot/Warning Icon */}
83
- {isReady ? (
84
- <Box
85
- sx={{
86
- fontSize: 24,
87
- display: "flex",
88
- alignItems: "center",
89
- justifyContent: "center",
90
- width: 24,
91
- height: 24,
92
- "& svg": {
93
- fill: "var(--primary-main, #8E56FC) !important",
94
- },
95
- "& svg path": {
96
- fill: "var(--primary-main, #8E56FC) !important",
97
- },
98
- }}
99
- >
100
- <RobotIcon />
101
- </Box>
102
- ) : (
103
- <ErrorIcon
104
- sx={{
105
- color: theme.palette.error.main,
106
- fontSize: 24,
107
- }}
108
- />
109
- )}
110
-
111
- {/* Robot Name */}
112
- <Typography
113
- variant="body1"
114
- sx={{
115
- fontWeight: 500,
116
- color: theme.palette.text.primary,
117
- }}
118
- >
119
- {robotName}
120
- </Typography>
121
-
122
- {/* Divider */}
123
- <Divider
124
- orientation="vertical"
125
- flexItem
126
- sx={{
127
- backgroundColor: theme.palette.text.secondary,
128
- opacity: 0.3,
129
- width: "1px",
130
- }}
131
- />
132
-
133
- {/* Robot Type */}
134
- <Typography
135
- variant="body2"
136
- sx={{
137
- color: theme.palette.text.secondary,
138
- }}
139
- >
140
- {displayRobotType}
141
- </Typography>
142
- </Box>
143
-
144
- {/* Setup Readiness Indicator */}
145
- {PreconditionComponent && (
146
- <PreconditionComponent setupState={setupState} />
147
- )}
148
- </Box>
149
- )
150
- },
151
- ),
152
- )
@@ -1,60 +0,0 @@
1
- import { render, screen } from "@testing-library/react"
2
- import { describe, expect, it } from "vitest"
3
- import {
4
- RobotSetupReadinessIndicator,
5
- RobotSetupReadinessState,
6
- } from "./RobotSetupReadinessIndicator"
7
-
8
- describe("RobotSetupReadinessIndicator", () => {
9
- it("renders ready state correctly", () => {
10
- render(
11
- <RobotSetupReadinessIndicator
12
- setupState={RobotSetupReadinessState.READY}
13
- />,
14
- )
15
-
16
- expect(screen.getByText("Ready")).toBeInTheDocument()
17
- })
18
-
19
- it("renders robot disconnected state correctly", () => {
20
- render(
21
- <RobotSetupReadinessIndicator
22
- setupState={RobotSetupReadinessState.ROBOT_DISCONNECTED}
23
- />,
24
- )
25
-
26
- expect(screen.getByText("Robot disconnected")).toBeInTheDocument()
27
- })
28
-
29
- it("renders precondition not fulfilled state correctly", () => {
30
- render(
31
- <RobotSetupReadinessIndicator
32
- setupState={RobotSetupReadinessState.PRECONDITION_NOT_FULFILLED}
33
- />,
34
- )
35
-
36
- expect(screen.getByText("Precondition not fulfilled")).toBeInTheDocument()
37
- })
38
-
39
- it("applies correct CSS class when provided", () => {
40
- const { container } = render(
41
- <RobotSetupReadinessIndicator
42
- setupState={RobotSetupReadinessState.READY}
43
- className="test-class"
44
- />,
45
- )
46
-
47
- expect(container.firstChild).toHaveClass("test-class")
48
- })
49
-
50
- it("renders indicator circle", () => {
51
- render(
52
- <RobotSetupReadinessIndicator
53
- setupState={RobotSetupReadinessState.READY}
54
- />,
55
- )
56
-
57
- // Check if the component is rendered - it's a chip, not a button
58
- expect(screen.getByText("Ready")).toBeInTheDocument()
59
- })
60
- })
@@ -1,124 +0,0 @@
1
- import { Box, Chip, Typography, useTheme } from "@mui/material"
2
- import { observer } from "mobx-react-lite"
3
- import { useTranslation } from "react-i18next"
4
- import { externalizeComponent } from "../externalizeComponent"
5
-
6
- /**
7
- * Enum representing the robot setup readiness state
8
- */
9
- export enum RobotSetupReadinessState {
10
- /** Preconditions are not fulfilled for robot operation */
11
- PRECONDITION_NOT_FULFILLED = "PRECONDITION_NOT_FULFILLED",
12
- /** Robot is disconnected from the system */
13
- ROBOT_DISCONNECTED = "ROBOT_DISCONNECTED",
14
- /** Robot is ready for operation */
15
- READY = "READY",
16
- }
17
-
18
- export interface RobotSetupReadinessIndicatorProps {
19
- /** The current setup readiness state of the robot */
20
- setupState: RobotSetupReadinessState
21
- /** Additional CSS class name */
22
- className?: string
23
- }
24
-
25
- /**
26
- * A state indicator component that displays the current robot setup readiness state.
27
- *
28
- * Features:
29
- * - Shows three states: Precondition not fulfilled, Robot disconnected, Ready
30
- * - Color-coded based on state (ready: tertiary/main, others: error/main)
31
- * - Rendered as Material-UI filled chip with paper-elevation-11 background
32
- * - Includes colored circle indicator (8px width)
33
- * - Localization support via react-i18next
34
- */
35
- export const RobotSetupReadinessIndicator = externalizeComponent(
36
- observer(({ setupState, className }: RobotSetupReadinessIndicatorProps) => {
37
- const theme = useTheme()
38
- const { t } = useTranslation()
39
-
40
- const getStateInfo = () => {
41
- switch (setupState) {
42
- case RobotSetupReadinessState.READY:
43
- return {
44
- label: t("RobotSetupReadinessIndicator.Ready.lb"),
45
- indicatorColor:
46
- theme.palette.tertiary?.main || theme.palette.primary.main,
47
- backgroundColor:
48
- theme.palette.backgroundPaperElevation?.[11] ||
49
- theme.palette.background.paper,
50
- textColor: "var(--secondary-contrast, #FFFFFFDE)",
51
- }
52
- case RobotSetupReadinessState.ROBOT_DISCONNECTED:
53
- return {
54
- label: t("RobotSetupReadinessIndicator.RobotDisconnected.lb"),
55
- indicatorColor: theme.palette.error.main,
56
- backgroundColor:
57
- theme.palette.backgroundPaperElevation?.[11] ||
58
- theme.palette.background.paper,
59
- textColor: "var(--secondary-contrast, #FFFFFFDE)",
60
- }
61
- case RobotSetupReadinessState.PRECONDITION_NOT_FULFILLED:
62
- default:
63
- return {
64
- label: t(
65
- "RobotSetupReadinessIndicator.PreconditionNotFulfilled.lb",
66
- ),
67
- indicatorColor: theme.palette.error.main,
68
- backgroundColor:
69
- theme.palette.backgroundPaperElevation?.[11] ||
70
- theme.palette.background.paper,
71
- textColor: "var(--secondary-contrast, #FFFFFFDE)",
72
- }
73
- }
74
- }
75
-
76
- const { label, indicatorColor, backgroundColor, textColor } = getStateInfo()
77
-
78
- return (
79
- <Chip
80
- className={className}
81
- label={
82
- <Box
83
- sx={{
84
- display: "flex",
85
- alignItems: "center",
86
- gap: 1,
87
- }}
88
- >
89
- <Box
90
- sx={{
91
- width: 8,
92
- height: 8,
93
- borderRadius: "50%",
94
- backgroundColor: indicatorColor,
95
- flexShrink: 0,
96
- }}
97
- />
98
- <Typography
99
- variant="body2"
100
- sx={{
101
- color: textColor,
102
- fontSize: "0.75rem", // Smaller than body2
103
- lineHeight: 1.2,
104
- }}
105
- >
106
- {label}
107
- </Typography>
108
- </Box>
109
- }
110
- variant="filled"
111
- sx={{
112
- backgroundColor,
113
- color: theme.palette.getContrastText(backgroundColor),
114
- fontWeight: 500,
115
- height: "auto",
116
- "& .MuiChip-label": {
117
- paddingX: 1.5,
118
- paddingY: 0.5,
119
- },
120
- }}
121
- />
122
- )
123
- }),
124
- )