Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class AuthorAssertionsStepComponent {
readonly preregLinkOptions = preregLinksOptions;
readonly linkValidators = [CustomValidators.linkValidator(), CustomValidators.requiredTrimmed()];

createdPreprint = select(PreprintStepperSelectors.getCreatedPreprint);
createdPreprint = select(PreprintStepperSelectors.getPreprint);
isUpdatingPreprint = select(PreprintStepperSelectors.isPreprintSubmitting);

readonly authorAssertionsForm = new FormGroup({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,6 @@ <h2>{{ 'preprints.preprintStepper.file.title' | translate }}</h2>
styleClass="w-full"
[label]="'common.buttons.next' | translate"
(click)="nextButtonClicked()"
[disabled]="!createdPreprint()?.primaryFileId || versionFileMode()"
[disabled]="!preprint()?.primaryFileId || versionFileMode()"
/>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class FileStepComponent implements OnInit {
readonly PreprintFileSource = PreprintFileSource;

provider = input.required<PreprintProviderDetails | undefined>();
createdPreprint = select(PreprintStepperSelectors.getCreatedPreprint);
preprint = select(PreprintStepperSelectors.getPreprint);
providerId = select(PreprintStepperSelectors.getSelectedProviderId);
selectedFileSource = select(PreprintStepperSelectors.getSelectedFileSource);
fileUploadLink = select(PreprintStepperSelectors.getUploadLink);
Expand Down Expand Up @@ -145,7 +145,7 @@ export class FileStepComponent implements OnInit {
}

nextButtonClicked() {
if (!this.createdPreprint()?.primaryFileId) {
if (!this.preprint()?.primaryFileId) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class MetadataStepComponent implements OnInit {
protected today = new Date();

licenses = select(PreprintStepperSelectors.getLicenses);
createdPreprint = select(PreprintStepperSelectors.getCreatedPreprint);
createdPreprint = select(PreprintStepperSelectors.getPreprint);
isUpdatingPreprint = select(PreprintStepperSelectors.isPreprintSubmitting);

nextClicked = output<void>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ <h3>

<section class="flex flex-column gap-2">
<h3>{{ 'preprints.preprintStepper.common.labels.title' | translate }}</h3>
<p>{{ createdPreprint()!.title }}</p>
<p>{{ preprint()!.title }}</p>
</section>

<section class="flex flex-column gap-2">
<h3>{{ 'preprints.preprintStepper.common.labels.abstract' | translate }}</h3>
<osf-truncated-text [maxVisibleLines]="2" [text]="createdPreprint()!.description" />
<osf-truncated-text [maxVisibleLines]="2" [text]="preprint()!.description" />
</section>
</div>
</p-card>
Expand Down Expand Up @@ -92,8 +92,8 @@ <h3>{{ 'preprints.preprintStepper.review.sections.metadata.license' | translate
<section class="flex flex-column gap-2">
<h3>{{ 'preprints.preprintStepper.review.sections.metadata.publicationDoi' | translate }}</h3>

<a [href]="'https://doi.org/' + createdPreprint()?.doi">
{{ 'https://doi.org/' + createdPreprint()?.doi }}
<a [href]="'https://doi.org/' + preprint()?.doi">
{{ 'https://doi.org/' + preprint()?.doi }}
</a>
</section>

Expand All @@ -111,7 +111,7 @@ <h3>{{ 'preprints.preprintStepper.review.sections.metadata.subjects' | translate
<h3>{{ 'preprints.preprintStepper.review.sections.metadata.tags' | translate }}</h3>

<div class="flex flex-wrap gap-2">
@for (tag of createdPreprint()?.tags; track tag) {
@for (tag of preprint()?.tags; track tag) {
<p-tag [value]="tag" severity="info" />
} @empty {
<p>{{ 'common.labels.none' | translate }}</p>
Expand All @@ -122,8 +122,8 @@ <h3>{{ 'preprints.preprintStepper.review.sections.metadata.tags' | translate }}<
<section class="flex flex-column gap-2">
<h3>{{ 'preprints.preprintStepper.review.sections.metadata.publicationDate' | translate }}</h3>

@if (createdPreprint()?.originalPublicationDate) {
{{ createdPreprint()?.originalPublicationDate | date: 'MMM d, y, h:mm a' }}
@if (preprint()?.originalPublicationDate) {
{{ preprint()?.originalPublicationDate | date: 'MMM d, y, h:mm a' }}
} @else {
<p>{{ 'common.labels.notApplicable' | translate }}</p>
}
Expand All @@ -132,8 +132,8 @@ <h3>{{ 'preprints.preprintStepper.review.sections.metadata.publicationDate' | tr
<section class="flex flex-column gap-2">
<h3>{{ 'preprints.preprintStepper.review.sections.metadata.publicationCitation' | translate }}</h3>

@if (createdPreprint()?.customPublicationCitation) {
{{ createdPreprint()?.customPublicationCitation }}
@if (preprint()?.customPublicationCitation) {
{{ preprint()?.customPublicationCitation }}
} @else {
<p>{{ 'common.labels.notApplicable' | translate }}</p>
}
Expand All @@ -149,25 +149,25 @@ <h2>{{ 'preprints.preprintStepper.review.sections.authorAssertions.title' | tran
<section class="flex flex-column gap-2">
<h3>{{ 'preprints.preprintStepper.review.sections.authorAssertions.conflictOfInterest' | translate }}</h3>

@if (!createdPreprint()?.hasCoi) {
@if (!preprint()?.hasCoi) {
<p>{{ 'preprints.preprintStepper.review.sections.authorAssertions.noCoi' | translate }}</p>
} @else {
{{ createdPreprint()?.coiStatement }}
{{ preprint()?.coiStatement }}
}
</section>

<section class="flex flex-column gap-2">
<h3>{{ 'preprints.preprintStepper.review.sections.authorAssertions.publicData' | translate }}</h3>

@switch (createdPreprint()?.hasDataLinks) {
@switch (preprint()?.hasDataLinks) {
@case (ApplicabilityStatus.NotApplicable) {
<p>{{ 'preprints.preprintStepper.review.sections.authorAssertions.noData' | translate }}</p>
}
@case (ApplicabilityStatus.Unavailable) {
{{ createdPreprint()?.whyNoData }}
{{ preprint()?.whyNoData }}
}
@case (ApplicabilityStatus.Applicable) {
@for (link of createdPreprint()?.dataLinks; track $index) {
@for (link of preprint()?.dataLinks; track $index) {
<p>{{ link }}</p>
}
}
Expand All @@ -179,17 +179,17 @@ <h3>
{{ 'preprints.preprintStepper.review.sections.authorAssertions.publicPreregistration' | translate }}
</h3>

@switch (createdPreprint()?.hasPreregLinks) {
@switch (preprint()?.hasPreregLinks) {
@case (ApplicabilityStatus.NotApplicable) {
<p>
{{ 'preprints.preprintStepper.review.sections.authorAssertions.noPrereg' | translate }}
</p>
}
@case (ApplicabilityStatus.Unavailable) {
{{ createdPreprint()?.whyNoPrereg }}
{{ preprint()?.whyNoPrereg }}
}
@case (ApplicabilityStatus.Applicable) {
@switch (createdPreprint()?.preregLinkInfo) {
@switch (preprint()?.preregLinkInfo) {
@case (PreregLinkInfo.Analysis) {
<p>
{{ 'preprints.preprintStepper.common.labels.preregTypes.analysis' | translate }}
Expand All @@ -206,7 +206,7 @@ <h3>
</p>
}
}
@for (link of createdPreprint()?.preregLinks; track $index) {
@for (link of preprint()?.preregLinks; track $index) {
<p>{{ link }}</p>
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class ReviewStepComponent implements OnInit {
submitPreprint: SubmitPreprint,
});
provider = input.required<PreprintProviderDetails | undefined>();
createdPreprint = select(PreprintStepperSelectors.getCreatedPreprint);
preprint = select(PreprintStepperSelectors.getPreprint);

contributors = select(ContributorsSelectors.getContributors);
bibliographicContributors = computed(() => {
Expand All @@ -68,15 +68,15 @@ export class ReviewStepComponent implements OnInit {
license = select(PreprintStepperSelectors.getPreprintLicense);
preprintProject = select(PreprintStepperSelectors.getPreprintProject);
licenseOptionsRecord = computed(() => {
return (this.createdPreprint()?.licenseOptions ?? {}) as Record<string, string>;
return (this.preprint()?.licenseOptions ?? {}) as Record<string, string>;
});

readonly ApplicabilityStatus = ApplicabilityStatus;
readonly PreregLinkInfo = PreregLinkInfo;

ngOnInit(): void {
this.actions.getContributors(this.createdPreprint()!.id, ResourceType.Preprint);
this.actions.fetchSubjects(this.createdPreprint()!.id, ResourceType.Preprint);
this.actions.getContributors(this.preprint()!.id, ResourceType.Preprint);
this.actions.fetchSubjects(this.preprint()!.id, ResourceType.Preprint);
this.actions.fetchLicenses();
this.actions.fetchPreprintProject();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class SupplementsStepComponent implements OnInit {

readonly SupplementOptions = SupplementOptions;

createdPreprint = select(PreprintStepperSelectors.getCreatedPreprint);
createdPreprint = select(PreprintStepperSelectors.getPreprint);
isPreprintSubmitting = select(PreprintStepperSelectors.isPreprintSubmitting);
availableProjects = select(PreprintStepperSelectors.getAvailableProjects);
areAvailableProjectsLoading = select(PreprintStepperSelectors.areAvailableProjectsLoading);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class TitleAndAbstractStepComponent {
}),
});

createdPreprint = select(PreprintStepperSelectors.getCreatedPreprint);
createdPreprint = select(PreprintStepperSelectors.getPreprint);
providerId = select(PreprintStepperSelectors.getSelectedProviderId);

isUpdatingPreprint = select(PreprintStepperSelectors.isPreprintSubmitting);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { PreprintSteps } from '@osf/features/preprints/enums';
import { StepOption } from '@shared/models';

export const createNewVersionStepsConst: StepOption[] = [
{
index: 0,
label: 'preprints.preprintStepper.steps.file',
value: PreprintSteps.File,
},
{
index: 1,
label: 'preprints.preprintStepper.steps.review',
value: PreprintSteps.Review,
},
];
1 change: 1 addition & 0 deletions src/app/features/preprints/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './create-new-version-steps.const';
export * from './form-input-limits.const';
export * from './prereg-link-options.const';
export * from './submit-preprint-steps.const';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<section class="preprints-hero-container py-5 px-3 flex flex-column md:py-6 md:px-4">
<section class="flex align-items-center gap-2">
@if (isPreprintProviderLoading()) {
<p-skeleton width="3rem" height="1.5rem" />
<p-skeleton width="12rem" height="1.5rem" />
} @else {
<img
class="preprint-provider-hero-logo"
alt="Provider Logo"
height="40"
[src]="preprintProvider()!.brand.heroLogoImageUrl"
/>
<h1 class="preprint-provider-name">
{{ 'preprints.createNewVersionTitle' | translate }}
</h1>
}
</section>

@if (isWeb()) {
@if (isPreprintProviderLoading()) {
<p-skeleton class="m-t-48" width="50rem" height="5rem" />
} @else {
<osf-stepper
class="m-t-48"
[steps]="newVersionSteps"
[currentStep]="currentStep()"
(currentStepChange)="stepChange($event)"
/>
}
}
</section>

<!-- [RNi] TODO: Remove when preprint details page implemented -->
@if (!this.initMode()) {
<section class="flex-1 bg-white px-3 py-4 md:py-4 md:px-4">
@switch (currentStep().value) {
@case (PreprintSteps.File) {
<osf-file-step
[provider]="preprintProvider()"
(nextClicked)="moveToNextStep()"
(backClicked)="moveToPreviousStep()"
/>
}
@case (PreprintSteps.Review) {
<osf-review-step [provider]="preprintProvider()" />
}
}
</section>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { CreateNewVersionComponent } from './create-new-version.component';

describe('CreateNewVersionComponent', () => {
let component: CreateNewVersionComponent;
let fixture: ComponentFixture<CreateNewVersionComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [CreateNewVersionComponent],
}).compileComponents();

fixture = TestBed.createComponent(CreateNewVersionComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading