mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Highlight expandable items only if they collapsed
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
f32b9e6261
commit
0dcf890d5f
@ -17,6 +17,8 @@ import {
|
||||
orderBy,
|
||||
some,
|
||||
} from "lodash/fp";
|
||||
import sidebarStorageInjectable, { SidebarStorageState } from "./sidebar-storage/sidebar-storage.injectable";
|
||||
import type { StorageLayer } from "../../utils";
|
||||
|
||||
export interface SidebarItemRegistration {
|
||||
id: string;
|
||||
@ -44,7 +46,7 @@ const sidebarItemsInjectable = getInjectable({
|
||||
|
||||
instantiate: (di) => {
|
||||
const computedInjectMany = di.inject(computedInjectManyInjectable);
|
||||
|
||||
const sidebarStorage: StorageLayer<SidebarStorageState> = di.inject(sidebarStorageInjectable)
|
||||
const sidebarItemRegistrations = computedInjectMany(sidebarItemsInjectionToken);
|
||||
|
||||
return computed((): HierarchicalSidebarItem[] => {
|
||||
@ -63,6 +65,8 @@ const sidebarItemsInjectable = getInjectable({
|
||||
map((registration) => {
|
||||
const children = _getSidebarItemsHierarchy(registration.id);
|
||||
|
||||
const parentExpanded = () => Boolean(sidebarStorage.get().expanded[registration.id])
|
||||
|
||||
return {
|
||||
registration,
|
||||
children,
|
||||
@ -76,6 +80,7 @@ const sidebarItemsInjectable = getInjectable({
|
||||
children,
|
||||
invokeMap("isActive.get"),
|
||||
some(identity),
|
||||
(identityFound) => identityFound && !parentExpanded(),
|
||||
);
|
||||
}),
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user