From 77e1ea9f6cfac1193491044125f1020f34ae7f76 Mon Sep 17 00:00:00 2001 From: NazarMykhalkevych Date: Mon, 15 Sep 2025 12:27:41 +0300 Subject: [PATCH 1/3] fix(scroll): scroll to top after navigation end --- .../core/components/root/root.component.html | 4 +-- .../core/components/root/root.component.ts | 2 ++ .../shared/directives/scroll-top.directive.ts | 27 +++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 src/app/shared/directives/scroll-top.directive.ts diff --git a/src/app/core/components/root/root.component.html b/src/app/core/components/root/root.component.html index 14f0f1997..cfcc6394a 100644 --- a/src/app/core/components/root/root.component.html +++ b/src/app/core/components/root/root.component.html @@ -2,7 +2,7 @@
-
+
@@ -13,7 +13,7 @@
} @else {
-
+
diff --git a/src/app/core/components/root/root.component.ts b/src/app/core/components/root/root.component.ts index ed451f7ec..40c2abdce 100644 --- a/src/app/core/components/root/root.component.ts +++ b/src/app/core/components/root/root.component.ts @@ -7,6 +7,7 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; import { RouterOutlet } from '@angular/router'; +import { ScrollTopOnRouteChangeDirective } from '@osf/shared/directives/scroll-top.directive'; import { IS_MEDIUM, IS_WEB } from '@osf/shared/helpers'; import { BreadcrumbComponent } from '../breadcrumb/breadcrumb.component'; @@ -29,6 +30,7 @@ import { TopnavComponent } from '../topnav/topnav.component'; SidenavComponent, MaintenanceBannerComponent, TranslatePipe, + ScrollTopOnRouteChangeDirective, ], templateUrl: './root.component.html', styleUrls: ['./root.component.scss'], diff --git a/src/app/shared/directives/scroll-top.directive.ts b/src/app/shared/directives/scroll-top.directive.ts new file mode 100644 index 000000000..09fd04e36 --- /dev/null +++ b/src/app/shared/directives/scroll-top.directive.ts @@ -0,0 +1,27 @@ +import { filter } from 'rxjs'; + +import { Directive, ElementRef, inject } from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { NavigationEnd, Router } from '@angular/router'; + +@Directive({ + selector: '[osfScrollTopOnRouteChange]', +}) +export class ScrollTopOnRouteChangeDirective { + private el = inject(ElementRef); + private router = inject(Router); + + constructor() { + this.router.events + .pipe( + filter((e) => e instanceof NavigationEnd), + takeUntilDestroyed() + ) + .subscribe(() => { + (this.el.nativeElement as HTMLElement).scrollTo({ + top: 0, + behavior: 'instant', + }); + }); + } +} From 54dbdf162417f2e8103cb0db749248ae07bc6f9c Mon Sep 17 00:00:00 2001 From: NazarMykhalkevych Date: Mon, 15 Sep 2025 12:35:29 +0300 Subject: [PATCH 2/3] fix(scroll): scroll to top after navigation end --- src/app/core/components/root/root.component.ts | 2 +- src/app/shared/directives/index.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/core/components/root/root.component.ts b/src/app/core/components/root/root.component.ts index 40c2abdce..7f7888e51 100644 --- a/src/app/core/components/root/root.component.ts +++ b/src/app/core/components/root/root.component.ts @@ -7,7 +7,7 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; import { RouterOutlet } from '@angular/router'; -import { ScrollTopOnRouteChangeDirective } from '@osf/shared/directives/scroll-top.directive'; +import { ScrollTopOnRouteChangeDirective } from '@osf/shared/directives'; import { IS_MEDIUM, IS_WEB } from '@osf/shared/helpers'; import { BreadcrumbComponent } from '../breadcrumb/breadcrumb.component'; diff --git a/src/app/shared/directives/index.ts b/src/app/shared/directives/index.ts index ceb698569..bf072416e 100644 --- a/src/app/shared/directives/index.ts +++ b/src/app/shared/directives/index.ts @@ -1 +1,2 @@ +export { ScrollTopOnRouteChangeDirective } from './scroll-top.directive'; export { StopPropagationDirective } from './stop-propagation.directive'; From c8aafa4b19dcb7a607b3dac84314cb11f2f04737 Mon Sep 17 00:00:00 2001 From: NazarMykhalkevych Date: Mon, 15 Sep 2025 16:43:43 +0300 Subject: [PATCH 3/3] fix(wiki): wiki bugs --- .../features/project/wiki/wiki.component.html | 3 +- .../registry-wiki.component.html | 4 +-- .../registry-wiki/registry-wiki.component.ts | 5 ++++ .../compare-section.component.scss | 1 + .../compare-section.component.ts | 6 ++-- .../edit-section/edit-section.component.scss | 1 + .../wiki/wiki-list/wiki-list.component.html | 29 ++++++++----------- .../wiki/wiki-list/wiki-list.component.ts | 1 - 8 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/app/features/project/wiki/wiki.component.html b/src/app/features/project/wiki/wiki.component.html index b3ede123b..0f3601362 100644 --- a/src/app/features/project/wiki/wiki.component.html +++ b/src/app/features/project/wiki/wiki.component.html @@ -26,7 +26,7 @@
} -
+
diff --git a/src/app/features/registry/pages/registry-wiki/registry-wiki.component.html b/src/app/features/registry/pages/registry-wiki/registry-wiki.component.html index 2f5ee68ad..05f489d7a 100644 --- a/src/app/features/registry/pages/registry-wiki/registry-wiki.component.html +++ b/src/app/features/registry/pages/registry-wiki/registry-wiki.component.html @@ -21,11 +21,11 @@
diff --git a/src/app/features/registry/pages/registry-wiki/registry-wiki.component.ts b/src/app/features/registry/pages/registry-wiki/registry-wiki.component.ts index 31c66f2c6..f7acf3f79 100644 --- a/src/app/features/registry/pages/registry-wiki/registry-wiki.component.ts +++ b/src/app/features/registry/pages/registry-wiki/registry-wiki.component.ts @@ -18,6 +18,7 @@ import { hasViewOnlyParam } from '@osf/shared/helpers'; import { WikiModes } from '@osf/shared/models'; import { GetCompareVersionContent, + GetComponentsWikiList, GetWikiContent, GetWikiList, GetWikiVersionContent, @@ -57,6 +58,7 @@ export class RegistryWikiComponent { currentWikiId = select(WikiSelectors.getCurrentWikiId); wikiVersions = select(WikiSelectors.getWikiVersions); isWikiVersionLoading = select(WikiSelectors.getWikiVersionsLoading); + componentsWikiList = select(WikiSelectors.getComponentsWikiList); hasViewOnly = computed(() => hasViewOnlyParam(this.router)); @@ -70,6 +72,7 @@ export class RegistryWikiComponent { getWikiVersions: GetWikiVersions, getWikiVersionContent: GetWikiVersionContent, getCompareVersionContent: GetCompareVersionContent, + getComponentsWikiList: GetComponentsWikiList, }); wikiIdFromQueryParams = this.route.snapshot.queryParams['wiki']; @@ -87,6 +90,8 @@ export class RegistryWikiComponent { ) .subscribe(); + this.actions.getComponentsWikiList(ResourceType.Registration, this.resourceId); + this.route.queryParams .pipe( takeUntilDestroyed(), diff --git a/src/app/shared/components/wiki/compare-section/compare-section.component.scss b/src/app/shared/components/wiki/compare-section/compare-section.component.scss index de605d06a..9c4829ccd 100644 --- a/src/app/shared/components/wiki/compare-section/compare-section.component.scss +++ b/src/app/shared/components/wiki/compare-section/compare-section.component.scss @@ -1,3 +1,4 @@ :host { flex: 1 1 25%; + min-height: 300px; } diff --git a/src/app/shared/components/wiki/compare-section/compare-section.component.ts b/src/app/shared/components/wiki/compare-section/compare-section.component.ts index f1af512db..36bd6d22a 100644 --- a/src/app/shared/components/wiki/compare-section/compare-section.component.ts +++ b/src/app/shared/components/wiki/compare-section/compare-section.component.ts @@ -53,8 +53,10 @@ export class CompareSectionComponent { constructor() { effect(() => { - this.selectedVersion = this.versions()[0].id; - this.selectVersion.emit(this.selectedVersion); + this.selectedVersion = this.versions()[0]?.id; + if (this.selectedVersion) { + this.selectVersion.emit(this.selectedVersion); + } }); } onVersionChange(versionId: string): void { diff --git a/src/app/shared/components/wiki/edit-section/edit-section.component.scss b/src/app/shared/components/wiki/edit-section/edit-section.component.scss index a0aadc379..95dc71b83 100644 --- a/src/app/shared/components/wiki/edit-section/edit-section.component.scss +++ b/src/app/shared/components/wiki/edit-section/edit-section.component.scss @@ -1,6 +1,7 @@ :host { flex: 1 1 25%; min-width: 25%; + min-height: 400px; md-editor { display: block; diff --git a/src/app/shared/components/wiki/wiki-list/wiki-list.component.html b/src/app/shared/components/wiki/wiki-list/wiki-list.component.html index 30265bcc8..8e7d82866 100644 --- a/src/app/shared/components/wiki/wiki-list/wiki-list.component.html +++ b/src/app/shared/components/wiki/wiki-list/wiki-list.component.html @@ -11,20 +11,15 @@ } @else { @if (expanded()) { -
- @if (showAddBtn()) { - - } +
+
- @if (!viewOnly()) { - @if (!isHomeWikiSelected() || !list().length) { + @if (!viewOnly() && list().length) { + @if (!isHomeWikiSelected()) { {{ item.label | translate }}
- @if (showAddBtn()) { + @if (!viewOnly()) { (); readonly componentsList = input.required(); - readonly showAddBtn = input(false); readonly isLoading = input(false); readonly viewOnly = input(false);