Fixed InsideGroup header context menu "Info" action

This commit is contained in:
namushka 2024-03-07 14:23:25 +03:00
parent 1d37dbb1cb
commit d3a9201110
3 changed files with 17 additions and 7 deletions

View File

@ -701,7 +701,7 @@ const SectionHeaderContent = (props) => {
}
if (isInsideGroup) {
return getGroupContextOptions(t, currentGroup);
return getGroupContextOptions(t, currentGroup, false, true);
}
return [

View File

@ -320,7 +320,12 @@ class GroupsStore {
this.setSelection(newSelections);
};
getGroupContextOptions = (t, item, forInfoPanel = false) => {
getGroupContextOptions = (
t,
item,
forInfoPanel = false,
forInsideGroup = false,
) => {
return [
{
id: "edit-group",
@ -343,7 +348,12 @@ class GroupsStore {
title: t("Common:Info"),
icon: InfoReactSvgUrl,
onClick: () => {
this.selection = [item];
if (!forInsideGroup) {
this.selection = [item];
} else {
this.peopleStore.selectionStore.setSelection([]);
this.peopleStore.selectionStore.setBufferSelection(null);
}
this.infoPanelStore.setIsVisible(true);
},
},

View File

@ -88,7 +88,7 @@ class HeaderMenuStore {
get isGroupsHeaderVisible() {
const { selection } = this.peopleStore.groupsStore;
return selection.length > 0;
return selection?.length > 0;
}
get isGroupsHeaderIndeterminate() {
@ -96,14 +96,14 @@ class HeaderMenuStore {
return (
this.isGroupsHeaderVisible &&
!!selection.length &&
selection.length < groups.length
!!selection?.length &&
selection?.length < groups?.length
);
}
get isGroupsHeaderChecked() {
const { selection, groups } = this.peopleStore.groupsStore;
return this.isGroupsHeaderVisible && selection.length === groups.length;
return this.isGroupsHeaderVisible && selection?.length === groups?.length;
}
}