diff --git a/src/app/core/data/community-data.service.ts b/src/app/core/data/community-data.service.ts index 53d19e4c4c9..9bbf90c1f20 100644 --- a/src/app/core/data/community-data.service.ts +++ b/src/app/core/data/community-data.service.ts @@ -54,7 +54,7 @@ export class CommunityDataService extends ComColDataService { } protected getFindByParentHref(parentUUID: string): Observable { - return this.halService.getEndpoint(this.linkPath).pipe( + return this.getEndpoint().pipe( switchMap((communityEndpointHref: string) => this.halService.getEndpoint('subcommunities', `${communityEndpointHref}/${parentUUID}`)), ); diff --git a/src/themes/tamu/app/community-list-page/community-list/community-list.component.html b/src/themes/tamu/app/community-list-page/community-list/community-list.component.html index def0e2c7c49..ac3fca88882 100644 --- a/src/themes/tamu/app/community-list-page/community-list/community-list.component.html +++ b/src/themes/tamu/app/community-list-page/community-list/community-list.component.html @@ -1,36 +1,41 @@ - +
- -
- + @if ((dataSource.loading$ | async) && !loadingNode) { + + }
+ class="example-tree-node show-more-node">
- -
- - - - - + +
+ @if ((dataSource.loading$ | async) !== true) { + + } + @if (node===loadingNode && dataSource.loading$ | async) { + + }
@@ -40,77 +45,85 @@ + class="example-tree-node expandable-node">
- + @if (hasChild(null, node) | async) { + + } + + @if ((hasChild(null, node) | async) !== true) { + + }
- - - {{ dsoNameService.getName(node.payload) }} - -   - {{node.payload.archivedItemsCount}} + + {{ dsoNameService.getName(node.payload) }} +   + @if (node.payload.archivedItemsCount >= 0) { + {{node.payload.archivedItemsCount}} + }
-
- - - {{node.payload.shortDescription}} - -
+ @if (node.payload.shortDescription) { +
+ + + {{node.payload.shortDescription}} + +
+ }
- - -
- - - -
+ @if (node===loadingNode && dataSource.loading$ | async) { +
+ + +
+ }
+ class="example-tree-node childless-node">
-
- - - {{node.payload.shortDescription}} - -
+ @if (node.payload.shortDescription) { +
+ + + {{node.payload.shortDescription}} + +
+ }
diff --git a/src/themes/tamu/app/community-list-page/community-list/community-list.component.scss b/src/themes/tamu/app/community-list-page/community-list/community-list.component.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/themes/tamu/app/community-list-page/community-list/community-list.component.ts b/src/themes/tamu/app/community-list-page/community-list/community-list.component.ts index fa24b06492a..852680b56cb 100644 --- a/src/themes/tamu/app/community-list-page/community-list/community-list.component.ts +++ b/src/themes/tamu/app/community-list-page/community-list/community-list.component.ts @@ -1,21 +1,33 @@ -import { Component, Input, OnInit, QueryList, ViewChildren } from '@angular/core'; -import { BehaviorSubject, debounceTime, filter, take } from 'rxjs'; +import { CdkTreeModule } from '@angular/cdk/tree'; +import { AsyncPipe } from '@angular/common'; +import { Component, Input, QueryList, ViewChildren } from '@angular/core'; +import { RouterLink } from '@angular/router'; +import { TranslateModule } from '@ngx-translate/core'; +import { BehaviorSubject, debounceTime, distinctUntilChanged, take } from 'rxjs'; + import { CommunityListComponent as BaseComponent } from '../../../../../app/community-list-page/community-list/community-list.component'; +import { ThemedLoadingComponent } from '../../../../../app/shared/loading/themed-loading.component'; +import { TruncatableComponent } from '../../../../../app/shared/truncatable/truncatable.component'; +import { TruncatablePartComponent } from '../../../../../app/shared/truncatable/truncatable-part/truncatable-part.component'; -/** - * A tree-structured list of nodes representing the communities, their subCommunities and collections. - * Initially only the page-restricted top communities are shown. - * Each node can be expanded to show its children and all children are also page-limited. - * More pages of a page-limited result can be shown by pressing a show more node/link. - * Which nodes were expanded is kept in the store, so this persists across pages. - */ @Component({ selector: 'ds-community-list', - // styleUrls: ['./community-list.component.scss'], + styleUrls: ['./community-list.component.scss'], + // styleUrls: ['../../../../../app/community-list-page/community-list/community-list.component.scss'], templateUrl: './community-list.component.html', - // templateUrl: '../../../../../app/community-list-page/community-list/community-list.component.html' + // templateUrl: '../../../../../app/community-list-page/community-list/community-list.component.html', + standalone: true, + imports: [ + AsyncPipe, + CdkTreeModule, + RouterLink, + ThemedLoadingComponent, + TranslateModule, + TruncatableComponent, + TruncatablePartComponent, + ], }) -export class CommunityListComponent extends BaseComponent implements OnInit { +export class CommunityListComponent extends BaseComponent { @Input() scopeId!: string; @@ -23,31 +35,40 @@ export class CommunityListComponent extends BaseComponent implements OnInit { @ViewChildren('toggle') toggle!: QueryList; - expanding: BehaviorSubject; + isExpanding: BehaviorSubject; ngOnInit(): void { this.paginationConfig.scopeID = this.scopeId; - this.expanding = new BehaviorSubject(false); + this.isExpanding = new BehaviorSubject(false); super.ngOnInit(); } expandAll(): void { - this.expanding.next(true); + let anyExpanded = false; + this.isExpanding.next(true); const expandable = this.toggle.filter((node: any) => { return !!node.nativeElement.querySelector('.fa-chevron-right'); }); this.dataSource.loading$.pipe( + distinctUntilChanged(), + // allow 100 milliseconds per expanded subcommunity debounceTime(expandable.length * 100), - filter((loading: boolean) => !loading), take(1) ).subscribe(() => { - this.expanding.next(false); + if (anyExpanded) { + this.expandAll(); + } else { + this.isExpanding.next(false); + } }); expandable.forEach((node: any) => { node.nativeElement.click(); + if (!anyExpanded) { + anyExpanded = true; + } }); } @@ -60,4 +81,3 @@ export class CommunityListComponent extends BaseComponent implements OnInit { } } - diff --git a/src/themes/tamu/app/community-page/community-page.component.html b/src/themes/tamu/app/community-page/community-page.component.html index 383c0767d50..dd06652d178 100644 --- a/src/themes/tamu/app/community-page/community-page.component.html +++ b/src/themes/tamu/app/community-page/community-page.component.html @@ -1,49 +1,55 @@
-
-
- -
-
- - - - - - - - - - - - - - -
- -
-
- - - - - - - - - -
-
- - - -
+ @if (communityRD?.hasSucceeded) { +
+ @if (communityRD?.payload; as communityPayload) { +
+
+
+ + + + @if (logoRD$) { + + + } + + + + + + + + + +
+ +
+
+ + + + + + + +
+ @if (communityPayload.copyrightText) { +
+ + + +
+ } +
+ }
-
+ } - - + @if (communityRD?.hasFailed) { + + } + @if (communityRD?.isLoading) { + + }
diff --git a/src/themes/tamu/app/community-page/community-page.component.scss b/src/themes/tamu/app/community-page/community-page.component.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/themes/tamu/app/community-page/community-page.component.ts b/src/themes/tamu/app/community-page/community-page.component.ts index 925686849a0..e7aa321cdc3 100644 --- a/src/themes/tamu/app/community-page/community-page.component.ts +++ b/src/themes/tamu/app/community-page/community-page.component.ts @@ -1,19 +1,52 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { AsyncPipe } from '@angular/common'; +import { + ChangeDetectionStrategy, + Component, +} from '@angular/core'; +import { + RouterModule, + RouterOutlet, +} from '@angular/router'; +import { TranslateModule } from '@ngx-translate/core'; + import { CommunityPageComponent as BaseComponent } from '../../../../app/community-page/community-page.component'; import { fadeInOut } from '../../../../app/shared/animations/fade'; +import { ThemedComcolPageBrowseByComponent } from '../../../../app/shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component'; +import { ThemedComcolPageContentComponent } from '../../../../app/shared/comcol/comcol-page-content/themed-comcol-page-content.component'; +import { ThemedComcolPageHandleComponent } from '../../../../app/shared/comcol/comcol-page-handle/themed-comcol-page-handle.component'; +import { ComcolPageHeaderComponent } from '../../../../app/shared/comcol/comcol-page-header/comcol-page-header.component'; +import { ComcolPageLogoComponent } from '../../../../app/shared/comcol/comcol-page-logo/comcol-page-logo.component'; +import { DsoEditMenuComponent } from '../../../../app/shared/dso-page/dso-edit-menu/dso-edit-menu.component'; +import { ErrorComponent } from '../../../../app/shared/error/error.component'; +import { ThemedLoadingComponent } from '../../../../app/shared/loading/themed-loading.component'; +import { VarDirective } from '../../../../app/shared/utils/var.directive'; +import { CommunityListComponent } from '../community-list-page/community-list/community-list.component'; @Component({ - selector: 'ds-community-page', + selector: 'ds-themed-community-page', templateUrl: './community-page.component.html', // templateUrl: '../../../../app/community-page/community-page.component.html', - // styleUrls: ['./community-page.component.scss'], - styleUrls: ['../../../../app/community-page/community-page.component.scss'], + styleUrls: ['./community-page.component.scss'], + // styleUrls: ['../../../../app/community-page/community-page.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, - animations: [fadeInOut] + animations: [fadeInOut], + standalone: true, + imports: [ + AsyncPipe, + ComcolPageHeaderComponent, + ComcolPageLogoComponent, + CommunityListComponent, + DsoEditMenuComponent, + ErrorComponent, + RouterModule, + RouterOutlet, + ThemedComcolPageBrowseByComponent, + ThemedComcolPageContentComponent, + ThemedComcolPageHandleComponent, + ThemedLoadingComponent, + TranslateModule, + VarDirective, + ], }) -/** - * This component represents a detail page for a single community - */ export class CommunityPageComponent extends BaseComponent { - }