From 3cc2655e76187ef9b40a29e6c6d6bcc1896e5d0a Mon Sep 17 00:00:00 2001 From: Roma Date: Thu, 10 Jul 2025 18:31:55 +0300 Subject: [PATCH 1/5] fix(metadata-step): Added maxDate to the datepicker to be today's date --- .../stepper/metadata-step/metadata-step.component.html | 1 + .../components/stepper/metadata-step/metadata-step.component.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.html b/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.html index 7286e901f..ab3719ec2 100644 --- a/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.html +++ b/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.html @@ -67,6 +67,7 @@

{{ 'preprints.preprintStepper.metadata.publicationDateTitle' | translate }}< [showIcon]="true" [showOnFocus]="true" dateFormat="yy-mm-dd" + [maxDate]="today" > diff --git a/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.ts b/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.ts index 9784739db..eba893418 100644 --- a/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.ts +++ b/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.ts @@ -65,6 +65,7 @@ export class MetadataStepComponent implements OnInit { protected metadataForm!: FormGroup; protected inputLimits = formInputLimits; protected readonly INPUT_VALIDATION_MESSAGES = INPUT_VALIDATION_MESSAGES; + protected today = new Date(); licenses = select(SubmitPreprintSelectors.getLicenses); createdPreprint = select(SubmitPreprintSelectors.getCreatedPreprint); From 88e8adeabac683a5c18521313f251ff02acbc6bf Mon Sep 17 00:00:00 2001 From: Roma Date: Thu, 10 Jul 2025 18:58:23 +0300 Subject: [PATCH 2/5] feat(review-step): Added accordion for license to show full text --- .../review-step/review-step.component.html | 13 ++++++++++-- .../review-step/review-step.component.ts | 20 ++++++++++++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) 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 56fd7c245..a9de3b694 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 @@ -74,10 +74,19 @@

{{ 'preprints.preprintStepper.review.sections.metadata.affiliatedInstitution } -
+

{{ 'preprints.preprintStepper.review.sections.metadata.license' | translate }}

-
{{ license()?.name }}
+ + + +
{{ license()?.name }}
+
+ +
{{ license()!.text | interpolate: licenseOptionsRecord() }}
+
+
+
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 56c4913b6..f23af0f44 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 @@ -2,6 +2,7 @@ import { createDispatchMap, select } from '@ngxs/store'; import { TranslatePipe } from '@ngx-translate/core'; +import { Accordion, AccordionContent, AccordionHeader, AccordionPanel } from 'primeng/accordion'; import { Button } from 'primeng/button'; import { Card } from 'primeng/card'; import { Tag } from 'primeng/tag'; @@ -21,12 +22,26 @@ import { import { TruncatedTextComponent } from '@shared/components'; import { ResourceType } from '@shared/enums'; import { Institution } from '@shared/models'; +import { InterpolatePipe } from '@shared/pipes'; import { ToastService } from '@shared/services'; import { ContributorsSelectors, FetchSelectedSubjects, GetAllContributors, SubjectsSelectors } from '@shared/stores'; @Component({ selector: 'osf-review-step', - imports: [Card, TruncatedTextComponent, Tag, DatePipe, Button, TitleCasePipe, TranslatePipe], + imports: [ + Card, + TruncatedTextComponent, + Tag, + DatePipe, + Button, + TitleCasePipe, + TranslatePipe, + Accordion, + AccordionContent, + AccordionHeader, + AccordionPanel, + InterpolatePipe, + ], templateUrl: './review-step.component.html', styleUrl: './review-step.component.scss', changeDetection: ChangeDetectionStrategy.OnPush, @@ -52,6 +67,9 @@ export class ReviewStepComponent implements OnInit { affiliatedInstitutions = signal([]); license = select(SubmitPreprintSelectors.getPreprintLicense); preprintProject = select(SubmitPreprintSelectors.getPreprintProject); + licenseOptionsRecord = computed(() => { + return (this.createdPreprint()?.licenseOptions ?? {}) as Record; + }); readonly ApplicabilityStatus = ApplicabilityStatus; readonly PreregLinkInfo = PreregLinkInfo; From d68e418c3bc05d000b2bf5a9fa12fdff4c7b6e31 Mon Sep 17 00:00:00 2001 From: Roma Date: Thu, 10 Jul 2025 19:02:59 +0300 Subject: [PATCH 3/5] feat(update-preprint-stepper): Implemented stepper for updating preprint --- .../features/preprints/components/index.ts | 1 + src/app/features/preprints/constants/index.ts | 1 + .../constants/submit-preprint-steps.const.ts | 14 +- .../constants/update-preprint-steps.const.ts | 30 ++++ src/app/features/preprints/enums/index.ts | 2 +- ...t-steps.enum.ts => preprint-steps.enum.ts} | 2 +- src/app/features/preprints/models/index.ts | 1 + .../submit-preprint-stepper.component.ts | 10 +- .../update-preprint-stepper.component.html | 49 ++++++ .../update-preprint-stepper.component.scss | 0 .../update-preprint-stepper.component.spec.ts | 22 +++ .../update-preprint-stepper.component.ts | 159 ++++++++++++++++++ .../features/preprints/preprints.routes.ts | 8 + src/assets/i18n/en.json | 2 +- src/assets/styles/overrides/accordion.scss | 3 +- 15 files changed, 288 insertions(+), 16 deletions(-) create mode 100644 src/app/features/preprints/constants/update-preprint-steps.const.ts rename src/app/features/preprints/enums/{submit-steps.enum.ts => preprint-steps.enum.ts} (76%) create mode 100644 src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.html create mode 100644 src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.scss create mode 100644 src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.spec.ts create mode 100644 src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts diff --git a/src/app/features/preprints/components/index.ts b/src/app/features/preprints/components/index.ts index a5ba927a9..3bbf02dfa 100644 --- a/src/app/features/preprints/components/index.ts +++ b/src/app/features/preprints/components/index.ts @@ -16,4 +16,5 @@ export { PreprintsResourcesFiltersComponent } from '@osf/features/preprints/comp export { PreprintsSubjectFilterComponent } from '@osf/features/preprints/components/filters/preprints-subject-filter/preprints-subject-filter.component'; export { FileStepComponent } from '@osf/features/preprints/components/stepper/file-step/file-step.component'; export { MetadataStepComponent } from '@osf/features/preprints/components/stepper/metadata-step/metadata-step.component'; +export { ReviewStepComponent } from '@osf/features/preprints/components/stepper/review-step/review-step.component'; export { TitleAndAbstractStepComponent } from '@osf/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component'; diff --git a/src/app/features/preprints/constants/index.ts b/src/app/features/preprints/constants/index.ts index 0dd479b4e..8e5ae9b36 100644 --- a/src/app/features/preprints/constants/index.ts +++ b/src/app/features/preprints/constants/index.ts @@ -1,3 +1,4 @@ export * from './form-input-limits.const'; export * from './prereg-link-options.const'; export * from './submit-preprint-steps.const'; +export * from './update-preprint-steps.const'; diff --git a/src/app/features/preprints/constants/submit-preprint-steps.const.ts b/src/app/features/preprints/constants/submit-preprint-steps.const.ts index bf54070bd..e7f30a7d2 100644 --- a/src/app/features/preprints/constants/submit-preprint-steps.const.ts +++ b/src/app/features/preprints/constants/submit-preprint-steps.const.ts @@ -1,35 +1,35 @@ -import { SubmitSteps } from '@osf/features/preprints/enums'; +import { PreprintSteps } from '@osf/features/preprints/enums'; import { StepOption } from '@shared/models'; export const submitPreprintSteps: StepOption[] = [ { index: 0, label: 'preprints.preprintStepper.steps.titleAndAbstract', - value: SubmitSteps.TitleAndAbstract, + value: PreprintSteps.TitleAndAbstract, }, { index: 1, label: 'preprints.preprintStepper.steps.file', - value: SubmitSteps.File, + value: PreprintSteps.File, }, { index: 2, label: 'preprints.preprintStepper.steps.metadata', - value: SubmitSteps.Metadata, + value: PreprintSteps.Metadata, }, { index: 3, label: 'preprints.preprintStepper.steps.authorAssertions', - value: SubmitSteps.AuthorAssertions, + value: PreprintSteps.AuthorAssertions, }, { index: 4, label: 'preprints.preprintStepper.steps.supplements', - value: SubmitSteps.Supplements, + value: PreprintSteps.Supplements, }, { index: 5, label: 'preprints.preprintStepper.steps.review', - value: SubmitSteps.Review, + value: PreprintSteps.Review, }, ]; diff --git a/src/app/features/preprints/constants/update-preprint-steps.const.ts b/src/app/features/preprints/constants/update-preprint-steps.const.ts new file mode 100644 index 000000000..f2cc9beb2 --- /dev/null +++ b/src/app/features/preprints/constants/update-preprint-steps.const.ts @@ -0,0 +1,30 @@ +import { PreprintSteps } from '@osf/features/preprints/enums'; +import { StepOption } from '@shared/models'; + +export const updatePreprintSteps: StepOption[] = [ + { + index: 0, + label: 'preprints.preprintStepper.steps.titleAndAbstract', + value: PreprintSteps.TitleAndAbstract, + }, + { + index: 1, + label: 'preprints.preprintStepper.steps.metadata', + value: PreprintSteps.Metadata, + }, + { + index: 2, + label: 'preprints.preprintStepper.steps.authorAssertions', + value: PreprintSteps.AuthorAssertions, + }, + { + index: 3, + label: 'preprints.preprintStepper.steps.supplements', + value: PreprintSteps.Supplements, + }, + { + index: 4, + label: 'preprints.preprintStepper.steps.review', + value: PreprintSteps.Review, + }, +]; diff --git a/src/app/features/preprints/enums/index.ts b/src/app/features/preprints/enums/index.ts index 6e7a24296..bddf45375 100644 --- a/src/app/features/preprints/enums/index.ts +++ b/src/app/features/preprints/enums/index.ts @@ -1,5 +1,5 @@ export { ApplicabilityStatus } from './applicability-status.enum'; export { PreprintFileSource } from './preprint-file-source.enum'; +export { PreprintSteps } from './preprint-steps.enum'; export { PreregLinkInfo } from './prereg-link-info.enum'; -export { SubmitSteps } from './submit-steps.enum'; export { SupplementOptions } from './supplement-options.enum'; diff --git a/src/app/features/preprints/enums/submit-steps.enum.ts b/src/app/features/preprints/enums/preprint-steps.enum.ts similarity index 76% rename from src/app/features/preprints/enums/submit-steps.enum.ts rename to src/app/features/preprints/enums/preprint-steps.enum.ts index ecdd9a3a1..baa176c09 100644 --- a/src/app/features/preprints/enums/submit-steps.enum.ts +++ b/src/app/features/preprints/enums/preprint-steps.enum.ts @@ -1,4 +1,4 @@ -export enum SubmitSteps { +export enum PreprintSteps { TitleAndAbstract = 0, File, Metadata, diff --git a/src/app/features/preprints/models/index.ts b/src/app/features/preprints/models/index.ts index 8df6fdc96..5889a3cda 100644 --- a/src/app/features/preprints/models/index.ts +++ b/src/app/features/preprints/models/index.ts @@ -1,3 +1,4 @@ +export * from './can-deactivate.interface'; export * from './preprint.models'; export * from './preprint-json-api.models'; export * from './preprint-licenses-json-api.models'; diff --git a/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts b/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts index 83bf1ad75..53b3cffdf 100644 --- a/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts +++ b/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts @@ -23,13 +23,13 @@ import { AuthorAssertionsStepComponent, FileStepComponent, MetadataStepComponent, + ReviewStepComponent, SupplementsStepComponent, TitleAndAbstractStepComponent, } from '@osf/features/preprints/components'; -import { ReviewStepComponent } from '@osf/features/preprints/components/stepper/review-step/review-step.component'; import { submitPreprintSteps } from '@osf/features/preprints/constants'; -import { SubmitSteps } from '@osf/features/preprints/enums'; -import { CanDeactivateComponent } from '@osf/features/preprints/models/can-deactivate.interface'; +import { PreprintSteps } from '@osf/features/preprints/enums'; +import { CanDeactivateComponent } from '@osf/features/preprints/models'; import { GetPreprintProviderById, PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; import { ResetStateAndDeletePreprint, @@ -71,7 +71,7 @@ export class SubmitPreprintStepperComponent implements OnInit, OnDestroy, CanDea resetStateAndDeletePreprint: ResetStateAndDeletePreprint, }); - readonly SubmitStepsEnum = SubmitSteps; + readonly SubmitStepsEnum = PreprintSteps; preprintProvider = select(PreprintProvidersSelectors.getPreprintProviderDetails(this.providerId())); isPreprintProviderLoading = select(PreprintProvidersSelectors.isPreprintProviderDetailsLoading); @@ -88,7 +88,7 @@ export class SubmitPreprintStepperComponent implements OnInit, OnDestroy, CanDea return submitPreprintSteps .map((step) => { - if (!provider.assertionsEnabled && step.value === SubmitSteps.AuthorAssertions) { + if (!provider.assertionsEnabled && step.value === PreprintSteps.AuthorAssertions) { return null; } diff --git a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.html b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.html new file mode 100644 index 000000000..7ed6b07c2 --- /dev/null +++ b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.html @@ -0,0 +1,49 @@ +
+
+ @if (isPreprintProviderLoading()) { + + + } @else { + +

{{ 'Edit ' + preprintProvider()!.preprintWord }}

+ } +
+ + @if (isWeb()) { + @if (isPreprintProviderLoading()) { + + } @else { + + } + } +
+ +
+ @switch (currentStep().value) { + @case (PreprintSteps.TitleAndAbstract) { + + } + @case (PreprintSteps.Metadata) { + + } + @case (PreprintSteps.AuthorAssertions) { + + } + @case (PreprintSteps.Supplements) { + + } + @case (PreprintSteps.Review) { + + } + } +
diff --git a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.scss b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.spec.ts b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.spec.ts new file mode 100644 index 000000000..da1c19a1c --- /dev/null +++ b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.spec.ts @@ -0,0 +1,22 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UpdatePreprintStepperComponent } from './update-preprint-stepper.component'; + +describe('UpdatePreprintStepperComponent', () => { + let component: UpdatePreprintStepperComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [UpdatePreprintStepperComponent], + }).compileComponents(); + + fixture = TestBed.createComponent(UpdatePreprintStepperComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts new file mode 100644 index 000000000..dcff098cf --- /dev/null +++ b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts @@ -0,0 +1,159 @@ +import { createDispatchMap, select } from '@ngxs/store'; + +import { Skeleton } from 'primeng/skeleton'; + +import { map, Observable, of } from 'rxjs'; + +import { + ChangeDetectionStrategy, + Component, + computed, + effect, + HostBinding, + HostListener, + inject, + OnDestroy, + OnInit, + signal, +} from '@angular/core'; +import { toSignal } from '@angular/core/rxjs-interop'; +import { ActivatedRoute } from '@angular/router'; + +import { + AuthorAssertionsStepComponent, + MetadataStepComponent, + ReviewStepComponent, + SupplementsStepComponent, + TitleAndAbstractStepComponent, +} from '@osf/features/preprints/components'; +import { updatePreprintSteps } from '@osf/features/preprints/constants'; +import { PreprintSteps } from '@osf/features/preprints/enums'; +import { CanDeactivateComponent } from '@osf/features/preprints/models'; +import { GetPreprintProviderById, PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; +import { + FetchPreprintById, + ResetStateAndDeletePreprint, + SetSelectedPreprintProviderId, + SubmitPreprintSelectors, +} from '@osf/features/preprints/store/submit-preprint'; +import { StepperComponent } from '@shared/components'; +import { StepOption } from '@shared/models'; +import { BrandService } from '@shared/services'; +import { BrowserTabHelper, HeaderStyleHelper, IS_WEB } from '@shared/utils'; + +@Component({ + selector: 'osf-update-preprint-stepper', + imports: [ + AuthorAssertionsStepComponent, + Skeleton, + StepperComponent, + TitleAndAbstractStepComponent, + MetadataStepComponent, + SupplementsStepComponent, + ReviewStepComponent, + ], + templateUrl: './update-preprint-stepper.component.html', + styleUrl: './update-preprint-stepper.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class UpdatePreprintStepperComponent implements OnInit, OnDestroy, CanDeactivateComponent { + @HostBinding('class') classes = 'flex-1 flex flex-column w-full'; + + private readonly route = inject(ActivatedRoute); + + private providerId = toSignal(this.route.params.pipe(map((params) => params['providerId'])) ?? of(undefined)); + private preprintId = toSignal(this.route.params.pipe(map((params) => params['preprintId'])) ?? of(undefined)); + + private actions = createDispatchMap({ + getPreprintProviderById: GetPreprintProviderById, + setSelectedPreprintProviderId: SetSelectedPreprintProviderId, + resetStateAndDeletePreprint: ResetStateAndDeletePreprint, + fetchPreprint: FetchPreprintById, + }); + + readonly updateSteps = computed(() => { + const provider = this.preprintProvider(); + + if (!provider) { + return []; + } + + return updatePreprintSteps + .map((step) => { + if (!provider.assertionsEnabled && step.value === PreprintSteps.AuthorAssertions) { + return null; + } + + return step; + }) + .filter((step) => step !== null) + .map((step, index) => ({ + ...step, + index, + })); + }); + + preprintProvider = select(PreprintProvidersSelectors.getPreprintProviderDetails(this.providerId())); + isPreprintProviderLoading = select(PreprintProvidersSelectors.isPreprintProviderDetailsLoading); + hasBeenSubmitted = select(SubmitPreprintSelectors.hasBeenSubmitted); + currentStep = signal(updatePreprintSteps[4]); + isWeb = toSignal(inject(IS_WEB)); + + readonly PreprintSteps = PreprintSteps; + + constructor() { + effect(() => { + const provider = this.preprintProvider(); + + if (provider) { + this.actions.setSelectedPreprintProviderId(provider.id); + BrandService.applyBranding(provider.brand); + HeaderStyleHelper.applyHeaderStyles( + provider.brand.primaryColor, + provider.brand.secondaryColor, + provider.brand.heroBackgroundImageUrl + ); + BrowserTabHelper.updateTabStyles(provider.faviconUrl, provider.name); + } + }); + } + + canDeactivate(): Observable | boolean { + return this.hasBeenSubmitted(); + } + + ngOnInit() { + this.actions.getPreprintProviderById(this.providerId()); + this.actions.fetchPreprint(this.preprintId()); + } + + ngOnDestroy() { + HeaderStyleHelper.resetToDefaults(); + BrandService.resetBranding(); + BrowserTabHelper.resetToDefaults(); + this.actions.resetStateAndDeletePreprint(); + } + + stepChange(step: StepOption): void { + const currentStepIndex = this.currentStep()?.index ?? 0; + if (step.index >= currentStepIndex) { + return; + } + + this.currentStep.set(step); + } + + moveToNextStep() { + this.currentStep.set(this.updateSteps()[this.currentStep()?.index + 1]); + } + + moveToPreviousStep() { + this.currentStep.set(this.updateSteps()[this.currentStep()?.index - 1]); + } + + @HostListener('window:beforeunload', ['$event']) + public onBeforeUnload($event: BeforeUnloadEvent): boolean { + $event.preventDefault(); + return false; + } +} diff --git a/src/app/features/preprints/preprints.routes.ts b/src/app/features/preprints/preprints.routes.ts index c882819c3..4d6788868 100644 --- a/src/app/features/preprints/preprints.routes.ts +++ b/src/app/features/preprints/preprints.routes.ts @@ -68,6 +68,14 @@ export const preprintsRoutes: Routes = [ ), canDeactivate: [ConfirmLeavingGuard], }, + { + path: ':providerId/edit/:preprintId', + loadComponent: () => + import('@osf/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component').then( + (c) => c.UpdatePreprintStepperComponent + ), + canDeactivate: [ConfirmLeavingGuard], + }, ], }, ]; diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index d5468cc81..76143ca1d 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -83,7 +83,7 @@ "message": "Are you sure you want to proceed?" }, "discardChanges": { - "header": "You Have Unsaved Changes", + "header": "You Might Loose Unsaved Changes", "message": "Are you sure you want to proceed?" }, "links": { diff --git a/src/assets/styles/overrides/accordion.scss b/src/assets/styles/overrides/accordion.scss index 9b5c6e78f..7b03f6ad5 100644 --- a/src/assets/styles/overrides/accordion.scss +++ b/src/assets/styles/overrides/accordion.scss @@ -14,7 +14,8 @@ } } -.resource { +.resource, +.license { .p-accordion { --p-accordion-panel-border-width: 0; From 1b7d0ed586eac07013ca64b1646685d403c02207 Mon Sep 17 00:00:00 2001 From: Roma Date: Thu, 10 Jul 2025 19:15:27 +0300 Subject: [PATCH 4/5] refactor(preprint-stepper-store): Renamed submit-preprint -> preprint-stepper store --- .../author-assertions-step.component.ts | 6 +- .../stepper/file-step/file-step.component.ts | 40 +++---- .../metadata-step/metadata-step.component.ts | 10 +- .../preprints-subjects.component.ts | 4 +- .../review-step/review-step.component.ts | 10 +- .../supplements-step.component.ts | 20 ++-- .../title-and-abstract-step.component.ts | 12 +- .../select-preprint-service.component.ts | 7 +- .../submit-preprint-stepper.component.ts | 15 ++- .../update-preprint-stepper.component.ts | 12 +- .../features/preprints/preprints.routes.ts | 4 +- .../preprints/store/preprint-stepper/index.ts | 4 + .../preprint-stepper.actions.ts} | 18 +-- .../preprint-stepper.model.ts} | 2 +- .../preprint-stepper.selectors.ts | 85 ++++++++++++++ .../preprint-stepper.state.ts} | 111 +++++++++--------- .../preprints/store/submit-preprint/index.ts | 4 - .../submit-preprint.selectors.ts | 85 -------------- 18 files changed, 234 insertions(+), 215 deletions(-) create mode 100644 src/app/features/preprints/store/preprint-stepper/index.ts rename src/app/features/preprints/store/{submit-preprint/submit-preprint.actions.ts => preprint-stepper/preprint-stepper.actions.ts} (89%) rename src/app/features/preprints/store/{submit-preprint/submit-preprint.model.ts => preprint-stepper/preprint-stepper.model.ts} (94%) create mode 100644 src/app/features/preprints/store/preprint-stepper/preprint-stepper.selectors.ts rename src/app/features/preprints/store/{submit-preprint/submit-preprint.state.ts => preprint-stepper/preprint-stepper.state.ts} (84%) delete mode 100644 src/app/features/preprints/store/submit-preprint/index.ts delete mode 100644 src/app/features/preprints/store/submit-preprint/submit-preprint.selectors.ts diff --git a/src/app/features/preprints/components/stepper/author-assertion-step/author-assertions-step.component.ts b/src/app/features/preprints/components/stepper/author-assertion-step/author-assertions-step.component.ts index 0dcdb095b..3cd6165c6 100644 --- a/src/app/features/preprints/components/stepper/author-assertion-step/author-assertions-step.component.ts +++ b/src/app/features/preprints/components/stepper/author-assertion-step/author-assertions-step.component.ts @@ -28,7 +28,7 @@ import { ArrayInputComponent } from '@osf/features/preprints/components/stepper/ import { formInputLimits, preregLinksOptions } from '@osf/features/preprints/constants'; import { ApplicabilityStatus, PreregLinkInfo } from '@osf/features/preprints/enums'; import { Preprint } from '@osf/features/preprints/models'; -import { SubmitPreprintSelectors, UpdatePreprint } from '@osf/features/preprints/store/submit-preprint'; +import { PreprintStepperSelectors, UpdatePreprint } from '@osf/features/preprints/store/preprint-stepper'; import { FormSelectComponent } from '@shared/components'; import { INPUT_VALIDATION_MESSAGES } from '@shared/constants'; import { CustomConfirmationService, ToastService } from '@shared/services'; @@ -68,8 +68,8 @@ export class AuthorAssertionsStepComponent { readonly preregLinkOptions = preregLinksOptions; readonly linkValidators = [CustomValidators.linkValidator(), CustomValidators.requiredTrimmed()]; - createdPreprint = select(SubmitPreprintSelectors.getCreatedPreprint); - isUpdatingPreprint = select(SubmitPreprintSelectors.isPreprintSubmitting); + createdPreprint = select(PreprintStepperSelectors.getCreatedPreprint); + isUpdatingPreprint = select(PreprintStepperSelectors.isPreprintSubmitting); readonly authorAssertionsForm = new FormGroup({ hasCoi: new FormControl(this.createdPreprint()!.hasCoi || false, { diff --git a/src/app/features/preprints/components/stepper/file-step/file-step.component.ts b/src/app/features/preprints/components/stepper/file-step/file-step.component.ts index 9d7690adc..e423e6d01 100644 --- a/src/app/features/preprints/components/stepper/file-step/file-step.component.ts +++ b/src/app/features/preprints/components/stepper/file-step/file-step.component.ts @@ -31,15 +31,15 @@ import { PreprintFileSource } from '@osf/features/preprints/enums'; import { PreprintProviderDetails } from '@osf/features/preprints/models'; import { CopyFileFromProject, - GetAvailableProjects, - GetPreprintFilesLinks, - GetProjectFiles, - GetProjectFilesByLink, + FetchAvailableProjects, + FetchPreprintFilesLinks, + FetchProjectFiles, + FetchProjectFilesByLink, + PreprintStepperSelectors, ReuploadFile, SetSelectedPreprintFileSource, - SubmitPreprintSelectors, UploadFile, -} from '@osf/features/preprints/store/submit-preprint'; +} from '@osf/features/preprints/store/preprint-stepper'; import { FilesTreeActions } from '@osf/features/project/files/models'; import { FilesTreeComponent, IconComponent } from '@shared/components'; import { OsfFile } from '@shared/models'; @@ -70,12 +70,12 @@ export class FileStepComponent implements OnInit { private customConfirmationService = inject(CustomConfirmationService); private actions = createDispatchMap({ setSelectedFileSource: SetSelectedPreprintFileSource, - getPreprintFilesLinks: GetPreprintFilesLinks, + getPreprintFilesLinks: FetchPreprintFilesLinks, uploadFile: UploadFile, reuploadFile: ReuploadFile, - getAvailableProjects: GetAvailableProjects, - getFilesForSelectedProject: GetProjectFiles, - getProjectFilesByLink: GetProjectFilesByLink, + getAvailableProjects: FetchAvailableProjects, + getFilesForSelectedProject: FetchProjectFiles, + getProjectFilesByLink: FetchProjectFilesByLink, copyFileFromProject: CopyFileFromProject, }); private destroyRef = inject(DestroyRef); @@ -83,16 +83,16 @@ export class FileStepComponent implements OnInit { readonly PreprintFileSource = PreprintFileSource; provider = input.required(); - createdPreprint = select(SubmitPreprintSelectors.getCreatedPreprint); - providerId = select(SubmitPreprintSelectors.getSelectedProviderId); - selectedFileSource = select(SubmitPreprintSelectors.getSelectedFileSource); - fileUploadLink = select(SubmitPreprintSelectors.getUploadLink); - preprintFiles = select(SubmitPreprintSelectors.getPreprintFiles); - arePreprintFilesLoading = select(SubmitPreprintSelectors.arePreprintFilesLoading); - availableProjects = select(SubmitPreprintSelectors.getAvailableProjects); - areAvailableProjectsLoading = select(SubmitPreprintSelectors.areAvailableProjectsLoading); - projectFiles = select(SubmitPreprintSelectors.getProjectFiles); - areProjectFilesLoading = select(SubmitPreprintSelectors.areProjectFilesLoading); + createdPreprint = select(PreprintStepperSelectors.getCreatedPreprint); + providerId = select(PreprintStepperSelectors.getSelectedProviderId); + selectedFileSource = select(PreprintStepperSelectors.getSelectedFileSource); + fileUploadLink = select(PreprintStepperSelectors.getUploadLink); + preprintFiles = select(PreprintStepperSelectors.getPreprintFiles); + arePreprintFilesLoading = select(PreprintStepperSelectors.arePreprintFilesLoading); + availableProjects = select(PreprintStepperSelectors.getAvailableProjects); + areAvailableProjectsLoading = select(PreprintStepperSelectors.areAvailableProjectsLoading); + projectFiles = select(PreprintStepperSelectors.getProjectFiles); + areProjectFilesLoading = select(PreprintStepperSelectors.areProjectFilesLoading); selectedProjectId = signal(null); currentFolder = signal(null); diff --git a/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.ts b/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.ts index eba893418..8905948e6 100644 --- a/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.ts +++ b/src/app/features/preprints/components/stepper/metadata-step/metadata-step.component.ts @@ -18,10 +18,10 @@ import { MetadataForm, Preprint } from '@osf/features/preprints/models'; import { CreatePreprint, FetchLicenses, + PreprintStepperSelectors, SaveLicense, - SubmitPreprintSelectors, UpdatePreprint, -} from '@osf/features/preprints/store/submit-preprint'; +} from '@osf/features/preprints/store/preprint-stepper'; import { IconComponent, LicenseComponent, TagsInputComponent, TextInputComponent } from '@shared/components'; import { INPUT_VALIDATION_MESSAGES } from '@shared/constants'; import { License, LicenseOptions } from '@shared/models'; @@ -67,9 +67,9 @@ export class MetadataStepComponent implements OnInit { protected readonly INPUT_VALIDATION_MESSAGES = INPUT_VALIDATION_MESSAGES; protected today = new Date(); - licenses = select(SubmitPreprintSelectors.getLicenses); - createdPreprint = select(SubmitPreprintSelectors.getCreatedPreprint); - isUpdatingPreprint = select(SubmitPreprintSelectors.isPreprintSubmitting); + licenses = select(PreprintStepperSelectors.getLicenses); + createdPreprint = select(PreprintStepperSelectors.getCreatedPreprint); + isUpdatingPreprint = select(PreprintStepperSelectors.isPreprintSubmitting); nextClicked = output(); backClicked = output(); diff --git a/src/app/features/preprints/components/stepper/metadata-step/preprints-subjects/preprints-subjects.component.ts b/src/app/features/preprints/components/stepper/metadata-step/preprints-subjects/preprints-subjects.component.ts index fa5876c58..c7ce009f1 100644 --- a/src/app/features/preprints/components/stepper/metadata-step/preprints-subjects/preprints-subjects.component.ts +++ b/src/app/features/preprints/components/stepper/metadata-step/preprints-subjects/preprints-subjects.component.ts @@ -8,7 +8,7 @@ import { Message } from 'primeng/message'; import { ChangeDetectionStrategy, Component, effect, input, OnInit } from '@angular/core'; import { FormControl } from '@angular/forms'; -import { SubmitPreprintSelectors } from '@osf/features/preprints/store/submit-preprint'; +import { PreprintStepperSelectors } from '@osf/features/preprints/store/preprint-stepper'; import { SubjectsComponent } from '@osf/shared/components'; import { ResourceType } from '@osf/shared/enums'; import { SubjectModel } from '@osf/shared/models'; @@ -31,7 +31,7 @@ import { INPUT_VALIDATION_MESSAGES } from '@shared/constants'; export class PreprintsSubjectsComponent implements OnInit { preprintId = input(); - private readonly selectedProviderId = select(SubmitPreprintSelectors.getSelectedProviderId); + private readonly selectedProviderId = select(PreprintStepperSelectors.getSelectedProviderId); protected selectedSubjects = select(SubjectsSelectors.getSelectedSubjects); protected isSubjectsUpdating = select(SubjectsSelectors.areSelectedSubjectsLoading); control = input.required(); 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 f23af0f44..c623bc6f1 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 @@ -16,9 +16,9 @@ import { PreprintProviderDetails } from '@osf/features/preprints/models'; import { FetchLicenses, FetchPreprintProject, + PreprintStepperSelectors, SubmitPreprint, - SubmitPreprintSelectors, -} from '@osf/features/preprints/store/submit-preprint'; +} from '@osf/features/preprints/store/preprint-stepper'; import { TruncatedTextComponent } from '@shared/components'; import { ResourceType } from '@shared/enums'; import { Institution } from '@shared/models'; @@ -57,7 +57,7 @@ export class ReviewStepComponent implements OnInit { submitPreprint: SubmitPreprint, }); provider = input.required(); - createdPreprint = select(SubmitPreprintSelectors.getCreatedPreprint); + createdPreprint = select(PreprintStepperSelectors.getCreatedPreprint); contributors = select(ContributorsSelectors.getContributors); bibliographicContributors = computed(() => { @@ -65,8 +65,8 @@ export class ReviewStepComponent implements OnInit { }); subjects = select(SubjectsSelectors.getSelectedSubjects); affiliatedInstitutions = signal([]); - license = select(SubmitPreprintSelectors.getPreprintLicense); - preprintProject = select(SubmitPreprintSelectors.getPreprintProject); + license = select(PreprintStepperSelectors.getPreprintLicense); + preprintProject = select(PreprintStepperSelectors.getPreprintProject); licenseOptionsRecord = computed(() => { return (this.createdPreprint()?.licenseOptions ?? {}) as Record; }); diff --git a/src/app/features/preprints/components/stepper/supplements-step/supplements-step.component.ts b/src/app/features/preprints/components/stepper/supplements-step/supplements-step.component.ts index 2c99c4e33..2ab55edfc 100644 --- a/src/app/features/preprints/components/stepper/supplements-step/supplements-step.component.ts +++ b/src/app/features/preprints/components/stepper/supplements-step/supplements-step.component.ts @@ -31,10 +31,10 @@ import { ConnectProject, CreateNewProject, DisconnectProject, + FetchAvailableProjects, FetchPreprintProject, - GetAvailableProjects, - SubmitPreprintSelectors, -} from '@osf/features/preprints/store/submit-preprint'; + PreprintStepperSelectors, +} from '@osf/features/preprints/store/preprint-stepper'; import { AddProjectFormComponent } from '@shared/components'; import { ProjectFormControls } from '@shared/enums'; import { ProjectForm } from '@shared/models'; @@ -62,7 +62,7 @@ export class SupplementsStepComponent implements OnInit { private customConfirmationService = inject(CustomConfirmationService); private readonly toastService = inject(ToastService); private actions = createDispatchMap({ - getAvailableProjects: GetAvailableProjects, + getAvailableProjects: FetchAvailableProjects, connectProject: ConnectProject, disconnectProject: DisconnectProject, fetchPreprintProject: FetchPreprintProject, @@ -72,12 +72,12 @@ export class SupplementsStepComponent implements OnInit { readonly SupplementOptions = SupplementOptions; - createdPreprint = select(SubmitPreprintSelectors.getCreatedPreprint); - isPreprintSubmitting = select(SubmitPreprintSelectors.isPreprintSubmitting); - availableProjects = select(SubmitPreprintSelectors.getAvailableProjects); - areAvailableProjectsLoading = select(SubmitPreprintSelectors.areAvailableProjectsLoading); - preprintProject = select(SubmitPreprintSelectors.getPreprintProject); - isPreprintProjectLoading = select(SubmitPreprintSelectors.isPreprintProjectLoading); + createdPreprint = select(PreprintStepperSelectors.getCreatedPreprint); + isPreprintSubmitting = select(PreprintStepperSelectors.isPreprintSubmitting); + availableProjects = select(PreprintStepperSelectors.getAvailableProjects); + areAvailableProjectsLoading = select(PreprintStepperSelectors.areAvailableProjectsLoading); + preprintProject = select(PreprintStepperSelectors.getPreprintProject); + isPreprintProjectLoading = select(PreprintStepperSelectors.isPreprintProjectLoading); selectedSupplementOption = signal(SupplementOptions.None); selectedProjectId = signal(null); diff --git a/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.ts b/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.ts index 50282ef89..b36fae05a 100644 --- a/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.ts +++ b/src/app/features/preprints/components/stepper/title-and-abstract-step/title-and-abstract-step.component.ts @@ -14,7 +14,11 @@ import { RouterLink } from '@angular/router'; import { formInputLimits } from '@osf/features/preprints/constants'; import { TitleAndAbstractForm } from '@osf/features/preprints/models'; -import { CreatePreprint, SubmitPreprintSelectors, UpdatePreprint } from '@osf/features/preprints/store/submit-preprint'; +import { + CreatePreprint, + PreprintStepperSelectors, + UpdatePreprint, +} from '@osf/features/preprints/store/preprint-stepper'; import { TextInputComponent } from '@shared/components'; import { INPUT_VALIDATION_MESSAGES } from '@shared/constants'; import { ToastService } from '@shared/services'; @@ -64,10 +68,10 @@ export class TitleAndAbstractStepComponent { }), }); - createdPreprint = select(SubmitPreprintSelectors.getCreatedPreprint); - providerId = select(SubmitPreprintSelectors.getSelectedProviderId); + createdPreprint = select(PreprintStepperSelectors.getCreatedPreprint); + providerId = select(PreprintStepperSelectors.getSelectedProviderId); - isUpdatingPreprint = select(SubmitPreprintSelectors.isPreprintSubmitting); + isUpdatingPreprint = select(PreprintStepperSelectors.isPreprintSubmitting); nextClicked = output(); constructor() { diff --git a/src/app/features/preprints/pages/select-preprint-service/select-preprint-service.component.ts b/src/app/features/preprints/pages/select-preprint-service/select-preprint-service.component.ts index 453415ee4..ae3ea0719 100644 --- a/src/app/features/preprints/pages/select-preprint-service/select-preprint-service.component.ts +++ b/src/app/features/preprints/pages/select-preprint-service/select-preprint-service.component.ts @@ -16,7 +16,10 @@ import { GetPreprintProvidersAllowingSubmissions, PreprintProvidersSelectors, } from '@osf/features/preprints/store/preprint-providers'; -import { SetSelectedPreprintProviderId, SubmitPreprintSelectors } from '@osf/features/preprints/store/submit-preprint'; +import { + PreprintStepperSelectors, + SetSelectedPreprintProviderId, +} from '@osf/features/preprints/store/preprint-stepper'; import { SubHeaderComponent } from '@shared/components'; import { DecodeHtmlPipe } from '@shared/pipes'; @@ -37,7 +40,7 @@ export class SelectPreprintServiceComponent implements OnInit { preprintProvidersAllowingSubmissions = select(PreprintProvidersSelectors.getPreprintProvidersAllowingSubmissions); areProvidersLoading = select(PreprintProvidersSelectors.arePreprintProvidersAllowingSubmissionsLoading); - selectedProviderId = select(SubmitPreprintSelectors.getSelectedProviderId); + selectedProviderId = select(PreprintStepperSelectors.getSelectedProviderId); skeletonArray = Array.from({ length: 8 }, (_, i) => i + 1); ngOnInit(): void { diff --git a/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts b/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts index 53b3cffdf..fcb6d9db3 100644 --- a/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts +++ b/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts @@ -32,10 +32,11 @@ import { PreprintSteps } from '@osf/features/preprints/enums'; import { CanDeactivateComponent } from '@osf/features/preprints/models'; import { GetPreprintProviderById, PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; import { - ResetStateAndDeletePreprint, + DeletePreprint, + PreprintStepperSelectors, + ResetState, SetSelectedPreprintProviderId, - SubmitPreprintSelectors, -} from '@osf/features/preprints/store/submit-preprint'; +} from '@osf/features/preprints/store/preprint-stepper'; import { StepOption } from '@osf/shared/models'; import { StepperComponent } from '@shared/components'; import { BrandService } from '@shared/services'; @@ -68,14 +69,15 @@ export class SubmitPreprintStepperComponent implements OnInit, OnDestroy, CanDea private actions = createDispatchMap({ getPreprintProviderById: GetPreprintProviderById, setSelectedPreprintProviderId: SetSelectedPreprintProviderId, - resetStateAndDeletePreprint: ResetStateAndDeletePreprint, + resetState: ResetState, + deletePreprint: DeletePreprint, }); readonly SubmitStepsEnum = PreprintSteps; preprintProvider = select(PreprintProvidersSelectors.getPreprintProviderDetails(this.providerId())); isPreprintProviderLoading = select(PreprintProvidersSelectors.isPreprintProviderDetailsLoading); - hasBeenSubmitted = select(SubmitPreprintSelectors.hasBeenSubmitted); + hasBeenSubmitted = select(PreprintStepperSelectors.hasBeenSubmitted); currentStep = signal(submitPreprintSteps[0]); isWeb = toSignal(inject(IS_WEB)); @@ -130,7 +132,8 @@ export class SubmitPreprintStepperComponent implements OnInit, OnDestroy, CanDea HeaderStyleHelper.resetToDefaults(); BrandService.resetBranding(); BrowserTabHelper.resetToDefaults(); - this.actions.resetStateAndDeletePreprint(); + this.actions.deletePreprint(); + this.actions.resetState(); } stepChange(step: StepOption): void { diff --git a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts index dcff098cf..453502b9a 100644 --- a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts +++ b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts @@ -32,10 +32,10 @@ import { CanDeactivateComponent } from '@osf/features/preprints/models'; import { GetPreprintProviderById, PreprintProvidersSelectors } from '@osf/features/preprints/store/preprint-providers'; import { FetchPreprintById, - ResetStateAndDeletePreprint, + PreprintStepperSelectors, + ResetState, SetSelectedPreprintProviderId, - SubmitPreprintSelectors, -} from '@osf/features/preprints/store/submit-preprint'; +} from '@osf/features/preprints/store/preprint-stepper'; import { StepperComponent } from '@shared/components'; import { StepOption } from '@shared/models'; import { BrandService } from '@shared/services'; @@ -67,7 +67,7 @@ export class UpdatePreprintStepperComponent implements OnInit, OnDestroy, CanDea private actions = createDispatchMap({ getPreprintProviderById: GetPreprintProviderById, setSelectedPreprintProviderId: SetSelectedPreprintProviderId, - resetStateAndDeletePreprint: ResetStateAndDeletePreprint, + resetState: ResetState, fetchPreprint: FetchPreprintById, }); @@ -95,7 +95,7 @@ export class UpdatePreprintStepperComponent implements OnInit, OnDestroy, CanDea preprintProvider = select(PreprintProvidersSelectors.getPreprintProviderDetails(this.providerId())); isPreprintProviderLoading = select(PreprintProvidersSelectors.isPreprintProviderDetailsLoading); - hasBeenSubmitted = select(SubmitPreprintSelectors.hasBeenSubmitted); + hasBeenSubmitted = select(PreprintStepperSelectors.hasBeenSubmitted); currentStep = signal(updatePreprintSteps[4]); isWeb = toSignal(inject(IS_WEB)); @@ -131,7 +131,7 @@ export class UpdatePreprintStepperComponent implements OnInit, OnDestroy, CanDea HeaderStyleHelper.resetToDefaults(); BrandService.resetBranding(); BrowserTabHelper.resetToDefaults(); - this.actions.resetStateAndDeletePreprint(); + this.actions.resetState(); } stepChange(step: StepOption): void { diff --git a/src/app/features/preprints/preprints.routes.ts b/src/app/features/preprints/preprints.routes.ts index 4d6788868..28bd9610d 100644 --- a/src/app/features/preprints/preprints.routes.ts +++ b/src/app/features/preprints/preprints.routes.ts @@ -5,10 +5,10 @@ import { Routes } from '@angular/router'; import { ConfirmLeavingGuard } from '@osf/features/preprints/guards'; import { PreprintsComponent } from '@osf/features/preprints/preprints.component'; import { PreprintProvidersState } from '@osf/features/preprints/store/preprint-providers'; +import { PreprintStepperState } from '@osf/features/preprints/store/preprint-stepper'; import { PreprintsDiscoverState } from '@osf/features/preprints/store/preprints-discover'; import { PreprintsResourcesFiltersState } from '@osf/features/preprints/store/preprints-resources-filters'; import { PreprintsResourcesFiltersOptionsState } from '@osf/features/preprints/store/preprints-resources-filters-options'; -import { SubmitPreprintState } from '@osf/features/preprints/store/submit-preprint'; import { ContributorsState, SubjectsState } from '@shared/stores'; export const preprintsRoutes: Routes = [ @@ -21,7 +21,7 @@ export const preprintsRoutes: Routes = [ PreprintsDiscoverState, PreprintsResourcesFiltersState, PreprintsResourcesFiltersOptionsState, - SubmitPreprintState, + PreprintStepperState, ContributorsState, SubjectsState, ]), diff --git a/src/app/features/preprints/store/preprint-stepper/index.ts b/src/app/features/preprints/store/preprint-stepper/index.ts new file mode 100644 index 000000000..389d4c606 --- /dev/null +++ b/src/app/features/preprints/store/preprint-stepper/index.ts @@ -0,0 +1,4 @@ +export * from './preprint-stepper.actions'; +export * from './preprint-stepper.model'; +export * from './preprint-stepper.selectors'; +export * from './preprint-stepper.state'; diff --git a/src/app/features/preprints/store/submit-preprint/submit-preprint.actions.ts b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.actions.ts similarity index 89% rename from src/app/features/preprints/store/submit-preprint/submit-preprint.actions.ts rename to src/app/features/preprints/store/preprint-stepper/preprint-stepper.actions.ts index 514bb299f..1f8a2f92a 100644 --- a/src/app/features/preprints/store/submit-preprint/submit-preprint.actions.ts +++ b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.actions.ts @@ -40,7 +40,7 @@ export class SetSelectedPreprintFileSource { constructor(public fileSource: PreprintFileSource) {} } -export class GetPreprintFilesLinks { +export class FetchPreprintFilesLinks { static readonly type = '[Submit Preprint] Get Preprint Files Links'; } @@ -62,23 +62,23 @@ export class CopyFileFromProject { constructor(public file: OsfFile) {} } -export class GetPreprintFiles { +export class FetchPreprintFiles { static readonly type = '[Submit Preprint] Get Preprint Files'; } -export class GetAvailableProjects { +export class FetchAvailableProjects { static readonly type = '[Submit Preprint] Get Available Projects'; constructor(public searchTerm: StringOrNull) {} } -export class GetProjectFiles { +export class FetchProjectFiles { static readonly type = '[Submit Preprint] Get Project Files'; constructor(public projectId: string) {} } -export class GetProjectFilesByLink { +export class FetchProjectFilesByLink { static readonly type = '[Submit Preprint] Get Project Files By Link'; constructor(public filesLink: string) {} @@ -127,6 +127,10 @@ export class SubmitPreprint { static readonly type = '[Submit Preprint] Submit Preprint'; } -export class ResetStateAndDeletePreprint { - static readonly type = '[Submit Preprint] Reset State And Delete Preprint'; +export class ResetState { + static readonly type = '[Submit Preprint] Reset State'; +} + +export class DeletePreprint { + static readonly type = '[Submit Preprint] Delete Preprint'; } diff --git a/src/app/features/preprints/store/submit-preprint/submit-preprint.model.ts b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.model.ts similarity index 94% rename from src/app/features/preprints/store/submit-preprint/submit-preprint.model.ts rename to src/app/features/preprints/store/preprint-stepper/preprint-stepper.model.ts index c52ab68f3..dd1cf8b2a 100644 --- a/src/app/features/preprints/store/submit-preprint/submit-preprint.model.ts +++ b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.model.ts @@ -4,7 +4,7 @@ import { Preprint, PreprintFilesLinks } from '@osf/features/preprints/models'; import { AsyncStateModel, IdName, OsfFile } from '@shared/models'; import { License } from '@shared/models/license.model'; -export interface SubmitPreprintStateModel { +export interface PreprintStepperStateModel { selectedProviderId: StringOrNull; createdPreprint: AsyncStateModel; fileSource: PreprintFileSource; diff --git a/src/app/features/preprints/store/preprint-stepper/preprint-stepper.selectors.ts b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.selectors.ts new file mode 100644 index 000000000..8369c36a1 --- /dev/null +++ b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.selectors.ts @@ -0,0 +1,85 @@ +import { Selector } from '@ngxs/store'; + +import { PreprintStepperState, PreprintStepperStateModel } from '@osf/features/preprints/store/preprint-stepper'; + +export class PreprintStepperSelectors { + @Selector([PreprintStepperState]) + static getSelectedProviderId(state: PreprintStepperStateModel) { + return state.selectedProviderId; + } + + @Selector([PreprintStepperState]) + static getCreatedPreprint(state: PreprintStepperStateModel) { + return state.createdPreprint.data; + } + + @Selector([PreprintStepperState]) + static isPreprintSubmitting(state: PreprintStepperStateModel) { + return state.createdPreprint.isSubmitting; + } + + @Selector([PreprintStepperState]) + static getSelectedFileSource(state: PreprintStepperStateModel) { + return state.fileSource; + } + + @Selector([PreprintStepperState]) + static getUploadLink(state: PreprintStepperStateModel) { + return state.preprintFilesLinks.data?.uploadFileLink; + } + + @Selector([PreprintStepperState]) + static getPreprintFiles(state: PreprintStepperStateModel) { + return state.preprintFiles.data; + } + + @Selector([PreprintStepperState]) + static arePreprintFilesLoading(state: PreprintStepperStateModel) { + return state.preprintFiles.isLoading; + } + + @Selector([PreprintStepperState]) + static getAvailableProjects(state: PreprintStepperStateModel) { + return state.availableProjects.data; + } + + @Selector([PreprintStepperState]) + static areAvailableProjectsLoading(state: PreprintStepperStateModel) { + return state.availableProjects.isLoading; + } + + @Selector([PreprintStepperState]) + static getProjectFiles(state: PreprintStepperStateModel) { + return state.projectFiles.data; + } + + @Selector([PreprintStepperState]) + static areProjectFilesLoading(state: PreprintStepperStateModel) { + return state.projectFiles.isLoading; + } + + @Selector([PreprintStepperState]) + static getLicenses(state: PreprintStepperStateModel) { + return state.licenses.data; + } + + @Selector([PreprintStepperState]) + static getPreprintLicense(state: PreprintStepperStateModel) { + return state.licenses.data.find((l) => l.id === state.createdPreprint.data?.licenseId) || null; + } + + @Selector([PreprintStepperState]) + static getPreprintProject(state: PreprintStepperStateModel) { + return state.preprintProject.data; + } + + @Selector([PreprintStepperState]) + static isPreprintProjectLoading(state: PreprintStepperStateModel) { + return state.preprintProject.isLoading; + } + + @Selector([PreprintStepperState]) + static hasBeenSubmitted(state: PreprintStepperStateModel) { + return state.hasBeenSubmitted; + } +} diff --git a/src/app/features/preprints/store/submit-preprint/submit-preprint.state.ts b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts similarity index 84% rename from src/app/features/preprints/store/submit-preprint/submit-preprint.state.ts rename to src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts index 7d34f9f45..ba7e256cd 100644 --- a/src/app/features/preprints/store/submit-preprint/submit-preprint.state.ts +++ b/src/app/features/preprints/store/preprint-stepper/preprint-stepper.state.ts @@ -24,27 +24,28 @@ import { CopyFileFromProject, CreateNewProject, CreatePreprint, + DeletePreprint, DisconnectProject, + FetchAvailableProjects, FetchLicenses, FetchPreprintById, + FetchPreprintFiles, + FetchPreprintFilesLinks, FetchPreprintProject, - GetAvailableProjects, - GetPreprintFiles, - GetPreprintFilesLinks, - GetProjectFiles, - GetProjectFilesByLink, - ResetStateAndDeletePreprint, + FetchProjectFiles, + FetchProjectFilesByLink, + PreprintStepperStateModel, + ResetState, ReuploadFile, SaveLicense, SetSelectedPreprintFileSource, SetSelectedPreprintProviderId, SubmitPreprint, - SubmitPreprintStateModel, UpdatePreprint, UploadFile, } from './'; -const DefaultState: SubmitPreprintStateModel = { +const DefaultState: PreprintStepperStateModel = { selectedProviderId: null, createdPreprint: { data: null, @@ -86,12 +87,12 @@ const DefaultState: SubmitPreprintStateModel = { hasBeenSubmitted: false, }; -@State({ - name: 'submitPreprint', +@State({ + name: 'preprintStepper', defaults: { ...DefaultState }, }) @Injectable() -export class SubmitPreprintState { +export class PreprintStepperState { private preprintsService = inject(PreprintsService); private preprintFilesService = inject(PreprintFilesService); private fileService = inject(FilesService); @@ -99,14 +100,14 @@ export class SubmitPreprintState { private preprintProjectsService = inject(PreprintsProjectsService); @Action(SetSelectedPreprintProviderId) - setSelectedPreprintProviderId(ctx: StateContext, action: SetSelectedPreprintProviderId) { + setSelectedPreprintProviderId(ctx: StateContext, action: SetSelectedPreprintProviderId) { ctx.patchState({ selectedProviderId: action.id, }); } @Action(CreatePreprint) - createPreprint(ctx: StateContext, action: CreatePreprint) { + createPreprint(ctx: StateContext, action: CreatePreprint) { ctx.setState(patch({ createdPreprint: patch({ isSubmitting: true }) })); return this.preprintsService.createPreprint(action.title, action.abstract, action.providerId).pipe( @@ -118,7 +119,7 @@ export class SubmitPreprintState { } @Action(UpdatePreprint) - updatePreprint(ctx: StateContext, action: UpdatePreprint) { + updatePreprint(ctx: StateContext, action: UpdatePreprint) { ctx.setState(patch({ createdPreprint: patch({ isSubmitting: true }) })); return this.preprintsService.updatePreprint(action.id, action.payload).pipe( @@ -130,7 +131,7 @@ export class SubmitPreprintState { } @Action(FetchPreprintById) - getPreprintById(ctx: StateContext, action: FetchPreprintById) { + getPreprintById(ctx: StateContext, action: FetchPreprintById) { ctx.setState(patch({ createdPreprint: patch({ isLoading: true }) })); return this.preprintsService.getById(action.id).pipe( @@ -141,8 +142,8 @@ export class SubmitPreprintState { ); } - @Action(GetPreprintFilesLinks) - getPreprintFilesLinks(ctx: StateContext) { + @Action(FetchPreprintFilesLinks) + getPreprintFilesLinks(ctx: StateContext) { const state = ctx.getState(); if (!state.createdPreprint.data) { return EMPTY; @@ -157,7 +158,7 @@ export class SubmitPreprintState { } @Action(UploadFile) - uploadFile(ctx: StateContext, action: UploadFile) { + uploadFile(ctx: StateContext, action: UploadFile) { const state = ctx.getState(); if (!state.preprintFilesLinks.data?.uploadFileLink) { return EMPTY; @@ -170,7 +171,7 @@ export class SubmitPreprintState { switchMap((event) => { const file = event.body!.data; const createdFileId = file.id.split('/')[1]; - ctx.dispatch(new GetPreprintFiles()); + ctx.dispatch(new FetchPreprintFiles()); return this.preprintFilesService.updateFileRelationship(state.createdPreprint.data!.id, createdFileId).pipe( tap((preprint: Preprint) => { @@ -191,7 +192,7 @@ export class SubmitPreprintState { } @Action(ReuploadFile) - reuploadFile(ctx: StateContext, action: ReuploadFile) { + reuploadFile(ctx: StateContext, action: ReuploadFile) { const state = ctx.getState(); const uploadedFile = state.preprintFiles.data[0]; if (!uploadedFile) return EMPTY; @@ -201,13 +202,13 @@ export class SubmitPreprintState { return this.fileService.updateFileContent(action.file, uploadedFile.links.upload).pipe( switchMap(() => this.fileService.renameEntry(uploadedFile.links.upload, action.file.name, 'replace')), tap(() => { - ctx.dispatch(GetPreprintFiles); + ctx.dispatch(FetchPreprintFiles); }) ); } - @Action(GetPreprintFiles) - getPreprintFiles(ctx: StateContext) { + @Action(FetchPreprintFiles) + getPreprintFiles(ctx: StateContext) { const state = ctx.getState(); if (!state.preprintFilesLinks.data?.filesLink) { return EMPTY; @@ -229,8 +230,8 @@ export class SubmitPreprintState { ); } - @Action(GetAvailableProjects) - getAvailableProjects(ctx: StateContext, action: GetAvailableProjects) { + @Action(FetchAvailableProjects) + getAvailableProjects(ctx: StateContext, action: FetchAvailableProjects) { ctx.setState(patch({ availableProjects: patch({ isLoading: true }) })); return this.preprintProjectsService.getAvailableProjects(action.searchTerm).pipe( @@ -248,8 +249,8 @@ export class SubmitPreprintState { ); } - @Action(GetProjectFiles) - getProjectFiles(ctx: StateContext, action: GetProjectFiles) { + @Action(FetchProjectFiles) + getProjectFiles(ctx: StateContext, action: FetchProjectFiles) { ctx.setState(patch({ projectFiles: patch({ isLoading: true }) })); return this.preprintFilesService.getProjectFiles(action.projectId).pipe( @@ -276,8 +277,8 @@ export class SubmitPreprintState { ); } - @Action(GetProjectFilesByLink) - getProjectFilesByLink(ctx: StateContext, action: GetProjectFilesByLink) { + @Action(FetchProjectFilesByLink) + getProjectFilesByLink(ctx: StateContext, action: FetchProjectFilesByLink) { ctx.setState(patch({ projectFiles: patch({ isLoading: true }) })); return this.fileService.getFilesWithoutFiltering(action.filesLink).pipe( @@ -295,27 +296,15 @@ export class SubmitPreprintState { ); } - @Action(ResetStateAndDeletePreprint) - resetStateAndDeletePreprint(ctx: StateContext) { - const state = ctx.getState(); - const createdPreprintId = state.createdPreprint.data?.id; - ctx.setState({ ...DefaultState }); - if (createdPreprintId && !state.hasBeenSubmitted) { - return this.preprintsService.deletePreprint(createdPreprintId); - } - - return EMPTY; - } - @Action(SetSelectedPreprintFileSource) - setSelectedPreprintFileSource(ctx: StateContext, action: SetSelectedPreprintFileSource) { + setSelectedPreprintFileSource(ctx: StateContext, action: SetSelectedPreprintFileSource) { ctx.patchState({ fileSource: action.fileSource, }); } @Action(CopyFileFromProject) - copyFileFromProject(ctx: StateContext, action: CopyFileFromProject) { + copyFileFromProject(ctx: StateContext, action: CopyFileFromProject) { const createdPreprintId = ctx.getState().createdPreprint.data?.id; if (!createdPreprintId) { return; @@ -326,7 +315,7 @@ export class SubmitPreprintState { .copyFileToAnotherLocation(action.file.links.move, action.file.provider, createdPreprintId) .pipe( switchMap((file: OsfFile) => { - ctx.dispatch(new GetPreprintFiles()); + ctx.dispatch(new FetchPreprintFiles()); const fileIdAfterCopy = file.id.split('/')[1]; @@ -350,7 +339,7 @@ export class SubmitPreprintState { } @Action(FetchLicenses) - fetchLicenses(ctx: StateContext) { + fetchLicenses(ctx: StateContext) { const providerId = ctx.getState().selectedProviderId; if (!providerId) return; ctx.setState(patch({ licenses: patch({ isLoading: true }) })); @@ -364,7 +353,7 @@ export class SubmitPreprintState { } @Action(SaveLicense) - saveLicense(ctx: StateContext, action: SaveLicense) { + saveLicense(ctx: StateContext, action: SaveLicense) { const createdPreprintId = ctx.getState().createdPreprint.data!.id; ctx.setState(patch({ createdPreprint: patch({ isSubmitting: true }) })); @@ -377,7 +366,7 @@ export class SubmitPreprintState { } @Action(DisconnectProject) - disconnectProject(ctx: StateContext) { + disconnectProject(ctx: StateContext) { const createdPreprintId = ctx.getState().createdPreprint.data?.id; if (!createdPreprintId) return EMPTY; @@ -406,7 +395,7 @@ export class SubmitPreprintState { } @Action(ConnectProject) - connectProject(ctx: StateContext, { projectId }: ConnectProject) { + connectProject(ctx: StateContext, { projectId }: ConnectProject) { const createdPreprintId = ctx.getState().createdPreprint.data?.id; if (!createdPreprintId) return EMPTY; @@ -428,7 +417,7 @@ export class SubmitPreprintState { } @Action(FetchPreprintProject) - fetchPreprintProject(ctx: StateContext) { + fetchPreprintProject(ctx: StateContext) { const preprintProjectId = ctx.getState().createdPreprint.data?.nodeId; if (!preprintProjectId) return EMPTY; @@ -449,7 +438,7 @@ export class SubmitPreprintState { } @Action(CreateNewProject) - createNewProject(ctx: StateContext, action: CreateNewProject) { + createNewProject(ctx: StateContext, action: CreateNewProject) { const createdPreprintId = ctx.getState().createdPreprint.data!.id; ctx.setState(patch({ createdPreprint: patch({ isSubmitting: true }) })); ctx.setState(patch({ preprintProject: patch({ isLoading: true }) })); @@ -485,7 +474,7 @@ export class SubmitPreprintState { } @Action(SubmitPreprint) - submitPreprint(ctx: StateContext) { + submitPreprint(ctx: StateContext) { const createdPreprintId = ctx.getState().createdPreprint.data!.id; ctx.setState(patch({ createdPreprint: patch({ isSubmitting: true }) })); return this.preprintsService.submitPreprint(createdPreprintId).pipe( @@ -496,9 +485,25 @@ export class SubmitPreprintState { ); } + @Action(ResetState) + resetState(ctx: StateContext) { + ctx.setState({ ...DefaultState }); + return EMPTY; + } + + @Action(DeletePreprint) + deletePreprint(ctx: StateContext) { + const state = ctx.getState(); + const createdPreprintId = state.createdPreprint.data?.id; + if (createdPreprintId && !state.hasBeenSubmitted) { + return this.preprintsService.deletePreprint(createdPreprintId); + } + return EMPTY; + } + private handleError( - ctx: StateContext, - section: keyof SubmitPreprintStateModel, + ctx: StateContext, + section: keyof PreprintStepperStateModel, error: Error ) { ctx.patchState({ diff --git a/src/app/features/preprints/store/submit-preprint/index.ts b/src/app/features/preprints/store/submit-preprint/index.ts deleted file mode 100644 index cdae9c5e8..000000000 --- a/src/app/features/preprints/store/submit-preprint/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './submit-preprint.actions'; -export * from './submit-preprint.model'; -export * from './submit-preprint.selectors'; -export * from './submit-preprint.state'; diff --git a/src/app/features/preprints/store/submit-preprint/submit-preprint.selectors.ts b/src/app/features/preprints/store/submit-preprint/submit-preprint.selectors.ts deleted file mode 100644 index 585b6bbdf..000000000 --- a/src/app/features/preprints/store/submit-preprint/submit-preprint.selectors.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { Selector } from '@ngxs/store'; - -import { SubmitPreprintState, SubmitPreprintStateModel } from '@osf/features/preprints/store/submit-preprint'; - -export class SubmitPreprintSelectors { - @Selector([SubmitPreprintState]) - static getSelectedProviderId(state: SubmitPreprintStateModel) { - return state.selectedProviderId; - } - - @Selector([SubmitPreprintState]) - static getCreatedPreprint(state: SubmitPreprintStateModel) { - return state.createdPreprint.data; - } - - @Selector([SubmitPreprintState]) - static isPreprintSubmitting(state: SubmitPreprintStateModel) { - return state.createdPreprint.isSubmitting; - } - - @Selector([SubmitPreprintState]) - static getSelectedFileSource(state: SubmitPreprintStateModel) { - return state.fileSource; - } - - @Selector([SubmitPreprintState]) - static getUploadLink(state: SubmitPreprintStateModel) { - return state.preprintFilesLinks.data?.uploadFileLink; - } - - @Selector([SubmitPreprintState]) - static getPreprintFiles(state: SubmitPreprintStateModel) { - return state.preprintFiles.data; - } - - @Selector([SubmitPreprintState]) - static arePreprintFilesLoading(state: SubmitPreprintStateModel) { - return state.preprintFiles.isLoading; - } - - @Selector([SubmitPreprintState]) - static getAvailableProjects(state: SubmitPreprintStateModel) { - return state.availableProjects.data; - } - - @Selector([SubmitPreprintState]) - static areAvailableProjectsLoading(state: SubmitPreprintStateModel) { - return state.availableProjects.isLoading; - } - - @Selector([SubmitPreprintState]) - static getProjectFiles(state: SubmitPreprintStateModel) { - return state.projectFiles.data; - } - - @Selector([SubmitPreprintState]) - static areProjectFilesLoading(state: SubmitPreprintStateModel) { - return state.projectFiles.isLoading; - } - - @Selector([SubmitPreprintState]) - static getLicenses(state: SubmitPreprintStateModel) { - return state.licenses.data; - } - - @Selector([SubmitPreprintState]) - static getPreprintLicense(state: SubmitPreprintStateModel) { - return state.licenses.data.find((l) => l.id === state.createdPreprint.data?.licenseId) || null; - } - - @Selector([SubmitPreprintState]) - static getPreprintProject(state: SubmitPreprintStateModel) { - return state.preprintProject.data; - } - - @Selector([SubmitPreprintState]) - static isPreprintProjectLoading(state: SubmitPreprintStateModel) { - return state.preprintProject.isLoading; - } - - @Selector([SubmitPreprintState]) - static hasBeenSubmitted(state: SubmitPreprintStateModel) { - return state.hasBeenSubmitted; - } -} From 99cc0248a6d81bd117962206e70754b412b3388d Mon Sep 17 00:00:00 2001 From: Roma Date: Fri, 11 Jul 2025 12:23:05 +0300 Subject: [PATCH 5/5] fix(preprints): Using strings from en.json --- .../submit-preprint-stepper.component.html | 4 +++- .../submit-preprint-stepper.component.ts | 3 +++ .../update-preprint-stepper.component.html | 4 +++- .../update-preprint-stepper.component.ts | 3 +++ src/assets/i18n/en.json | 1 + 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.html b/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.html index cef8986c5..a970fb38c 100644 --- a/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.html +++ b/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.html @@ -10,7 +10,9 @@ height="40" [src]="preprintProvider()!.brand.heroLogoImageUrl" /> -

{{ 'Add a ' + preprintProvider()!.preprintWord }}

+

+ {{ 'preprints.addPreprint' | translate: { preprintWord: preprintProvider()!.preprintWord } }} +

}
diff --git a/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts b/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts index fcb6d9db3..d100941c5 100644 --- a/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts +++ b/src/app/features/preprints/pages/submit-preprint-stepper/submit-preprint-stepper.component.ts @@ -1,5 +1,7 @@ import { createDispatchMap, select } from '@ngxs/store'; +import { TranslatePipe } from '@ngx-translate/core'; + import { Skeleton } from 'primeng/skeleton'; import { map, Observable, of } from 'rxjs'; @@ -54,6 +56,7 @@ import { BrowserTabHelper, HeaderStyleHelper, IS_WEB } from '@shared/utils'; SupplementsStepComponent, AuthorAssertionsStepComponent, ReviewStepComponent, + TranslatePipe, ], templateUrl: './submit-preprint-stepper.component.html', styleUrl: './submit-preprint-stepper.component.scss', diff --git a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.html b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.html index 7ed6b07c2..093754596 100644 --- a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.html +++ b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.html @@ -10,7 +10,9 @@ height="40" [src]="preprintProvider()!.brand.heroLogoImageUrl" /> -

{{ 'Edit ' + preprintProvider()!.preprintWord }}

+

+ {{ 'preprints.updatePreprint' | translate: { preprintWord: preprintProvider()!.preprintWord } }} +

}
diff --git a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts index 453502b9a..377d4e285 100644 --- a/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts +++ b/src/app/features/preprints/pages/update-preprint-stepper/update-preprint-stepper.component.ts @@ -1,5 +1,7 @@ import { createDispatchMap, select } from '@ngxs/store'; +import { TranslatePipe } from '@ngx-translate/core'; + import { Skeleton } from 'primeng/skeleton'; import { map, Observable, of } from 'rxjs'; @@ -51,6 +53,7 @@ import { BrowserTabHelper, HeaderStyleHelper, IS_WEB } from '@shared/utils'; MetadataStepComponent, SupplementsStepComponent, ReviewStepComponent, + TranslatePipe, ], templateUrl: './update-preprint-stepper.component.html', styleUrl: './update-preprint-stepper.component.scss', diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 76143ca1d..24377d869 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1581,6 +1581,7 @@ "preprints": { "title": "Preprints", "addPreprint": "Add a {{preprintWord}}", + "updatePreprint": "Edit a {{preprintWord}}", "poweredBy": "Powered by OSF Preprints", "searchPlaceholder": "Search {{preprintWord}}...", "showExample": "Show an example",