Skip to content

Commit

Permalink
8909-prod-link-to-remove-duplicate-record-section-not-working
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonardo Mendoza Fernadez authored and Leonardo Mendoza Fernadez committed Dec 15, 2023
1 parent 6aa7ad1 commit 1ae7075
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
<a
i18n="@@account.accountSettings"
[routerLink]="removeDuplicateUrl"
[queryParams]="{ section: 'remove-duplicate' }"
fragment="remove-duplicate-record"
class="underline"
id="cy-remove-duplicated-record"
>Account settings > Remove duplicate record
</a>
</p>
</p>
<p>
<a
href="https://support.orcid.org/hc/en-us/articles/360006896634"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
OnInit,
Output,
} from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { Subject } from 'rxjs'
import { takeUntil } from 'rxjs/operators'
import { PlatformInfoService } from 'src/app/cdk/platform-info'
Expand All @@ -30,7 +31,8 @@ export class SettingsActionsDeactivateComponent implements OnInit, OnDestroy {
constructor(
private _platform: PlatformInfoService,
private _deactivate: AccountActionsDeactivateService,
private _togglz: TogglzService
private _togglz: TogglzService,
private activeRoute: ActivatedRoute,
) {}

ngOnInit(): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Component, Inject, OnInit } from '@angular/core'
import { ActivatedRoute } from '@angular/router'
import { set } from 'lodash'
import { WINDOW } from 'src/app/cdk/window'

@Component({
Expand All @@ -18,10 +20,28 @@ export class SettingsActionsComponent implements OnInit {
settingDownloadLoading = false
settingDuplicatedRecordLoading = false
settingDeactivateLoading = false
constructor(@Inject(WINDOW) private _window: Window) {}
constructor(
@Inject(WINDOW) private _window: Window,
private activeRoute: ActivatedRoute
) {}

ngOnInit(): void {
const hash = this._window.location.hash.substr(1)
this.displayPanelByHashName(hash)
this.activeRoute.fragment.subscribe((fragment) => {
if (fragment === 'remove-duplicate-record') {
const element = this._window.document.querySelector('#cy-remove-duplicate-panel')
this.displayPanelByHashName('remove-duplicate')
setTimeout(() => {
if (element) {
element.scrollIntoView()
}
})
}
})
}

private displayPanelByHashName(hash: string) {
switch (hash) {
case 'download-data':
this.settingDownload = true
Expand Down

0 comments on commit 1ae7075

Please sign in to comment.