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
1 change: 1 addition & 0 deletions src/app/features/preprints/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<boolean>(this.createdPreprint()!.hasCoi || false, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -70,29 +70,29 @@ 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);

readonly PreprintFileSource = PreprintFileSource;

provider = input.required<PreprintProviderDetails | undefined>();
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<StringOrNull>(null);
currentFolder = signal<OsfFile | null>(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ <h2>{{ 'preprints.preprintStepper.metadata.publicationDateTitle' | translate }}<
[showIcon]="true"
[showOnFocus]="true"
dateFormat="yy-mm-dd"
[maxDate]="today"
>
<ng-template #inputicon>
<osf-icon class="fa fa-calendar" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -65,10 +65,11 @@ export class MetadataStepComponent implements OnInit {
protected metadataForm!: FormGroup<MetadataForm>;
protected inputLimits = formInputLimits;
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<void>();
backClicked = output<void>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -31,7 +31,7 @@ import { INPUT_VALIDATION_MESSAGES } from '@shared/constants';
export class PreprintsSubjectsComponent implements OnInit {
preprintId = input<string>();

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<FormControl>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,19 @@ <h3>{{ 'preprints.preprintStepper.review.sections.metadata.affiliatedInstitution
</section>
}

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

<div>{{ license()?.name }}</div>
<p-accordion>
<p-accordion-panel value="0">
<p-accordion-header class="p-0 justify-content-start gap-2">
<div>{{ license()?.name }}</div>
</p-accordion-header>
<p-accordion-content>
<div>{{ license()!.text | interpolate: licenseOptionsRecord() }}</div>
</p-accordion-content>
</p-accordion-panel>
</p-accordion>
</section>

<section class="flex flex-column gap-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -15,18 +16,32 @@ 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';
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,
Expand All @@ -42,16 +57,19 @@ export class ReviewStepComponent implements OnInit {
submitPreprint: SubmitPreprint,
});
provider = input.required<PreprintProviderDetails | undefined>();
createdPreprint = select(SubmitPreprintSelectors.getCreatedPreprint);
createdPreprint = select(PreprintStepperSelectors.getCreatedPreprint);

contributors = select(ContributorsSelectors.getContributors);
bibliographicContributors = computed(() => {
return this.contributors().filter((contributor) => contributor.isBibliographic);
});
subjects = select(SubjectsSelectors.getSelectedSubjects);
affiliatedInstitutions = signal<Institution[]>([]);
license = select(SubmitPreprintSelectors.getPreprintLicense);
preprintProject = select(SubmitPreprintSelectors.getPreprintProject);
license = select(PreprintStepperSelectors.getPreprintLicense);
preprintProject = select(PreprintStepperSelectors.getPreprintProject);
licenseOptionsRecord = computed(() => {
return (this.createdPreprint()?.licenseOptions ?? {}) as Record<string, string>;
});

readonly ApplicabilityStatus = ApplicabilityStatus;
readonly PreregLinkInfo = PreregLinkInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand All @@ -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>(SupplementOptions.None);
selectedProjectId = signal<StringOrNull>(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<void>();

constructor() {
Expand Down
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 './form-input-limits.const';
export * from './prereg-link-options.const';
export * from './submit-preprint-steps.const';
export * from './update-preprint-steps.const';
Original file line number Diff line number Diff line change
@@ -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,
},
];
Original file line number Diff line number Diff line change
@@ -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,
},
];
2 changes: 1 addition & 1 deletion src/app/features/preprints/enums/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export enum SubmitSteps {
export enum PreprintSteps {
TitleAndAbstract = 0,
File,
Metadata,
Expand Down
Loading