mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Passing id to status-bar-items
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
4e02ccb1c7
commit
3f42f73994
@ -7,6 +7,7 @@ import type { IComputedValue } from "mobx";
|
||||
import type React from "react";
|
||||
|
||||
export interface StatusBarItem {
|
||||
id?: string;
|
||||
component: React.ComponentType<any>;
|
||||
position: "left" | "right";
|
||||
visible: IComputedValue<boolean>;
|
||||
|
||||
@ -74,6 +74,7 @@ const toItemInjectableFor = (extension: LensRendererExtension, getRandomId: () =
|
||||
id,
|
||||
|
||||
instantiate: () => ({
|
||||
id: extension.sanitizedExtensionId,
|
||||
component,
|
||||
position,
|
||||
visible: visible ?? computed(() => true),
|
||||
|
||||
@ -10,9 +10,14 @@ import type { StatusBarItem } from "./status-bar-item-injection-token";
|
||||
import { statusBarItemInjectionToken } from "./status-bar-item-injection-token";
|
||||
import { computedInjectManyInjectable } from "@ogre-tools/injectable-extension-for-mobx";
|
||||
|
||||
interface StatusItem {
|
||||
id?: string,
|
||||
component: React.ComponentType<StatusBarItemProps>
|
||||
}
|
||||
|
||||
export interface StatusBarItems {
|
||||
right: React.ComponentType<StatusBarItemProps>[];
|
||||
left: React.ComponentType<StatusBarItemProps>[];
|
||||
right: StatusItem[];
|
||||
left: StatusItem[];
|
||||
}
|
||||
|
||||
interface Dependencies {
|
||||
@ -27,13 +32,16 @@ function getStatusBarItems({ registrations }: Dependencies): IComputedValue<Stat
|
||||
};
|
||||
|
||||
for (const registration of registrations.get()) {
|
||||
const { position = "right", component, visible } = registration;
|
||||
const { position = "right", component, visible, id } = registration;
|
||||
|
||||
if (!visible.get()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
res[position].push(component);
|
||||
res[position].push({
|
||||
id,
|
||||
component
|
||||
});
|
||||
}
|
||||
|
||||
// This is done so that the first ones registered are closest to the corner
|
||||
|
||||
Loading…
Reference in New Issue
Block a user