-const propertyKey = "Example_menu_item_pressed_count";
-
-interface ExampleProps {
- pressedCount: number;
- className?: string;
-}
-
-const exampleMapStateToProps = (state: RootState) => ({ pressedCount: state.properties[propertyKey] || 0 });
-
-const incrementPressedCount = (dispatch: Dispatch, pressedCount: number) => {
- dispatch(propertiesActions.SET_PROPERTY({ key: propertyKey, value: pressedCount + 1 }));
-};
-
-const ExampleMenuComponent = connect(exampleMapStateToProps)(
- ({ pressedCount, dispatch, className }: ExampleProps & DispatchProp<any>) =>
- <MenuItem className={className} onClick={() => incrementPressedCount(dispatch, pressedCount)}>Example menu item</MenuItem >
-);
-
-const ExamplePluginMainPanel = connect(exampleMapStateToProps)(
- ({ pressedCount }: ExampleProps) =>
- <Card>
- <CardContent>
- <Typography>
- This is a example main panel plugin. The example menu item has been pressed {pressedCount} times.
- </Typography>
- </CardContent>
- </Card>);