1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Highlight catalog entity on route match

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-09-02 15:52:50 +03:00
parent a709f7ae43
commit e3f5bd219b

View File

@ -44,6 +44,7 @@ import { CatalogMenu } from "./catalog-menu";
import { HotbarIcon } from "../hotbar/hotbar-icon"; import { HotbarIcon } from "../hotbar/hotbar-icon";
import { RenderDelay } from "../render-delay/render-delay"; import { RenderDelay } from "../render-delay/render-delay";
import { TopBar } from "../layout/topbar"; import { TopBar } from "../layout/topbar";
import { catalogEntityRegistry } from "../../api/catalog-entity-registry";
export const previousActiveTab = createAppStorage("catalog-previous-active-tab", ""); export const previousActiveTab = createAppStorage("catalog-previous-active-tab", "");
@ -103,6 +104,19 @@ export class Catalog extends React.Component<Props> {
} }
}, {fireImmediately: true}), }, {fireImmediately: true}),
]); ]);
this.setActiveEntity();
}
componentWillUnmount() {
this.removeActiveEntity();
}
setActiveEntity() {
catalogEntityRegistry.activeEntity = catalogEntityRegistry.getById("catalog-entity");
}
removeActiveEntity() {
catalogEntityRegistry.activeEntity = null;
} }
addToHotbar(item: CatalogEntityItem<CatalogEntity>): void { addToHotbar(item: CatalogEntityItem<CatalogEntity>): void {