Skip to content

Commit f61f618

Browse files
committed
Fix widget types
1 parent c3357f1 commit f61f618

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

assets/js/src/examples/custom-widgets/components/example-widget.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
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'
33
import React from 'react'
44

55
export const ExampleWidget = (): React.JSX.Element => {
66
const widgetManager = useWidgetManager()
77
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)
99
const areButtonsDisabled = selectedWidget === undefined
1010

11-
const widgets = [
11+
const widgets: WidgetManagerTabConfig[] = [
1212
{
1313
name: 'Example widget',
1414
component: 'example-widget',
@@ -76,32 +76,28 @@ export const ExampleWidget = (): React.JSX.Element => {
7676
>
7777
<Button
7878
disabled={ areButtonsDisabled }
79-
/* @ts-expect-error - type WidgetManagerTabConfig missing */
80-
onClick={ () => { widgetManager.openMainWidget(selectedWidget) } }
79+
onClick={ () => { widgetManager.openMainWidget(selectedWidget!) } }
8180
>
8281
Open main widget
8382
</Button>
8483

8584
<Button
8685
disabled={ areButtonsDisabled }
87-
/* @ts-expect-error - type WidgetManagerTabConfig missing */
88-
onClick={ () => { widgetManager.openLeftWidget(selectedWidget) } }
86+
onClick={ () => { widgetManager.openLeftWidget(selectedWidget!) } }
8987
>
9088
Open left widget
9189
</Button>
9290

9391
<Button
9492
disabled={ areButtonsDisabled }
95-
/* @ts-expect-error - type WidgetManagerTabConfig missing */
96-
onClick={ () => { widgetManager.openRightWidget(selectedWidget) } }
93+
onClick={ () => { widgetManager.openRightWidget(selectedWidget!) } }
9794
>
9895
Open right widget
9996
</Button>
10097

10198
<Button
10299
disabled={ areButtonsDisabled }
103-
/* @ts-expect-error - type WidgetManagerTabConfig missing */
104-
onClick={ () => { widgetManager.openBottomWidget(selectedWidget) } }
100+
onClick={ () => { widgetManager.openBottomWidget(selectedWidget!) } }
105101
>
106102
Open bottom widget
107103
</Button>

0 commit comments

Comments
 (0)