diff --git a/src/renderer/components/+landing-page/landing-page.tsx b/src/renderer/components/+landing-page/landing-page.tsx index f12c21e1c2..917c75e419 100644 --- a/src/renderer/components/+landing-page/landing-page.tsx +++ b/src/renderer/components/+landing-page/landing-page.tsx @@ -11,6 +11,7 @@ import { MenuItem, MenuActions } from "../menu"; import { Icon } from "../icon"; import { CatalogEntityContextMenuContext } from "../../api/catalog-entity-registry"; import { Badge } from "../badge"; +import { hotbarStore } from "../../../common/hotbar-store"; enum sortBy { name = "name", @@ -31,6 +32,26 @@ export class LandingPage extends React.Component { this.disposers.forEach((d) => d()); } + addToHotbar(item: CatalogEntityItem) { + const hotbar = hotbarStore.getByName("default"); // FIXME + + if (!hotbar) { + return; + } + + hotbar.items.push({ entity: { uid: item.id }}); + } + + removeFromHotbar(item: CatalogEntityItem) { + const hotbar = hotbarStore.getByName("default"); // FIXME + + if (!hotbar) { + return; + } + + hotbar.items = hotbar.items.filter((i) => i.entity.uid !== item.id); + } + render() { if (!this.catalogEntityStore) { return null; @@ -70,6 +91,12 @@ export class LandingPage extends React.Component { return ( + this.addToHotbar(item) }> + Add to Hotbar + + this.removeFromHotbar(item) }> + Remove from Hotbar + { menuOpenContext.menuItems.map((menuItem) => { return ( menuItem.onClick()}>