diff --git a/package.json b/package.json index e1aaa80be..c523a00bb 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "start:test": "ng serve --configuration test-osf", "start:docker": "ng serve --host 0.0.0.0 --port 4200 --poll 2000", "start:docker:local": "ng serve --host 0.0.0.0 --port 4200 --poll 2000 --configuration local", - "test": "jest && npm run test:display", + "test": "jest", "test:watch": "jest --watch", "test:coverage": "jest --coverage && npm run test:display", "test:check-coverage-thresholds": "node .github/scripts/check-coverage-thresholds.js", diff --git a/src/app/core/components/root/root.component.scss b/src/app/core/components/root/root.component.scss index 7d6df6575..a79b10a3b 100644 --- a/src/app/core/components/root/root.component.scss +++ b/src/app/core/components/root/root.component.scss @@ -1,5 +1,4 @@ @use "styles/mixins" as mix; -@use "styles/variables" as var; :host { display: flex; @@ -10,12 +9,12 @@ .layout-desktop { display: flex; flex: 1; - background-color: var.$dark-blue-1; + background-color: var(--dark-blue-1); max-width: 100vw; .content-wrapper { position: relative; - background-color: var.$bg-blue-3; + background-color: var(--bg-blue-3); border-radius: mix.rem(12px); margin: mix.rem(6px); display: flex; @@ -36,7 +35,7 @@ height: 100%; flex: 1; overflow-y: auto; - background-color: var.$bg-blue-3; + background-color: var(--bg-blue-3); .content { position: relative; diff --git a/src/app/core/components/root/root.component.spec.ts b/src/app/core/components/root/root.component.spec.ts index 4a4ddf252..ced94c5c9 100644 --- a/src/app/core/components/root/root.component.spec.ts +++ b/src/app/core/components/root/root.component.spec.ts @@ -13,6 +13,7 @@ import { HeaderComponent } from '@core/components/header/header.component'; import { TopnavComponent } from '@core/components/topnav/topnav.component'; import { IS_WEB, IS_XSMALL } from '@osf/shared/helpers'; +import { MaintenanceBannerComponent } from '../maintenance-banner/maintenance-banner.component'; import { SidenavComponent } from '../sidenav/sidenav.component'; import { RootComponent } from './root.component'; @@ -36,7 +37,8 @@ describe('RootComponent', () => { TopnavComponent, ConfirmDialog, BreadcrumbComponent, - SidenavComponent + SidenavComponent, + MaintenanceBannerComponent ), ], providers: [ diff --git a/src/app/core/components/root/root.component.ts b/src/app/core/components/root/root.component.ts index 064fde8b6..ed451f7ec 100644 --- a/src/app/core/components/root/root.component.ts +++ b/src/app/core/components/root/root.component.ts @@ -7,13 +7,15 @@ import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; import { RouterOutlet } from '@angular/router'; -import { MaintenanceBannerComponent, SidenavComponent } from '@core/components'; -import { BreadcrumbComponent } from '@core/components/breadcrumb/breadcrumb.component'; -import { FooterComponent } from '@core/components/footer/footer.component'; -import { HeaderComponent } from '@core/components/header/header.component'; -import { TopnavComponent } from '@core/components/topnav/topnav.component'; import { IS_MEDIUM, IS_WEB } from '@osf/shared/helpers'; +import { BreadcrumbComponent } from '../breadcrumb/breadcrumb.component'; +import { FooterComponent } from '../footer/footer.component'; +import { HeaderComponent } from '../header/header.component'; +import { MaintenanceBannerComponent } from '../maintenance-banner/maintenance-banner.component'; +import { SidenavComponent } from '../sidenav/sidenav.component'; +import { TopnavComponent } from '../topnav/topnav.component'; + @Component({ selector: 'osf-root', imports: [ diff --git a/src/app/features/admin-institutions/admin-institutions.component.ts b/src/app/features/admin-institutions/admin-institutions.component.ts index 87df5e93d..ad92ca255 100644 --- a/src/app/features/admin-institutions/admin-institutions.component.ts +++ b/src/app/features/admin-institutions/admin-institutions.component.ts @@ -1,6 +1,6 @@ import { createDispatchMap, select } from '@ngxs/store'; -import { TranslateModule } from '@ngx-translate/core'; +import { TranslatePipe } from '@ngx-translate/core'; import { TabsModule } from 'primeng/tabs'; @@ -17,7 +17,7 @@ import { AdminInstitutionResourceTab } from './enums'; @Component({ selector: 'osf-admin-institutions', - imports: [TabsModule, TranslateModule, RouterOutlet, NgOptimizedImage, LoadingSpinnerComponent, SelectComponent], + imports: [TabsModule, TranslatePipe, RouterOutlet, NgOptimizedImage, LoadingSpinnerComponent, SelectComponent], templateUrl: './admin-institutions.component.html', styleUrl: './admin-institutions.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.html b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.html index 46fed730d..64258dcb7 100644 --- a/src/app/features/analytics/components/view-duplicates/view-duplicates.component.html +++ b/src/app/features/analytics/components/view-duplicates/view-duplicates.component.html @@ -57,7 +57,7 @@

{{ 'common.labels.contributors' | translate }}: @for (contributor of duplicate.contributors; track contributor.id) {
- {{ contributor.fullName }} + {{ contributor.fullName }} {{ $last ? '' : ',' }}
} diff --git a/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.html b/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.html index e8c7b3834..62fccf500 100644 --- a/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.html +++ b/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.html @@ -7,7 +7,9 @@

{{ 'collections.common.by' | translate }} @for (contributor of item?.contributors; track contributor.id) { - {{ contributor.name }}{{ $last ? '' : ', ' }} + + {{ contributor.name }}{{ $last ? '' : ', ' }} + }

{{ item?.description }}

diff --git a/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.ts b/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.ts index 32b2b18a3..5054515c7 100644 --- a/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.ts +++ b/src/app/features/collections/components/collections-search-result-card/collections-search-result-card.component.ts @@ -2,13 +2,14 @@ import { TranslatePipe } from '@ngx-translate/core'; import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, input } from '@angular/core'; +import { RouterLink } from '@angular/router'; import { collectionFilterNames } from '@osf/features/collections/constants'; import { CollectionSubmissionWithGuid } from '@shared/models'; @Component({ selector: 'osf-collections-search-result-card', - imports: [DatePipe, TranslatePipe], + imports: [DatePipe, TranslatePipe, RouterLink], templateUrl: './collections-search-result-card.component.html', styleUrl: './collections-search-result-card.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.html b/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.html index 98142cf0f..73a66aca3 100644 --- a/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.html +++ b/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.html @@ -104,7 +104,7 @@

{{ 'files.detail.resourceMetadata.fields.contributors' | translate }}

@for (contributor of contributors(); track $index) { - {{ contributor.fullName }} + {{ contributor.fullName }} @if (!$last) { } diff --git a/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.ts b/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.ts index 8043b6459..3e962d0c2 100644 --- a/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.ts +++ b/src/app/features/files/components/file-resource-metadata/file-resource-metadata.component.ts @@ -6,12 +6,13 @@ import { Skeleton } from 'primeng/skeleton'; import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; +import { RouterLink } from '@angular/router'; import { FilesSelectors } from '../../store'; @Component({ selector: 'osf-file-resource-metadata', - imports: [DatePipe, TranslatePipe, Skeleton], + imports: [DatePipe, TranslatePipe, Skeleton, RouterLink], templateUrl: './file-resource-metadata.component.html', styleUrl: './file-resource-metadata.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/src/app/features/files/pages/files/files.component.html b/src/app/features/files/pages/files/files.component.html index ee064c1cb..235609f3a 100644 --- a/src/app/features/files/pages/files/files.component.html +++ b/src/app/features/files/pages/files/files.component.html @@ -59,7 +59,7 @@ - @if (!isViewOnly() && !hasViewOnly()) { + @if (!isReadonly() && !hasViewOnly()) { { - return hasViewOnlyParam(this.router); - }); readonly files = select(FilesSelectors.getFiles); readonly filesTotalCount = select(FilesSelectors.getFilesTotalCount); readonly isFilesLoading = select(FilesSelectors.isFilesLoading); readonly currentFolder = select(FilesSelectors.getCurrentFolder); readonly provider = select(FilesSelectors.getProvider); + readonly resourceDetails = select(CurrentResourceSelectors.getResourceDetails); + readonly rootFolders = select(FilesSelectors.getRootFolders); + readonly isRootFoldersLoading = select(FilesSelectors.isRootFoldersLoading); + readonly configuredStorageAddons = select(FilesSelectors.getConfiguredStorageAddons); + readonly isConfiguredStorageAddonsLoading = select(FilesSelectors.isConfiguredStorageAddonsLoading); + + isMedium = toSignal(inject(IS_MEDIUM)); readonly isGoogleDrive = signal(false); readonly accountId = signal(''); readonly selectedRootFolder = signal({}); readonly resourceId = signal(''); - readonly rootFolders = select(FilesSelectors.getRootFolders); - readonly isRootFoldersLoading = select(FilesSelectors.isRootFoldersLoading); - readonly configuredStorageAddons = select(FilesSelectors.getConfiguredStorageAddons); - readonly isConfiguredStorageAddonsLoading = select(FilesSelectors.isConfiguredStorageAddonsLoading); - readonly dataciteService = inject(DataciteService); readonly progress = signal(0); readonly fileName = signal(''); @@ -175,13 +176,16 @@ export class FilesComponent { this.activeRoute.parent?.parent?.snapshot.data['resourceType'] || ResourceType.Project ); - readonly isViewOnly = computed(() => { - return this.resourceType() === ResourceType.Registration; - }); + readonly hasViewOnly = computed(() => hasViewOnlyParam(this.router)); - readonly isViewOnlyDownloadable = computed(() => { - return this.resourceType() === ResourceType.Registration; - }); + readonly isReadonly = computed( + () => + this.resourceDetails().isRegistration || + this.resourceDetails().currentUserPermissions.includes(UserPermissions.Read) + ); + readonly isViewOnlyDownloadable = computed(() => this.resourceType() === ResourceType.Registration); + + isButtonDisabled = computed(() => this.fileIsUploading() || this.isFilesLoading()); readonly filesTreeActions: FilesTreeActions = { setCurrentFolder: (folder) => this.actions.setCurrentFolder(folder), @@ -206,6 +210,8 @@ export class FilesComponent { const resourcePath = this.urlMap.get(this.resourceType()!); const folderLink = `${environment.apiDomainUrl}/v2/${resourcePath}/${resourceId}/files/`; const iriLink = `${environment.webUrl}/${resourceId}`; + + this.actions.getResourceDetails(resourceId, this.resourceType()!); this.actions.getRootFolders(folderLink); this.actions.getConfiguredStorageAddons(iriLink); }); @@ -265,10 +271,6 @@ export class FilesComponent { }); } - isButtonDisabled(): boolean { - return this.fileIsUploading() || this.isFilesLoading(); - } - uploadFile(file: File): void { const currentFolder = this.currentFolder(); const uploadLink = currentFolder?.links.upload; diff --git a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.html b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.html index ff9244f42..7c5456018 100644 --- a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.html +++ b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.html @@ -30,12 +30,7 @@

{{ 'preprints.preprintStepper.review.sections.metadata.authors' | translate @if (contributor.isUnregisteredContributor) { {{ contributor.fullName }} } @else { - + {{ contributor.fullName }} } diff --git a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.ts b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.ts index f7738f89d..01bcdffb0 100644 --- a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.ts +++ b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.ts @@ -7,6 +7,7 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, computed, effect, input, OnDestroy, output } from '@angular/core'; import { FormsModule } from '@angular/forms'; +import { RouterLink } from '@angular/router'; import { PreprintDoiSectionComponent } from '@osf/features/preprints/components/preprint-details/preprint-doi-section/preprint-doi-section.component'; import { ApplicabilityStatus, PreregLinkInfo } from '@osf/features/preprints/enums'; @@ -30,6 +31,7 @@ import { environment } from 'src/environments/environment'; PreprintDoiSectionComponent, IconComponent, AffiliatedInstitutionsViewComponent, + RouterLink, ], templateUrl: './general-information.component.html', styleUrl: './general-information.component.scss', @@ -45,7 +47,6 @@ export class GeneralInformationComponent implements OnDestroy { fetchPreprintById: FetchPreprintById, fetchResourceInstitutions: FetchResourceInstitutions, }); - readonly webUrl = environment.webUrl; preprintProvider = input.required(); preprintVersionSelected = output(); @@ -57,15 +58,11 @@ export class GeneralInformationComponent implements OnDestroy { contributors = select(ContributorsSelectors.getContributors); areContributorsLoading = select(ContributorsSelectors.isContributorsLoading); - bibliographicContributors = computed(() => { - return this.contributors().filter((contributor) => contributor.isBibliographic); - }); + bibliographicContributors = computed(() => this.contributors().filter((contributor) => contributor.isBibliographic)); skeletonData = Array.from({ length: 5 }, () => null); - nodeLink = computed(() => { - return `${environment.webUrl}/${this.preprint()?.nodeId}`; - }); + nodeLink = computed(() => `${environment.webUrl}/${this.preprint()?.nodeId}`); constructor() { effect(() => { diff --git a/src/app/features/preprints/components/preprint-details/moderation-status-banner/moderation-status-banner.component.ts b/src/app/features/preprints/components/preprint-details/moderation-status-banner/moderation-status-banner.component.ts index 11a401117..4d4a5d5f1 100644 --- a/src/app/features/preprints/components/preprint-details/moderation-status-banner/moderation-status-banner.component.ts +++ b/src/app/features/preprints/components/preprint-details/moderation-status-banner/moderation-status-banner.component.ts @@ -40,9 +40,8 @@ export class ModerationStatusBannerComponent { latestWithdrawalRequest = input.required(); isPendingWithdrawal = input.required(); - noActions = computed(() => { - return this.latestAction() === null; - }); + + noActions = computed(() => this.latestAction() === null); documentType = computed(() => { const provider = this.provider(); @@ -106,20 +105,9 @@ export class ModerationStatusBannerComponent { return recentActivityMessageByState[ReviewsState.PendingWithdrawal]; }); - actionCreatorName = computed(() => { - return this.latestAction()?.creator.name; - }); - actionCreatorLink = computed(() => { - return `${environment.webUrl}/${this.actionCreatorId()}`; - }); - actionCreatorId = computed(() => { - return this.latestAction()?.creator.id; - }); - - withdrawalRequesterName = computed(() => { - return this.latestWithdrawalRequest()?.creator.name; - }); - withdrawalRequesterId = computed(() => { - return this.latestWithdrawalRequest()?.creator.id; - }); + actionCreatorName = computed(() => this.latestAction()?.creator.name); + actionCreatorLink = computed(() => `${environment.webUrl}/${this.actionCreatorId()}`); + actionCreatorId = computed(() => this.latestAction()?.creator.id); + withdrawalRequesterName = computed(() => this.latestWithdrawalRequest()?.creator.name); + withdrawalRequesterId = computed(() => this.latestWithdrawalRequest()?.creator.id); } diff --git a/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.html b/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.html index be9ad3eb5..a1b192429 100644 --- a/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.html +++ b/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.html @@ -15,7 +15,7 @@

{{ 'preprints.preprintStepper.review.sections.metadata.authors' | translate
@for (contributor of bibliographicContributors(); track contributor.id) { } diff --git a/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.ts b/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.ts index a41200bee..f096332b7 100644 --- a/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.ts +++ b/src/app/features/preprints/components/preprint-details/preprint-tombstone/preprint-tombstone.component.ts @@ -9,21 +9,23 @@ import { Tag } from 'primeng/tag'; import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, effect, input, OnDestroy, output } from '@angular/core'; +import { RouterLink } from '@angular/router'; -import { PreprintDoiSectionComponent } from '@osf/features/preprints/components/preprint-details/preprint-doi-section/preprint-doi-section.component'; import { ApplicabilityStatus, PreregLinkInfo } from '@osf/features/preprints/enums'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; import { FetchPreprintById, PreprintSelectors } from '@osf/features/preprints/store/preprint'; -import { TruncatedTextComponent } from '@shared/components'; -import { ResourceType } from '@shared/enums'; -import { InterpolatePipe } from '@shared/pipes'; +import { TruncatedTextComponent } from '@osf/shared/components'; +import { ResourceType } from '@osf/shared/enums'; +import { InterpolatePipe } from '@osf/shared/pipes'; import { ContributorsSelectors, FetchSelectedSubjects, GetAllContributors, ResetContributorsState, SubjectsSelectors, -} from '@shared/stores'; +} from '@osf/shared/stores'; + +import { PreprintDoiSectionComponent } from '../preprint-doi-section/preprint-doi-section.component'; @Component({ selector: 'osf-preprint-tombstone', @@ -40,6 +42,7 @@ import { AccordionHeader, InterpolatePipe, DatePipe, + RouterLink, ], templateUrl: './preprint-tombstone.component.html', styleUrl: './preprint-tombstone.component.scss', @@ -64,9 +67,7 @@ export class PreprintTombstoneComponent implements OnDestroy { contributors = select(ContributorsSelectors.getContributors); areContributorsLoading = select(ContributorsSelectors.isContributorsLoading); - bibliographicContributors = computed(() => { - return this.contributors().filter((contributor) => contributor.isBibliographic); - }); + bibliographicContributors = computed(() => this.contributors().filter((contributor) => contributor.isBibliographic)); subjects = select(SubjectsSelectors.getSelectedSubjects); areSelectedSubjectsLoading = select(SubjectsSelectors.areSelectedSubjectsLoading); @@ -75,9 +76,8 @@ export class PreprintTombstoneComponent implements OnDestroy { if (!preprint) return null; return preprint.embeddedLicense; }); - licenseOptionsRecord = computed(() => { - return (this.preprint()?.licenseOptions ?? {}) as Record; - }); + + licenseOptionsRecord = computed(() => (this.preprint()?.licenseOptions ?? {}) as Record); skeletonData = Array.from({ length: 6 }, () => null); diff --git a/src/app/features/preprints/components/stepper/review-step/review-step.component.html b/src/app/features/preprints/components/stepper/review-step/review-step.component.html index 196c72858..77ef78227 100644 --- a/src/app/features/preprints/components/stepper/review-step/review-step.component.html +++ b/src/app/features/preprints/components/stepper/review-step/review-step.component.html @@ -68,12 +68,7 @@

{{ 'preprints.preprintStepper.review.sections.metadata.contributors' | trans @if (contributor.isUnregisteredContributor) { {{ contributor.fullName }} } @else { - + {{ contributor.fullName }} } diff --git a/src/app/features/preprints/components/stepper/review-step/review-step.component.ts b/src/app/features/preprints/components/stepper/review-step/review-step.component.ts index acfe9feeb..5640ab6e3 100644 --- a/src/app/features/preprints/components/stepper/review-step/review-step.component.ts +++ b/src/app/features/preprints/components/stepper/review-step/review-step.component.ts @@ -9,7 +9,7 @@ import { Tag } from 'primeng/tag'; import { DatePipe, TitleCasePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, computed, inject, input, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; +import { Router, RouterLink } from '@angular/router'; import { ApplicabilityStatus, PreregLinkInfo, ReviewsState } from '@osf/features/preprints/enums'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; @@ -26,8 +26,6 @@ import { ToastService } from '@shared/services'; import { ContributorsSelectors, FetchSelectedSubjects, GetAllContributors, SubjectsSelectors } from '@shared/stores'; import { FetchResourceInstitutions, InstitutionsSelectors } from '@shared/stores/institutions'; -import { environment } from 'src/environments/environment'; - @Component({ selector: 'osf-review-step', imports: [ @@ -44,6 +42,7 @@ import { environment } from 'src/environments/environment'; AccordionPanel, InterpolatePipe, AffiliatedInstitutionsViewComponent, + RouterLink, ], templateUrl: './review-step.component.html', styleUrl: './review-step.component.scss', @@ -65,18 +64,13 @@ export class ReviewStepComponent implements OnInit { isPreprintSubmitting = select(PreprintStepperSelectors.isPreprintSubmitting); contributors = select(ContributorsSelectors.getContributors); - bibliographicContributors = computed(() => { - return this.contributors().filter((contributor) => contributor.isBibliographic); - }); + bibliographicContributors = computed(() => this.contributors().filter((contributor) => contributor.isBibliographic)); subjects = select(SubjectsSelectors.getSelectedSubjects); affiliatedInstitutions = select(InstitutionsSelectors.getResourceInstitutions); license = select(PreprintStepperSelectors.getPreprintLicense); preprintProject = select(PreprintStepperSelectors.getPreprintProject); - licenseOptionsRecord = computed(() => { - return (this.preprint()?.licenseOptions ?? {}) as Record; - }); + licenseOptionsRecord = computed(() => (this.preprint()?.licenseOptions ?? {}) as Record); - readonly environment = environment; readonly ApplicabilityStatus = ApplicabilityStatus; readonly PreregLinkInfo = PreregLinkInfo; diff --git a/src/app/features/project/overview/components/linked-resources/linked-resources.component.html b/src/app/features/project/overview/components/linked-resources/linked-resources.component.html index 44fff2ec1..55470cc30 100644 --- a/src/app/features/project/overview/components/linked-resources/linked-resources.component.html +++ b/src/app/features/project/overview/components/linked-resources/linked-resources.component.html @@ -39,7 +39,7 @@

{{ 'common.labels.contributors' | translate }}:

@for (contributor of linkedResource.contributors; track contributor.id) { } diff --git a/src/app/features/project/overview/components/linked-resources/linked-resources.component.ts b/src/app/features/project/overview/components/linked-resources/linked-resources.component.ts index 9a3e1e76b..78b0a55b8 100644 --- a/src/app/features/project/overview/components/linked-resources/linked-resources.component.ts +++ b/src/app/features/project/overview/components/linked-resources/linked-resources.component.ts @@ -8,6 +8,7 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; +import { RouterLink } from '@angular/router'; import { IconComponent, TruncatedTextComponent } from '@osf/shared/components'; import { IS_MEDIUM } from '@osf/shared/helpers'; @@ -18,7 +19,7 @@ import { LinkResourceDialogComponent } from '../link-resource-dialog/link-resour @Component({ selector: 'osf-linked-resources', - imports: [Button, Skeleton, TranslatePipe, TruncatedTextComponent, IconComponent], + imports: [Button, Skeleton, TranslatePipe, TruncatedTextComponent, IconComponent, RouterLink], templateUrl: './linked-resources.component.html', styleUrl: './linked-resources.component.scss', providers: [DialogService], diff --git a/src/app/features/project/overview/components/overview-components/overview-components.component.html b/src/app/features/project/overview/components/overview-components/overview-components.component.html index a1e265639..d78907d11 100644 --- a/src/app/features/project/overview/components/overview-components/overview-components.component.html +++ b/src/app/features/project/overview/components/overview-components/overview-components.component.html @@ -48,7 +48,7 @@

@for (contributor of component.contributors; track contributor.id) { } diff --git a/src/app/features/project/overview/components/overview-components/overview-components.component.ts b/src/app/features/project/overview/components/overview-components/overview-components.component.ts index 0a838d8dd..18b642f28 100644 --- a/src/app/features/project/overview/components/overview-components/overview-components.component.ts +++ b/src/app/features/project/overview/components/overview-components/overview-components.component.ts @@ -9,7 +9,7 @@ import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; -import { Router } from '@angular/router'; +import { Router, RouterLink } from '@angular/router'; import { IconComponent, TruncatedTextComponent } from '@osf/shared/components'; import { ResourceType, UserPermissions } from '@osf/shared/enums'; @@ -21,7 +21,7 @@ import { DeleteComponentDialogComponent } from '../delete-component-dialog/delet @Component({ selector: 'osf-project-components', - imports: [Button, Menu, Skeleton, TranslatePipe, TruncatedTextComponent, IconComponent], + imports: [Button, Menu, Skeleton, TranslatePipe, TruncatedTextComponent, IconComponent, RouterLink], templateUrl: './overview-components.component.html', styleUrl: './overview-components.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/src/app/features/registries/components/review/review.component.html b/src/app/features/registries/components/review/review.component.html index 6e7a84b81..2fb70d1f6 100644 --- a/src/app/features/registries/components/review/review.component.html +++ b/src/app/features/registries/components/review/review.component.html @@ -29,7 +29,7 @@

{{ 'navigation.contributors' | translate }}

@for (contributor of contributors(); let last = $last; track contributor.id) { - {{ contributor.fullName }} + {{ contributor.fullName }} @if (!last) { , } diff --git a/src/app/features/registry/components/short-registration-info/short-registration-info.component.html b/src/app/features/registry/components/short-registration-info/short-registration-info.component.html index ecf9c9da0..c67597ce2 100644 --- a/src/app/features/registry/components/short-registration-info/short-registration-info.component.html +++ b/src/app/features/registry/components/short-registration-info/short-registration-info.component.html @@ -1,9 +1,9 @@

{{ 'navigation.contributors' | translate }}

- @for (c of registration().contributors; track c.id) { - {{ c.fullName }} + @for (contributor of registration().contributors; track contributor.id) { + + {{ contributor.fullName }} {{ !$last ? ', ' : '' }} } @@ -30,6 +30,6 @@

{{ 'registry.archiving.createdDate' | translate }}

{{ 'registry.overview.metadata.associatedProject' | translate }}

- {{ associatedProjectUrl }} + {{ associatedProjectUrl }}
diff --git a/src/app/features/registry/components/short-registration-info/short-registration-info.component.ts b/src/app/features/registry/components/short-registration-info/short-registration-info.component.ts index 7ebd33717..ba8f8011d 100644 --- a/src/app/features/registry/components/short-registration-info/short-registration-info.component.ts +++ b/src/app/features/registry/components/short-registration-info/short-registration-info.component.ts @@ -2,6 +2,7 @@ import { TranslatePipe } from '@ngx-translate/core'; import { DatePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; +import { RouterLink } from '@angular/router'; import { RegistryOverview } from '../../models'; @@ -9,7 +10,7 @@ import { environment } from 'src/environments/environment'; @Component({ selector: 'osf-short-registration-info', - imports: [TranslatePipe, DatePipe], + imports: [TranslatePipe, DatePipe, RouterLink], templateUrl: './short-registration-info.component.html', styleUrl: './short-registration-info.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, @@ -17,9 +18,7 @@ import { environment } from 'src/environments/environment'; export class ShortRegistrationInfoComponent { registration = input.required(); - readonly environment = environment; - get associatedProjectUrl(): string { - return `${this.environment.webUrl}/${this.registration().associatedProjectId}`; + return `${environment.webUrl}/${this.registration().associatedProjectId}`; } } diff --git a/src/app/shared/components/cookie-consent/cookie-consent.component.ts b/src/app/shared/components/cookie-consent/cookie-consent.component.ts index 35402f655..f928a3688 100644 --- a/src/app/shared/components/cookie-consent/cookie-consent.component.ts +++ b/src/app/shared/components/cookie-consent/cookie-consent.component.ts @@ -1,4 +1,4 @@ -import { TranslateModule, TranslateService } from '@ngx-translate/core'; +import { TranslatePipe, TranslateService } from '@ngx-translate/core'; import { MessageService, PrimeTemplate } from 'primeng/api'; import { Button } from 'primeng/button'; @@ -10,10 +10,9 @@ import { CookieConsentService } from '../../services/cookie-consent/cookie-conse @Component({ selector: 'osf-cookie-consent', - standalone: true, templateUrl: './cookie-consent.component.html', styleUrls: ['./cookie-consent.component.scss'], - imports: [Toast, Button, PrimeTemplate, TranslateModule], + imports: [Toast, Button, PrimeTemplate, TranslatePipe], }) export class CookieConsentComponent implements AfterViewInit { private readonly toastService = inject(MessageService); diff --git a/src/app/shared/components/registration-card/registration-card.component.html b/src/app/shared/components/registration-card/registration-card.component.html index c4f6b5e9c..c1650c5e4 100644 --- a/src/app/shared/components/registration-card/registration-card.component.html +++ b/src/app/shared/components/registration-card/registration-card.component.html @@ -39,7 +39,7 @@

{{ 'project.overview.metadata.contributors' | translate }}: @for (contributor of registrationData().contributors; track contributor) { - {{ contributor.fullName }} + {{ contributor.fullName }} @if (!$last) { , } diff --git a/src/app/shared/components/wiki/add-wiki-dialog/add-wiki-dialog.component.html b/src/app/shared/components/wiki/add-wiki-dialog/add-wiki-dialog.component.html index 7f1ed40cd..f6827f466 100644 --- a/src/app/shared/components/wiki/add-wiki-dialog/add-wiki-dialog.component.html +++ b/src/app/shared/components/wiki/add-wiki-dialog/add-wiki-dialog.component.html @@ -7,7 +7,7 @@
- + {{ 'project.wiki.edit' | translate }}

severity="success" class="mr-2" [disabled]="!currentContent()" - (click)="save()" + (onClick)="save()" [loading]="isSaving()" > - +

@@ -26,13 +26,17 @@

{{ 'project.wiki.edit' | translate }}

height="100%" > - - -
@@ -44,9 +48,13 @@

{{ 'project.wiki.edit' | translate }}

binary (onChange)="toggleAutocomplete()" /> - +
-
diff --git a/src/app/shared/components/wiki/edit-section/edit-section.component.ts b/src/app/shared/components/wiki/edit-section/edit-section.component.ts index 11ae7aba0..9add131aa 100644 --- a/src/app/shared/components/wiki/edit-section/edit-section.component.ts +++ b/src/app/shared/components/wiki/edit-section/edit-section.component.ts @@ -4,7 +4,7 @@ import { TranslatePipe, TranslateService } from '@ngx-translate/core'; import { Button } from 'primeng/button'; import { Checkbox } from 'primeng/checkbox'; import { DialogService } from 'primeng/dynamicdialog'; -import { PanelModule } from 'primeng/panel'; +import { Panel } from 'primeng/panel'; import { ChangeDetectionStrategy, Component, effect, inject, input, OnInit, output } from '@angular/core'; import { FormsModule } from '@angular/forms'; @@ -15,7 +15,7 @@ import { WikiSyntaxHelpDialogComponent } from '../wiki-syntax-help-dialog/wiki-s @Component({ selector: 'osf-edit-section', - imports: [PanelModule, Button, TranslatePipe, FormsModule, LMarkdownEditorModule, Checkbox], + imports: [Panel, Button, TranslatePipe, FormsModule, LMarkdownEditorModule, Checkbox], templateUrl: './edit-section.component.html', styleUrl: './edit-section.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/src/app/shared/components/wiki/view-section/view-section.component.ts b/src/app/shared/components/wiki/view-section/view-section.component.ts index a7b6ea907..1a7a5726b 100644 --- a/src/app/shared/components/wiki/view-section/view-section.component.ts +++ b/src/app/shared/components/wiki/view-section/view-section.component.ts @@ -1,6 +1,6 @@ import { TranslatePipe } from '@ngx-translate/core'; -import { PanelModule } from 'primeng/panel'; +import { Panel } from 'primeng/panel'; import { Select } from 'primeng/select'; import { Skeleton } from 'primeng/skeleton'; @@ -13,7 +13,7 @@ import { MarkdownComponent } from '../../markdown/markdown.component'; @Component({ selector: 'osf-view-section', - imports: [PanelModule, Select, FormsModule, TranslatePipe, Skeleton, MarkdownComponent], + imports: [Panel, Select, FormsModule, TranslatePipe, Skeleton, MarkdownComponent], templateUrl: './view-section.component.html', styleUrl: './view-section.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, @@ -33,14 +33,13 @@ export class ViewSectionComponent { selectedVersion = signal(null); - content = computed(() => { - return this.selectedVersion() === null ? this.previewContent() : this.versionContent(); - }); + content = computed(() => (this.selectedVersion() === null ? this.previewContent() : this.versionContent())); mappedVersions = computed(() => [ this.previewOption, ...this.versions().map((version, index) => { const labelPrefix = index === 0 ? '(Current)' : `(${this.versions().length - index})`; + return { label: `${labelPrefix} ${version.createdBy}: (${new Date(version.createdAt).toLocaleString()})`, value: version.id, diff --git a/src/app/shared/components/wiki/wiki-list/wiki-list.component.ts b/src/app/shared/components/wiki/wiki-list/wiki-list.component.ts index 63ce9bd5d..e7b914a46 100644 --- a/src/app/shared/components/wiki/wiki-list/wiki-list.component.ts +++ b/src/app/shared/components/wiki/wiki-list/wiki-list.component.ts @@ -1,14 +1,13 @@ import { TranslatePipe, TranslateService } from '@ngx-translate/core'; import { Button } from 'primeng/button'; -import { ButtonGroupModule } from 'primeng/buttongroup'; import { DialogService } from 'primeng/dynamicdialog'; -import { PanelModule } from 'primeng/panel'; -import { PanelMenuModule } from 'primeng/panelmenu'; +import { Panel } from 'primeng/panel'; +import { PanelMenu } from 'primeng/panelmenu'; import { Skeleton } from 'primeng/skeleton'; import { ChangeDetectionStrategy, Component, computed, inject, input, output, signal } from '@angular/core'; -import { Router, RouterModule } from '@angular/router'; +import { Router } from '@angular/router'; import { ComponentWiki, Wiki, WikiItemType, WikiMenuItem } from '@osf/shared/models'; import { CustomConfirmationService } from '@osf/shared/services'; @@ -17,7 +16,7 @@ import { AddWikiDialogComponent } from '../add-wiki-dialog/add-wiki-dialog.compo @Component({ selector: 'osf-wiki-list', - imports: [PanelModule, Button, PanelMenuModule, ButtonGroupModule, Skeleton, RouterModule, TranslatePipe], + imports: [Button, Panel, PanelMenu, Skeleton, TranslatePipe], templateUrl: './wiki-list.component.html', styleUrl: './wiki-list.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 82b6e889a..f2f4860a9 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -828,6 +828,10 @@ "view": "View", "edit": "Edit", "compare": "Compare", + "autocomplete": "Autocomplete", + "horizontalRule": "Horizontal rule", + "redo": "Redo", + "undo": "Undo", "version": { "title": "Version", "preview": "Preview",