From e9d97f46585d6f8440df60b1f6ce88e842e01291 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 29 Sep 2021 16:50:02 -0400 Subject: [PATCH] Make default catalog action to open entity Signed-off-by: Sebastian Malton --- src/renderer/components/+catalog/catalog.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/+catalog/catalog.tsx b/src/renderer/components/+catalog/catalog.tsx index 454a825fd2..49a57c44b0 100644 --- a/src/renderer/components/+catalog/catalog.tsx +++ b/src/renderer/components/+catalog/catalog.tsx @@ -28,7 +28,7 @@ import { action, makeObservable, observable, reaction, runInAction, when } from import { CatalogEntityItem, CatalogEntityStore } from "./catalog-entity.store"; import { navigate } from "../../navigation"; import { MenuItem, MenuActions } from "../menu"; -import type { CatalogEntityContextMenu, CatalogEntityContextMenuContext } from "../../api/catalog-entity"; +import { CatalogEntityContextMenu, CatalogEntityContextMenuContext, catalogEntityRunContext } from "../../api/catalog-entity"; import { HotbarStore } from "../../../common/hotbar-store"; import { ConfirmDialog } from "../confirm-dialog"; import { catalogCategoryRegistry, CatalogEntity } from "../../../common/catalog"; @@ -117,15 +117,16 @@ export class Catalog extends React.Component { } })); } + addToHotbar(item: CatalogEntityItem): void { HotbarStore.getInstance().addToHotbar(item.entity); } onDetails = (item: CatalogEntityItem) => { - if (this.catalogEntityStore.selectedItemId === item.getId()) { + if (this.catalogEntityStore.selectedItemId) { this.catalogEntityStore.selectedItemId = null; } else { - this.catalogEntityStore.selectedItemId = item.getId(); + item.onRun(catalogEntityRunContext); } }; @@ -176,6 +177,9 @@ export class Catalog extends React.Component { return ( + this.catalogEntityStore.selectedItemId = item.getId()}> + View Details + { this.contextMenu.menuItems.map((menuItem, index) => ( this.onMenuItemClick(menuItem)}>