|
1 | 1 | import { Button, Content, Header, Select, Space, type SelectProps } from '@pimcore/studio-ui-bundle/components' |
2 | | -import { useWidgetManager } from '@pimcore/studio-ui-bundle/modules/widget-manager' |
| 2 | +import { useWidgetManager, type WidgetManagerTabConfig } from '@pimcore/studio-ui-bundle/modules/widget-manager' |
3 | 3 | import React from 'react' |
4 | 4 |
|
5 | 5 | export const ExampleWidget = (): React.JSX.Element => { |
6 | 6 | const widgetManager = useWidgetManager() |
7 | 7 | const [selectedOption, setSelectedOption] = React.useState<SelectProps['value']>(undefined) |
8 | | - const [selectedWidget, setSelectedWidget] = React.useState<Record<string, any> | undefined>(undefined) |
| 8 | + const [selectedWidget, setSelectedWidget] = React.useState<WidgetManagerTabConfig | undefined>(undefined) |
9 | 9 | const areButtonsDisabled = selectedWidget === undefined |
10 | 10 |
|
11 | | - const widgets = [ |
| 11 | + const widgets: WidgetManagerTabConfig[] = [ |
12 | 12 | { |
13 | 13 | name: 'Example widget', |
14 | 14 | component: 'example-widget', |
@@ -76,32 +76,28 @@ export const ExampleWidget = (): React.JSX.Element => { |
76 | 76 | > |
77 | 77 | <Button |
78 | 78 | disabled={ areButtonsDisabled } |
79 | | - /* @ts-expect-error - type WidgetManagerTabConfig missing */ |
80 | | - onClick={ () => { widgetManager.openMainWidget(selectedWidget) } } |
| 79 | + onClick={ () => { widgetManager.openMainWidget(selectedWidget!) } } |
81 | 80 | > |
82 | 81 | Open main widget |
83 | 82 | </Button> |
84 | 83 |
|
85 | 84 | <Button |
86 | 85 | disabled={ areButtonsDisabled } |
87 | | - /* @ts-expect-error - type WidgetManagerTabConfig missing */ |
88 | | - onClick={ () => { widgetManager.openLeftWidget(selectedWidget) } } |
| 86 | + onClick={ () => { widgetManager.openLeftWidget(selectedWidget!) } } |
89 | 87 | > |
90 | 88 | Open left widget |
91 | 89 | </Button> |
92 | 90 |
|
93 | 91 | <Button |
94 | 92 | disabled={ areButtonsDisabled } |
95 | | - /* @ts-expect-error - type WidgetManagerTabConfig missing */ |
96 | | - onClick={ () => { widgetManager.openRightWidget(selectedWidget) } } |
| 93 | + onClick={ () => { widgetManager.openRightWidget(selectedWidget!) } } |
97 | 94 | > |
98 | 95 | Open right widget |
99 | 96 | </Button> |
100 | 97 |
|
101 | 98 | <Button |
102 | 99 | disabled={ areButtonsDisabled } |
103 | | - /* @ts-expect-error - type WidgetManagerTabConfig missing */ |
104 | | - onClick={ () => { widgetManager.openBottomWidget(selectedWidget) } } |
| 100 | + onClick={ () => { widgetManager.openBottomWidget(selectedWidget!) } } |
105 | 101 | > |
106 | 102 | Open bottom widget |
107 | 103 | </Button> |
|
0 commit comments