From e3f5bd219b3594ebbf71aa2fe5a08f2d6da83ca6 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Thu, 2 Sep 2021 15:52:50 +0300 Subject: [PATCH] Highlight catalog entity on route match Signed-off-by: Alex Andreev --- src/renderer/components/+catalog/catalog.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/renderer/components/+catalog/catalog.tsx b/src/renderer/components/+catalog/catalog.tsx index 658c91273f..04d31bc95c 100644 --- a/src/renderer/components/+catalog/catalog.tsx +++ b/src/renderer/components/+catalog/catalog.tsx @@ -44,6 +44,7 @@ import { CatalogMenu } from "./catalog-menu"; import { HotbarIcon } from "../hotbar/hotbar-icon"; import { RenderDelay } from "../render-delay/render-delay"; import { TopBar } from "../layout/topbar"; +import { catalogEntityRegistry } from "../../api/catalog-entity-registry"; export const previousActiveTab = createAppStorage("catalog-previous-active-tab", ""); @@ -103,6 +104,19 @@ export class Catalog extends React.Component { } }, {fireImmediately: true}), ]); + this.setActiveEntity(); + } + + componentWillUnmount() { + this.removeActiveEntity(); + } + + setActiveEntity() { + catalogEntityRegistry.activeEntity = catalogEntityRegistry.getById("catalog-entity"); + } + + removeActiveEntity() { + catalogEntityRegistry.activeEntity = null; } addToHotbar(item: CatalogEntityItem): void {