diff --git a/src/renderer/components/layout/sidebar-cluster.tsx b/src/renderer/components/layout/sidebar-cluster.tsx index 9cf6367c25..e9e81cac02 100644 --- a/src/renderer/components/layout/sidebar-cluster.tsx +++ b/src/renderer/components/layout/sidebar-cluster.tsx @@ -80,7 +80,7 @@ export function SidebarCluster({ clusterEntity }: { clusterEntity: CatalogEntity contextMenu.menuItems = [{ title, onClick }]; clusterEntity.onContextMenuOpen(contextMenu); - setOpened(true); + toggle(); }; const toggle = () => { diff --git a/src/renderer/components/layout/sidebar.tsx b/src/renderer/components/layout/sidebar.tsx index a9a79c1d1b..702a7a61d2 100644 --- a/src/renderer/components/layout/sidebar.tsx +++ b/src/renderer/components/layout/sidebar.tsx @@ -32,7 +32,7 @@ import { Storage } from "../+storage"; import { Network } from "../+network"; import { crdStore } from "../+custom-resources/crd.store"; import { CustomResources } from "../+custom-resources/custom-resources"; -import { isActiveRoute, navigate } from "../../navigation"; +import { isActiveRoute } from "../../navigation"; import { isAllowedResource } from "../../../common/utils/allowed-resource"; import { Spinner } from "../spinner"; import { ClusterPageMenuRegistration, ClusterPageMenuRegistry, ClusterPageRegistry, getExtensionPageUrl } from "../../../extensions/registries"; @@ -41,12 +41,6 @@ import { Apps } from "../+apps"; import * as routes from "../../../common/routes"; import { Config } from "../+config"; import { catalogEntityRegistry } from "../../api/catalog-entity-registry"; -import { HotbarIcon } from "../hotbar/hotbar-icon"; -import { makeObservable, observable } from "mobx"; -import type { CatalogEntityContextMenuContext } from "../../../common/catalog"; -import { HotbarStore } from "../../../common/hotbar-store"; -import { broadcastMessage } from "../../../common/ipc"; -import { IpcRendererNavigationEvents } from "../../navigation/events"; import { SidebarCluster } from "./sidebar-cluster"; interface Props { @@ -56,21 +50,6 @@ interface Props { @observer export class Sidebar extends React.Component { static displayName = "Sidebar"; - @observable private contextMenu: CatalogEntityContextMenuContext = { - menuItems: [], - navigate: (url: string, forceMainFrame = true) => { - if (forceMainFrame) { - broadcastMessage(IpcRendererNavigationEvents.NAVIGATE_IN_APP, url); - } else { - navigate(url); - } - }, - }; - - constructor(props: Props) { - super(props); - makeObservable(this); - } async componentDidMount() { crdStore.reloadAll(); @@ -199,45 +178,6 @@ export class Sidebar extends React.Component { }); } - renderCluster() { - if (!this.clusterEntity) { - return null; - } - - const { metadata, spec } = this.clusterEntity; - - return ( -
- navigate("/")} - menuItems={this.contextMenu.menuItems} - onMenuOpen={() => { - const hotbarStore = HotbarStore.getInstance(); - const isAddedToActive = HotbarStore.getInstance().isAddedToActive(this.clusterEntity); - const title = isAddedToActive - ? "Remove from Hotbar" - : "Add to Hotbar"; - const onClick = isAddedToActive - ? () => hotbarStore.removeFromHotbar(metadata.uid) - : () => hotbarStore.addToHotbar(this.clusterEntity); - - this.contextMenu.menuItems = [{ title, onClick }]; - this.clusterEntity.onContextMenuOpen(this.contextMenu); - }} - /> -
- {metadata.name} -
- -
- ); - } - get clusterEntity() { return catalogEntityRegistry.activeEntity; } @@ -247,7 +187,6 @@ export class Sidebar extends React.Component { return (
- {/* {this.renderCluster()} */}