diff --git a/webapp/src/app/modules/person-interesting/person-interesting.component.ts b/webapp/src/app/modules/person-interesting/person-interesting.component.ts index ced9f9d0..a5f690c2 100644 --- a/webapp/src/app/modules/person-interesting/person-interesting.component.ts +++ b/webapp/src/app/modules/person-interesting/person-interesting.component.ts @@ -23,7 +23,8 @@ import { getTopicLegendSubfieldId, TopicLegendGroup, TopicLegendSubfieldSelection, - toggleTopicLegendSelection, + toggleTopicLegendFieldSelection, + toggleTopicLegendSubfieldSelection, } from '../../shared/utils/topic-legend'; interface InterestTag { @@ -154,18 +155,25 @@ export class PersonInterestingComponent implements OnInit { } onLegendFieldToggle(group: TopicLegendGroup): void { - this.activeLegendFieldIds.set( - toggleTopicLegendSelection(this.activeLegendFieldIds(), group.id), + const selection = toggleTopicLegendFieldSelection( + this.activeLegendFieldIds(), + this.activeLegendSubfieldIds(), + group, ); + + this.activeLegendFieldIds.set(selection.fieldIds); + this.activeLegendSubfieldIds.set(selection.subfieldIds); } onLegendSubfieldToggle(selection: TopicLegendSubfieldSelection): void { - this.activeLegendSubfieldIds.set( - toggleTopicLegendSelection( - this.activeLegendSubfieldIds(), - selection.item.id, - ), + const nextSelection = toggleTopicLegendSubfieldSelection( + this.activeLegendFieldIds(), + this.activeLegendSubfieldIds(), + selection, ); + + this.activeLegendFieldIds.set(nextSelection.fieldIds); + this.activeLegendSubfieldIds.set(nextSelection.subfieldIds); } isTagActive(tag: InterestTag): boolean { diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts index 09392acc..cd0f382f 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts @@ -21,7 +21,8 @@ import { getTopicLegendSubfieldId, TopicLegendGroup, TopicLegendSubfieldSelection, - toggleTopicLegendSelection, + toggleTopicLegendFieldSelection, + toggleTopicLegendSubfieldSelection, } from '../../../../shared/utils/topic-legend'; import { buildTopicHierarchyTooltip } from '../../../../shared/utils/topic-tooltip'; @@ -430,17 +431,25 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { } onLegendFieldToggle(group: TopicLegendGroup): void { - this.activeLegendFieldIds = toggleTopicLegendSelection( + const selection = toggleTopicLegendFieldSelection( this.activeLegendFieldIds, - group.id, + this.activeLegendSubfieldIds, + group, ); + + this.activeLegendFieldIds = selection.fieldIds; + this.activeLegendSubfieldIds = selection.subfieldIds; } onLegendSubfieldToggle(selection: TopicLegendSubfieldSelection): void { - this.activeLegendSubfieldIds = toggleTopicLegendSelection( + const nextSelection = toggleTopicLegendSubfieldSelection( + this.activeLegendFieldIds, this.activeLegendSubfieldIds, - selection.item.id, + selection, ); + + this.activeLegendFieldIds = nextSelection.fieldIds; + this.activeLegendSubfieldIds = nextSelection.subfieldIds; } isTopicActiveByLegend(topic: TopicTimelineTopic): boolean { diff --git a/webapp/src/app/shared/ui/topic-legend/topic-legend.component.html b/webapp/src/app/shared/ui/topic-legend/topic-legend.component.html index 115a8e3a..330ccc2b 100644 --- a/webapp/src/app/shared/ui/topic-legend/topic-legend.component.html +++ b/webapp/src/app/shared/ui/topic-legend/topic-legend.component.html @@ -47,7 +47,7 @@