diff --git a/src/app/features/noah-playground/components/risk-assessment-group/risk-assessment-group.component.html b/src/app/features/noah-playground/components/risk-assessment-group/risk-assessment-group.component.html index 3105c846..29fef3c3 100644 --- a/src/app/features/noah-playground/components/risk-assessment-group/risk-assessment-group.component.html +++ b/src/app/features/noah-playground/components/risk-assessment-group/risk-assessment-group.component.html @@ -1,5 +1,5 @@
-
+
-
+

diff --git a/src/app/features/noah-playground/components/risk-assessment-group/risk-assessment-group.component.ts b/src/app/features/noah-playground/components/risk-assessment-group/risk-assessment-group.component.ts index 4f91065e..12d1d1d1 100644 --- a/src/app/features/noah-playground/components/risk-assessment-group/risk-assessment-group.component.ts +++ b/src/app/features/noah-playground/components/risk-assessment-group/risk-assessment-group.component.ts @@ -24,7 +24,7 @@ export class RiskAssessmentGroupComponent implements OnInit { expanded$: Observable; riskAssessmentPopuShown$: Observable; shown$: Observable; - + expandedValue: boolean = false; initialRainOpacityValue: number = 80; initialPopuOpacityValue: number = 80; @@ -35,6 +35,10 @@ export class RiskAssessmentGroupComponent implements OnInit { popuLegend = false; + get isExpanded(): boolean { + return this.expandedValue; + } + constructor( private pgService: NoahPlaygroundService, private modalService: ModalService @@ -84,21 +88,34 @@ export class RiskAssessmentGroupComponent implements OnInit { toggleExpanded(event: Event) { event.stopPropagation(); event.stopImmediatePropagation(); - this.pgService.toggleRiskAssessmentGroupProperty('expanded'); + this.expandedValue = !this.expandedValue; + this.pgService.toggleRiskAssessmentGroupProperty( + 'expanded', + this.expandedValue + ); } toggleShown(event: Event) { event.stopPropagation(); event.stopImmediatePropagation(); this.checkedShown = (event.target as HTMLInputElement).checked; - this.pgService.toggleRiskAssessmentGroupProperty('shown'); - this.pgService.toggleRiskAssessmentGroupProperty('expanded'); this.updateButtonEnabled(); - + this.expandedValue = true; if (!this.checkedShown) { this.modalService.closeBtnRiskAssessment(); this.popuLegend = false; this.pgService.toggleAffectedPopulationVisibilityFalse(); + this.pgService.toggleRiskAssessmentGroupProperty('shown', false); + this.pgService.toggleRiskAssessmentGroupProperty( + 'expanded', + (this.expandedValue = false) + ); + } else { + this.pgService.toggleRiskAssessmentGroupProperty('shown', true); + this.pgService.toggleRiskAssessmentGroupProperty( + 'expanded', + this.expandedValue + ); } } diff --git a/src/app/features/noah-playground/services/noah-playground.service.ts b/src/app/features/noah-playground/services/noah-playground.service.ts index 79eb7b44..7e1e44ec 100644 --- a/src/app/features/noah-playground/services/noah-playground.service.ts +++ b/src/app/features/noah-playground/services/noah-playground.service.ts @@ -521,13 +521,17 @@ export class NoahPlaygroundService { this.store.patch({ volcanoes }, `Volcanoes ${property}, ${!currentValue}`); } - toggleRiskAssessmentGroupProperty(property: 'expanded' | 'shown') { + toggleRiskAssessmentGroupProperty( + property: 'expanded' | 'shown', + value: boolean + ) { const riskAssessment: RiskAssessmentGroupState = { ...this.store.state.riskAssessment, }; const currentValue = riskAssessment[property]; - riskAssessment[property] = !currentValue; + //riskAssessment[property] = !currentValue; remain this if ever we have changes + riskAssessment[property] = value; this.store.patch( { riskAssessment }, `Risk Assessment ${property}, ${!currentValue}`