@wandelbots/wandelbots-js-react-components 2.34.2-pr.feature-robot-precondition-list.372.9dfd57e → 2.34.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.
Files changed (65) hide show
  1. package/dist/components/CycleTimer.d.ts +16 -33
  2. package/dist/components/CycleTimer.d.ts.map +1 -1
  3. package/dist/components/ProgramControl.d.ts +2 -8
  4. package/dist/components/ProgramControl.d.ts.map +1 -1
  5. package/dist/components/ProgramStateIndicator.d.ts +1 -1
  6. package/dist/components/ProgramStateIndicator.d.ts.map +1 -1
  7. package/dist/components/robots/Robot.d.ts +2 -3
  8. package/dist/components/robots/Robot.d.ts.map +1 -1
  9. package/dist/icons/index.d.ts +0 -1
  10. package/dist/icons/index.d.ts.map +1 -1
  11. package/dist/index.cjs +50 -50
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.ts +0 -10
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +9576 -11435
  16. package/dist/index.js.map +1 -1
  17. package/dist/themes/createDarkTheme.d.ts.map +1 -1
  18. package/package.json +1 -2
  19. package/src/components/CycleTimer.tsx +159 -384
  20. package/src/components/ProgramControl.tsx +12 -27
  21. package/src/components/ProgramStateIndicator.tsx +8 -25
  22. package/src/components/robots/Robot.tsx +2 -5
  23. package/src/i18n/locales/de/translations.json +1 -8
  24. package/src/i18n/locales/en/translations.json +1 -8
  25. package/src/icons/index.ts +0 -1
  26. package/src/index.ts +0 -14
  27. package/src/themes/createDarkTheme.ts +1 -75
  28. package/dist/components/AppHeader.d.ts +0 -34
  29. package/dist/components/AppHeader.d.ts.map +0 -1
  30. package/dist/components/DataGrid.d.ts +0 -66
  31. package/dist/components/DataGrid.d.ts.map +0 -1
  32. package/dist/components/LogPanel.d.ts +0 -38
  33. package/dist/components/LogPanel.d.ts.map +0 -1
  34. package/dist/components/LogStore.d.ts +0 -12
  35. package/dist/components/LogStore.d.ts.map +0 -1
  36. package/dist/components/LogViewer.d.ts +0 -46
  37. package/dist/components/LogViewer.d.ts.map +0 -1
  38. package/dist/components/RobotCard.d.ts +0 -103
  39. package/dist/components/RobotCard.d.ts.map +0 -1
  40. package/dist/components/RobotListItem.d.ts +0 -34
  41. package/dist/components/RobotListItem.d.ts.map +0 -1
  42. package/dist/components/RobotSetupReadinessIndicator.d.ts +0 -31
  43. package/dist/components/RobotSetupReadinessIndicator.d.ts.map +0 -1
  44. package/dist/components/RobotSetupReadinessIndicator.test.d.ts +0 -2
  45. package/dist/components/RobotSetupReadinessIndicator.test.d.ts.map +0 -1
  46. package/dist/components/TabBar.d.ts +0 -30
  47. package/dist/components/TabBar.d.ts.map +0 -1
  48. package/dist/components/robots/manufacturerHomePositions.d.ts +0 -21
  49. package/dist/components/robots/manufacturerHomePositions.d.ts.map +0 -1
  50. package/dist/icons/DropdownArrowIcon.d.ts +0 -3
  51. package/dist/icons/DropdownArrowIcon.d.ts.map +0 -1
  52. package/src/components/AppHeader.md +0 -84
  53. package/src/components/AppHeader.tsx +0 -199
  54. package/src/components/DataGrid.tsx +0 -659
  55. package/src/components/LogPanel.tsx +0 -69
  56. package/src/components/LogStore.ts +0 -44
  57. package/src/components/LogViewer.tsx +0 -370
  58. package/src/components/RobotCard.tsx +0 -568
  59. package/src/components/RobotListItem.tsx +0 -150
  60. package/src/components/RobotSetupReadinessIndicator.test.tsx +0 -60
  61. package/src/components/RobotSetupReadinessIndicator.tsx +0 -124
  62. package/src/components/TabBar.tsx +0 -144
  63. package/src/components/robots/manufacturerHomePositions.ts +0 -76
  64. package/src/icons/DropdownArrowIcon.tsx +0 -13
  65. package/src/icons/chevronDown.svg +0 -3
@@ -1,103 +0,0 @@
1
- import type { ConnectedMotionGroup, RobotControllerStateOperationModeEnum, RobotControllerStateSafetyStateEnum } from "@wandelbots/nova-js/v1";
2
- import type { Group } from "three";
3
- import type { ProgramState } from "./ProgramControl";
4
- export interface RobotCardProps {
5
- /** Name of the robot displayed at the top */
6
- robotName: string;
7
- /** Current program state */
8
- programState: ProgramState;
9
- /** Current safety state of the robot controller */
10
- safetyState: RobotControllerStateSafetyStateEnum;
11
- /** Current operation mode of the robot controller */
12
- operationMode: RobotControllerStateOperationModeEnum;
13
- /** Whether the "Drive to Home" button should be enabled */
14
- driveToHomeEnabled?: boolean;
15
- /** Callback fired when "Drive to Home" button is pressed */
16
- onDriveToHomePress?: () => void;
17
- /** Callback fired when "Drive to Home" button is released */
18
- onDriveToHomeRelease?: () => void;
19
- /**
20
- * Callback fired when "Drive to Home" button is pressed, with the default home position.
21
- * If provided, this will be called instead of onDriveToHomePress, providing the recommended
22
- * home position joint configuration based on the robot manufacturer.
23
- */
24
- onDriveToHomePressWithConfig?: (homePosition: number[]) => void;
25
- /**
26
- * Callback fired when "Drive to Home" button is released after using onDriveToHomePressWithConfig.
27
- * If provided, this will be called instead of onDriveToHomeRelease.
28
- */
29
- onDriveToHomeReleaseWithConfig?: () => void;
30
- /**
31
- * Custom default joint configuration to use if manufacturer-based defaults are not available.
32
- * Joint values should be in radians.
33
- */
34
- defaultJointConfig?: number[];
35
- /** Connected motion group for the robot */
36
- connectedMotionGroup: ConnectedMotionGroup;
37
- /** Custom robot component to render (optional, defaults to Robot) */
38
- robotComponent?: React.ComponentType<{
39
- connectedMotionGroup: ConnectedMotionGroup;
40
- flangeRef?: React.Ref<Group>;
41
- postModelRender?: () => void;
42
- transparentColor?: string;
43
- getModel?: (modelFromController: string) => string;
44
- }>;
45
- /** Custom cycle timer component (optional, defaults to CycleTimer) */
46
- cycleTimerComponent?: React.ComponentType<{
47
- variant?: "default" | "small";
48
- compact?: boolean;
49
- onCycleComplete: (controls: {
50
- startNewCycle: (maxTimeSeconds?: number, elapsedSeconds?: number) => void;
51
- pause: () => void;
52
- resume: () => void;
53
- isPaused: () => boolean;
54
- }) => void;
55
- onCycleEnd?: () => void;
56
- autoStart?: boolean;
57
- hasError?: boolean;
58
- className?: string;
59
- }>;
60
- /** Callback to receive cycle timer controls for external timer management */
61
- onCycleTimerReady?: (controls: {
62
- startNewCycle: (maxTimeSeconds?: number, elapsedSeconds?: number) => void;
63
- pause: () => void;
64
- resume: () => void;
65
- isPaused: () => boolean;
66
- }) => void;
67
- /** Callback fired when a cycle completes (reaches zero) */
68
- onCycleEnd?: () => void;
69
- /** Whether the cycle timer should auto-start when a new cycle is set */
70
- cycleTimerAutoStart?: boolean;
71
- /** Whether the cycle timer is in an error state (pauses timer and shows error styling) */
72
- cycleTimerHasError?: boolean;
73
- /** Additional CSS class name */
74
- className?: string;
75
- }
76
- /**
77
- * A responsive card component that displays a 3D robot with states and controls.
78
- * The card automatically adapts to its container's size and aspect ratio.
79
- *
80
- * Features:
81
- * - Fully responsive Material-UI Card that adapts to container dimensions
82
- * - Automatic layout switching based on aspect ratio:
83
- * - Portrait mode: Vertical layout with robot in center
84
- * - Landscape mode: Horizontal layout with robot on left, content on right (left-aligned)
85
- * - Responsive 3D robot rendering:
86
- * - Scales dynamically with container size
87
- * - Hides at very small sizes to preserve usability
88
- * - Adaptive margin based on available space
89
- * - Smart spacing and padding that reduces at smaller sizes
90
- * - Minimum size constraints for usability while maximizing content density
91
- * - Robot name displayed in Typography h6 at top-left
92
- * - Program state indicator below the name
93
- * - Auto-fitting 3D robot model that scales with container size
94
- * - Compact cycle time component with small variant, error state, and count-up/count-down mode support
95
- * - Transparent gray divider line
96
- * - "Drive to Home" button with press-and-hold functionality
97
- * - Localization support via react-i18next
98
- * - Material-UI theming integration
99
- */
100
- export declare const RobotCard: (({ robotName, programState, safetyState, operationMode, driveToHomeEnabled, onDriveToHomePress, onDriveToHomeRelease, connectedMotionGroup, robotComponent: RobotComponent, cycleTimerComponent: CycleTimerComponent, onCycleTimerReady, onCycleEnd, cycleTimerAutoStart, cycleTimerHasError, className, }: RobotCardProps) => import("react/jsx-runtime").JSX.Element) & {
101
- displayName: string;
102
- };
103
- //# sourceMappingURL=RobotCard.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RobotCard.d.ts","sourceR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- import { RobotSetupReadinessState } from "./RobotSetupReadinessIndicator";
3
- export interface RobotListItemProps {
4
- /** The name of the robot */
5
- robotName: string;
6
- /** The type/model of the robot (will try to derive from nova if not provided) */
7
- robotType?: string;
8
- /** The current setup readiness state of the robot */
9
- setupState: RobotSetupReadinessState;
10
- /**
11
- * Component to render for the precondition indicator.
12
- * Defaults to RobotSetupReadinessIndicator.
13
- * Pass null or undefined to hide the indicator.
14
- */
15
- PreconditionComponent?: ComponentType<{
16
- setupState: RobotSetupReadinessState;
17
- }> | null;
18
- /** Additional CSS class name */
19
- className?: string;
20
- }
21
- /**
22
- * A list item component that displays robot information and setup readiness state.
23
- *
24
- * Features:
25
- * - Shows robot name, type, and customizable precondition component
26
- * - Color-coded icon based on readiness state (robot icon for ready, warning for issues)
27
- * - Styled with consistent border, background, and spacing
28
- * - Responsive layout with proper spacing and alignment
29
- * - Flexible precondition component that can be customized or hidden
30
- */
31
- export declare const RobotListItem: (({ robotName, robotType, setupState, PreconditionComponent, className, }: RobotListItemProps) => import("react/jsx-runtime").JSX.Element) & {
32
- displayName: string;
33
- };
34
- //# sourceMappingURL=RobotListItem.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RobotListItem.d.ts","sourceRoot":"","sources":["../../src/components/RobotListItem.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAG1C,OAAO,EAEL,wBAAwB,EACzB,MAAM,gCAAgC,CAAA;AAEvC,MAAM,WAAW,kBAAkB;IACjC,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,iFAAiF;IACjF,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,qDAAqD;IACrD,UAAU,EAAE,wBAAwB,CAAA;IACpC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,aAAa,CAAC;QACpC,UAAU,EAAE,wBAAwB,CAAA;KACrC,CAAC,GAAG,IAAI,CAAA;IACT,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,6EAQnB,kBAAkB;;CAqGxB,CAAA"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Enum representing the robot setup readiness state
3
- */
4
- export declare enum RobotSetupReadinessState {
5
- /** Preconditions are not fulfilled for robot operation */
6
- PRECONDITION_NOT_FULFILLED = "PRECONDITION_NOT_FULFILLED",
7
- /** Robot is disconnected from the system */
8
- ROBOT_DISCONNECTED = "ROBOT_DISCONNECTED",
9
- /** Robot is ready for operation */
10
- READY = "READY"
11
- }
12
- export interface RobotSetupReadinessIndicatorProps {
13
- /** The current setup readiness state of the robot */
14
- setupState: RobotSetupReadinessState;
15
- /** Additional CSS class name */
16
- className?: string;
17
- }
18
- /**
19
- * A state indicator component that displays the current robot setup readiness state.
20
- *
21
- * Features:
22
- * - Shows three states: Precondition not fulfilled, Robot disconnected, Ready
23
- * - Color-coded based on state (ready: tertiary/main, others: error/main)
24
- * - Rendered as Material-UI filled chip with paper-elevation-11 background
25
- * - Includes colored circle indicator (8px width)
26
- * - Localization support via react-i18next
27
- */
28
- export declare const RobotSetupReadinessIndicator: (({ setupState, className }: RobotSetupReadinessIndicatorProps) => import("react/jsx-runtime").JSX.Element) & {
29
- displayName: string;
30
- };
31
- //# sourceMappingURL=RobotSetupReadinessIndicator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RobotSetupReadinessIndicator.d.ts","sourceRoot":"","sources":["../../src/components/RobotSetupReadinessIndicator.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,oBAAY,wBAAwB;IAClC,0DAA0D;IAC1D,0BAA0B,+BAA+B;IACzD,4CAA4C;IAC5C,kBAAkB,uBAAuB;IACzC,mCAAmC;IACnC,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,iCAAiC;IAChD,qDAAqD;IACrD,UAAU,EAAE,wBAAwB,CAAA;IACpC,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,+BACF,iCAAiC;;CAwFvE,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=RobotSetupReadinessIndicator.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RobotSetupReadinessIndicator.test.d.ts","sourceRoot":"","sources":["../../src/components/RobotSetupReadinessIndicator.test.tsx"],"names":[],"mappings":""}
@@ -1,30 +0,0 @@
1
- import type { SxProps } from "@mui/material";
2
- export interface TabItem {
3
- /** Unique identifier for the tab */
4
- id: string;
5
- /** Label text for the tab */
6
- label: string;
7
- /** Content to display when tab is active */
8
- content: React.ReactNode;
9
- /** Optional icon component to display with the tab */
10
- icon?: React.ReactElement;
11
- }
12
- export interface TabBarProps {
13
- /** Array of tab items to display */
14
- items: TabItem[];
15
- /** Default active tab index */
16
- defaultActiveTab?: number;
17
- /** Callback when tab changes */
18
- onTabChange?: (index: number) => void;
19
- /** Additional styling */
20
- sx?: SxProps;
21
- }
22
- /**
23
- * A styled tab bar component with configurable tabs and content.
24
- * Features the same styling as the Wandelbots design system with rounded tabs
25
- * and smooth transitions.
26
- */
27
- export declare const TabBar: ((props: TabBarProps) => import("react/jsx-runtime").JSX.Element) & {
28
- displayName: string;
29
- };
30
- //# sourceMappingURL=TabBar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../src/components/TabBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAM5C,MAAM,WAAW,OAAO;IACtB,oCAAoC;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,4CAA4C;IAC5C,OAAO,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,sDAAsD;IACtD,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,KAAK,EAAE,OAAO,EAAE,CAAA;IAChB,+BAA+B;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gCAAgC;IAChC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,yBAAyB;IACzB,EAAE,CAAC,EAAE,OAAO,CAAA;CACb;AAwBD;;;;GAIG;AACH,eAAO,MAAM,MAAM,WACA,WAAW;;CAuF7B,CAAA"}
@@ -1,21 +0,0 @@
1
- import { Manufacturer } from "@wandelbots/nova-api/v1";
2
- /**
3
- * Default home configs for different robot manufacturers.
4
- * These joint configurations represent safe home configs for each manufacturer's robots.
5
- * All angles are in radians.
6
- */
7
- export declare const MANUFACTURER_HOME_CONFIGS: Record<Manufacturer, number[]>;
8
- /**
9
- * Extracts manufacturer from modelFromController string.
10
- * @param modelFromController - String in format "Manufacturer_ModelName"
11
- * @returns Manufacturer enum value or null if not recognized
12
- */
13
- export declare function extractManufacturer(modelFromController: string): Manufacturer | null;
14
- /**
15
- * Gets the default home config for a robot based on its model identifier.
16
- * @param modelFromController - String in format "Manufacturer_ModelName"
17
- * @param defaultJointConfig - Optional custom default configuration to use if manufacturer not found
18
- * @returns Array of joint positions in radians, or null if no configuration available
19
- */
20
- export declare function getDefaultHomeConfig(modelFromController: string, defaultJointConfig?: number[]): number[] | null;
21
- //# sourceMappingURL=manufacturerHomePositions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"manufacturerHomePositions.d.ts","sourceRoot":"","sources":["../../../src/components/robots/manufacturerHomePositions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEtD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,CAsBpE,CAAA;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,mBAAmB,EAAE,MAAM,GAC1B,YAAY,GAAG,IAAI,CAkBrB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,mBAAmB,EAAE,MAAM,EAC3B,kBAAkB,CAAC,EAAE,MAAM,EAAE,GAC5B,MAAM,EAAE,GAAG,IAAI,CAQjB"}
@@ -1,3 +0,0 @@
1
- import { type SvgIconProps } from "@mui/material";
2
- export declare const DropdownArrowIcon: (props: SvgIconProps) => import("react/jsx-runtime").JSX.Element;
3
- //# sourceMappingURL=DropdownArrowIcon.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DropdownArrowIcon.d.ts","sourceRoot":"","sources":["../../src/icons/DropdownArrowIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAE1D,eAAO,MAAM,iBAAiB,GAAI,OAAO,YAAY,4CAUpD,CAAA"}
@@ -1,84 +0,0 @@
1
- # AppHeader Component
2
-
3
- A navigation header component that displays the current application's icon and name, with an optional dropdown menu for switching between different applications.
4
-
5
- ## Features
6
-
7
- - **App Branding**: Displays the current app's icon and name with custom typography
8
- - **App Switching**: Dropdown menu with blur backdrop for navigating to other apps
9
- - **Responsive Design**: Uses MUI AppBar for consistent styling
10
- - **Accessibility**: Proper ARIA labels and keyboard navigation
11
- - **Flexible Navigation**: Supports both URL navigation and custom click handlers
12
-
13
- ## Usage
14
-
15
- ```tsx
16
- import {
17
- AppHeader,
18
- type AppItem,
19
- } from "@wandelbots/wandelbots-js-react-components"
20
- import { Home, Settings, Person } from "@mui/icons-material"
21
-
22
- const apps: AppItem[] = [
23
- {
24
- id: "dashboard",
25
- name: "Dashboard",
26
- icon: <Home />,
27
- href: "/dashboard",
28
- },
29
- {
30
- id: "settings",
31
- name: "Settings",
32
- icon: <Settings />,
33
- onClick: () => navigateToSettings(),
34
- },
35
- ]
36
-
37
- function MyApp() {
38
- return (
39
- <AppHeader
40
- appIcon={<Person />}
41
- appName="Robot Control Studio"
42
- apps={apps}
43
- onAppSelect={(app) => console.log("Selected:", app.name)}
44
- />
45
- )
46
- }
47
- ```
48
-
49
- ## Props
50
-
51
- ### AppHeaderProps
52
-
53
- - **appIcon** (`ReactNode`): Icon component for the current application
54
- - **appName** (`string`): Display name of the current application
55
- - **apps** (`AppItem[]`, optional): Array of available apps for the dropdown menu
56
- - **onAppSelect** (`(app: AppItem) => void`, optional): Callback when an app is selected
57
- - **sx** (`SxProps`, optional): Additional MUI styling
58
-
59
- ### AppItem
60
-
61
- - **id** (`string`): Unique identifier for the app
62
- - **name** (`string`): Display name of the app
63
- - **icon** (`ReactNode`): Icon component to display
64
- - **href** (`string`, optional): URL to navigate to
65
- - **onClick** (`() => void`, optional): Custom click handler
66
-
67
- ## Styling
68
-
69
- The component uses the specified typography:
70
-
71
- - Font weight: 700 (Bold)
72
- - Font size: 20px
73
- - Line height: 24px
74
- - Letter spacing: 0px
75
-
76
- The dropdown arrow uses a custom SVG icon with 56% opacity.
77
-
78
- ## Behavior
79
-
80
- - When apps are provided, a dropdown arrow appears on the right side
81
- - Clicking the arrow opens a menu with available apps
82
- - The background blurs when the menu is open to focus attention
83
- - Apps can navigate via URL (`href`) or custom handler (`onClick`)
84
- - The menu closes automatically when an app is selected or when clicking outside
@@ -1,199 +0,0 @@
1
- import {
2
- alpha,
3
- AppBar,
4
- Backdrop,
5
- Box,
6
- IconButton,
7
- Menu,
8
- MenuItem,
9
- type SxProps,
10
- Toolbar,
11
- Typography,
12
- } from "@mui/material"
13
- import { observer } from "mobx-react-lite"
14
- import { type MouseEvent, type ReactNode, useState } from "react"
15
- import { externalizeComponent } from "../externalizeComponent"
16
- import { DropdownArrowIcon } from "../icons/DropdownArrowIcon"
17
-
18
- export type AppItem = {
19
- /** Unique identifier for the app */
20
- id: string
21
- /** Display name of the app */
22
- name: string
23
- /** Icon component to display */
24
- icon: ReactNode
25
- /** URL or callback to navigate to the app */
26
- href?: string
27
- /** Click handler for the app */
28
- onClick?: () => void
29
- }
30
-
31
- export type AppHeaderProps = {
32
- /** Current app icon */
33
- appIcon: ReactNode
34
- /** Current app name */
35
- appName: string
36
- /** List of other available apps */
37
- apps?: AppItem[]
38
- /** Callback when an app is selected */
39
- onAppSelect?: (app: AppItem) => void
40
- /** Additional styling */
41
- sx?: SxProps
42
- }
43
-
44
- /**
45
- * A top navigation header component that displays the current app and provides
46
- * a dropdown menu to navigate to other apps.
47
- */
48
- export const AppHeader = externalizeComponent(
49
- observer((props: AppHeaderProps) => {
50
- const { appIcon, appName, apps = [], onAppSelect, sx } = props
51
- const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null)
52
- const isMenuOpen = Boolean(anchorEl)
53
-
54
- const handleMenuOpen = (event: MouseEvent<HTMLElement>) => {
55
- setAnchorEl(event.currentTarget)
56
- }
57
-
58
- const handleMenuClose = () => {
59
- setAnchorEl(null)
60
- }
61
-
62
- const handleAppSelect = (app: AppItem) => {
63
- handleMenuClose()
64
-
65
- if (app.onClick) {
66
- app.onClick()
67
- } else if (app.href) {
68
- window.location.href = app.href
69
- }
70
-
71
- onAppSelect?.(app)
72
- }
73
-
74
- return (
75
- <>
76
- <AppBar
77
- position="static"
78
- sx={{
79
- boxShadow: "none",
80
- backgroundImage: "none",
81
- "& .MuiAppBar-root": {
82
- backgroundImage: "none",
83
- backgroundColor: "transparent",
84
- },
85
- ...sx,
86
- }}
87
- >
88
- <Toolbar sx={{ minHeight: "64px !important" }}>
89
- {/* App Icon */}
90
- <Box sx={{ mr: 2, display: "flex", alignItems: "center" }}>
91
- {appIcon}
92
- </Box>
93
-
94
- {/* App Name and Dropdown */}
95
- <Box sx={{ display: "flex", alignItems: "center", flexGrow: 1 }}>
96
- <Typography
97
- variant="h6"
98
- component="div"
99
- sx={{
100
- fontWeight: 700,
101
- fontSize: "20px",
102
- lineHeight: "24px",
103
- letterSpacing: 0,
104
- }}
105
- >
106
- {appName}
107
- </Typography>
108
-
109
- {/* Dropdown Button */}
110
- {apps.length > 0 && (
111
- <IconButton
112
- color="inherit"
113
- aria-label="switch app"
114
- aria-controls="app-menu"
115
- aria-haspopup="true"
116
- onClick={handleMenuOpen}
117
- sx={{
118
- ml: 2,
119
- width: 30,
120
- height: 30,
121
- borderRadius: "8px",
122
- padding: "5px",
123
- backgroundColor: (theme) =>
124
- alpha(theme.palette.common.white, 0.1),
125
- opacity: 1,
126
- "&:hover": {
127
- backgroundColor: (theme) =>
128
- alpha(theme.palette.common.white, 0.16),
129
- },
130
- "& .MuiSvgIcon-root": {
131
- fontSize: "10px",
132
- width: "10px",
133
- height: "8px",
134
- },
135
- }}
136
- >
137
- <DropdownArrowIcon />
138
- </IconButton>
139
- )}
140
- </Box>
141
- </Toolbar>
142
- </AppBar>
143
-
144
- {/* Backdrop for blur effect */}
145
- <Backdrop
146
- open={isMenuOpen}
147
- onClick={handleMenuClose}
148
- sx={{
149
- backdropFilter: "blur(4px)",
150
- backgroundColor: "rgba(0, 0, 0, 0.3)",
151
- zIndex: (theme) => theme.zIndex.modal - 1,
152
- }}
153
- />
154
-
155
- {/* Dropdown Menu */}
156
- <Menu
157
- id="app-menu"
158
- anchorEl={anchorEl}
159
- open={isMenuOpen}
160
- onClose={handleMenuClose}
161
- anchorOrigin={{
162
- vertical: "bottom",
163
- horizontal: "left",
164
- }}
165
- transformOrigin={{
166
- vertical: "top",
167
- horizontal: "left",
168
- }}
169
- sx={{
170
- zIndex: (theme) => theme.zIndex.modal,
171
- "& .MuiPaper-root": {
172
- minWidth: 200,
173
- mt: 1,
174
- },
175
- }}
176
- >
177
- {apps.map((app) => (
178
- <MenuItem
179
- key={app.id}
180
- onClick={() => handleAppSelect(app)}
181
- sx={{
182
- display: "flex",
183
- alignItems: "center",
184
- gap: 2,
185
- py: 1.5,
186
- px: 2,
187
- }}
188
- >
189
- <Box sx={{ display: "flex", alignItems: "center" }}>
190
- {app.icon}
191
- </Box>
192
- <Typography variant="body1">{app.name}</Typography>
193
- </MenuItem>
194
- ))}
195
- </Menu>
196
- </>
197
- )
198
- }),
199
- )