From 865fc868929ef939878cb91977e1713827a3dace Mon Sep 17 00:00:00 2001 From: Daniel Palafox Date: Tue, 2 Apr 2024 16:54:16 -0600 Subject: [PATCH] feature: Header summary link scroll to section on standaloneMode --- .../summary-panel.component.html | 5 ++--- .../summary-panel/summary-panel.component.ts | 8 +++++++ .../trusted-summary.component.html | 22 +++++++++---------- .../trusted-summary.component.ts | 9 ++++++++ 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/app/cdk/trusted-summary/component/summary-panel/summary-panel.component.html b/src/app/cdk/trusted-summary/component/summary-panel/summary-panel.component.html index 1147b131f2..aed035d173 100644 --- a/src/app/cdk/trusted-summary/component/summary-panel/summary-panel.component.html +++ b/src/app/cdk/trusted-summary/component/summary-panel/summary-panel.component.html @@ -6,7 +6,7 @@
+ {{ count - 3 }} {{ moreLabelSingular diff --git a/src/app/cdk/trusted-summary/component/summary-panel/summary-panel.component.ts b/src/app/cdk/trusted-summary/component/summary-panel/summary-panel.component.ts index e031e36e0b..daa9a0b281 100644 --- a/src/app/cdk/trusted-summary/component/summary-panel/summary-panel.component.ts +++ b/src/app/cdk/trusted-summary/component/summary-panel/summary-panel.component.ts @@ -22,6 +22,8 @@ export class SummaryPanelComponent implements OnInit { @Input() moreLabelSingular: string = '' @Input() showToPresent = true @Input() hoverEffect = false + @Input() standaloneMode: boolean + @Input() activitySection: string activitiesToDisplay: ActivitySummary[] acitivityCountOverflow: boolean unsubscribe = new Subject() @@ -47,4 +49,10 @@ export class SummaryPanelComponent implements OnInit { } this._window.open(url, '_blank') } + goToActivitySection(activitySection: string) { + this.standaloneMode ? this.goToUrl(this.url) : this.scrollTo(activitySection) + } + scrollTo(activitySection: string) { + document.querySelector(`#${activitySection}`).scrollIntoView() + } } diff --git a/src/app/cdk/trusted-summary/component/trusted-summary/trusted-summary.component.html b/src/app/cdk/trusted-summary/component/trusted-summary/trusted-summary.component.html index 156537c9a1..a61731c28c 100644 --- a/src/app/cdk/trusted-summary/component/trusted-summary/trusted-summary.component.html +++ b/src/app/cdk/trusted-summary/component/trusted-summary/trusted-summary.component.html @@ -116,11 +116,10 @@

>

[moreLabel]="labelMoreAffiliations" [moreLabelSingular]="labelMoreAffiliation" [hoverEffect]="affiliationsHover" + [standaloneMode]="standaloneMode" + [activitySection]="'affiliations'" > @@ -192,11 +193,10 @@

>

>

[count]="trustedSummary.professionalActivitiesCount" [moreLabel]="labelMoreProfessionalActivities" [moreLabelSingular]="labelMoreProfessionalActivitie" + [standaloneMode]="standaloneMode" + [activitySection]="'professional-activities'" >