From e80ef2def317307909b1ccb8c3a4c8900753a660 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Wed, 4 Aug 2021 13:17:58 +0300 Subject: [PATCH] Cleaning up Signed-off-by: Alex Andreev --- src/common/catalog/catalog-entity.ts | 5 ++--- .../+catalog/catalog-add-button.tsx | 2 +- .../+catalog/catalog-entity-drawer-menu.tsx | 20 ++++++------------- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/common/catalog/catalog-entity.ts b/src/common/catalog/catalog-entity.ts index 5647f5b0d3..7b9db2f0ff 100644 --- a/src/common/catalog/catalog-entity.ts +++ b/src/common/catalog/catalog-entity.ts @@ -22,7 +22,6 @@ import EventEmitter from "events"; import type TypedEmitter from "typed-emitter"; import { observable, makeObservable } from "mobx"; -import type React from "react"; type ExtractEntityMetadataType = Entity extends CatalogEntity ? Metadata : never; type ExtractEntityStatusType = Entity extends CatalogEntity ? Status : never; @@ -109,7 +108,7 @@ export interface CatalogEntityContextMenu { /** * Menu icon */ - icon?: string | React.ComponentType; + icon?: string; /** * OnClick handler */ @@ -123,7 +122,7 @@ export interface CatalogEntityContextMenu { } export interface CatalogEntityAddMenu extends CatalogEntityContextMenu { - icon: string | React.ComponentType; + icon: string; defaultAction?: boolean; } diff --git a/src/renderer/components/+catalog/catalog-add-button.tsx b/src/renderer/components/+catalog/catalog-add-button.tsx index 7282c53f82..69135fa958 100644 --- a/src/renderer/components/+catalog/catalog-add-button.tsx +++ b/src/renderer/components/+catalog/catalog-add-button.tsx @@ -98,7 +98,7 @@ export class CatalogAddButton extends React.Component { { this.menuItems.map((menuItem, index) => { return : } + icon={} tooltipTitle={menuItem.title} onClick={() => menuItem.onClick()} TooltipClasses={{ diff --git a/src/renderer/components/+catalog/catalog-entity-drawer-menu.tsx b/src/renderer/components/+catalog/catalog-entity-drawer-menu.tsx index b0cca3a97f..ca272003f5 100644 --- a/src/renderer/components/+catalog/catalog-entity-drawer-menu.tsx +++ b/src/renderer/components/+catalog/catalog-entity-drawer-menu.tsx @@ -31,24 +31,11 @@ import { ConfirmDialog } from "../confirm-dialog"; import { HotbarStore } from "../../../common/hotbar-store"; import { Icon } from "../icon"; import type { CatalogEntityItem } from "./catalog-entity.store"; -import { Tooltip } from "@material-ui/core"; export interface CatalogEntityDrawerMenuProps extends MenuActionsProps { item: CatalogEntityItem | null | undefined; } -function resolveIcon(item: CatalogEntityContextMenu) { - if (typeof item.icon === "string") { - if (item.icon.includes("; - } - - return ; - } - - return ; -} - @observer export class CatalogEntityDrawerMenu extends React.Component> { @observable private contextMenu: CatalogEntityContextMenuContext; @@ -99,9 +86,14 @@ export class CatalogEntityDrawerMenu extends React.Comp continue; } + const key = menuItem.icon.includes(" this.onMenuItemClick(menuItem)}> - {resolveIcon(menuItem)} + ); }