diff --git a/src/app/core/constants/nav-items.constant.ts b/src/app/core/constants/nav-items.constant.ts index 9058c3655..7a86051e0 100644 --- a/src/app/core/constants/nav-items.constant.ts +++ b/src/app/core/constants/nav-items.constant.ts @@ -32,7 +32,20 @@ export const NAV_ITEMS: NavItem[] = [ path: '/preprints', label: 'navigation.preprints', icon: 'preprints', - useExactMatch: true, + isCollapsible: true, + useExactMatch: false, + items: [ + { + path: '/preprints', + label: 'navigation.preprintsSubRoutes.overview', + useExactMatch: false, + }, + { + path: '/my-preprints', + label: 'navigation.preprintsSubRoutes.myPreprints', + useExactMatch: true, + }, + ], }, { path: '/my-profile', diff --git a/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.html b/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.html index a5a0c4749..b782dab1e 100644 --- a/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.html +++ b/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.html @@ -21,7 +21,7 @@
+ {{ 'preprints.showExample' | translate }} +
} diff --git a/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.ts b/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.ts index 32494fd67..1ace7b354 100644 --- a/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.ts +++ b/src/app/features/preprints/components/preprint-provider-hero/preprint-provider-hero.component.ts @@ -4,6 +4,7 @@ import { Button } from 'primeng/button'; import { DialogService } from 'primeng/dynamicdialog'; import { Skeleton } from 'primeng/skeleton'; +import { TitleCasePipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, inject, input, output } from '@angular/core'; import { FormControl } from '@angular/forms'; import { RouterLink } from '@angular/router'; @@ -15,7 +16,7 @@ import { DecodeHtmlPipe } from '@shared/pipes'; @Component({ selector: 'osf-preprint-provider-hero', - imports: [Button, RouterLink, SearchInputComponent, Skeleton, TranslatePipe, DecodeHtmlPipe], + imports: [Button, RouterLink, SearchInputComponent, Skeleton, TranslatePipe, DecodeHtmlPipe, TitleCasePipe], templateUrl: './preprint-provider-hero.component.html', styleUrl: './preprint-provider-hero.component.scss', providers: [DialogService], diff --git a/src/app/features/preprints/components/preprint-services/preprint-services.component.ts b/src/app/features/preprints/components/preprint-services/preprint-services.component.ts index 565d7f54a..5e7b99120 100644 --- a/src/app/features/preprints/components/preprint-services/preprint-services.component.ts +++ b/src/app/features/preprints/components/preprint-services/preprint-services.component.ts @@ -3,7 +3,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { ChangeDetectionStrategy, Component, input } from '@angular/core'; import { RouterLink } from '@angular/router'; -import { PreprintProviderToAdvertise } from '@osf/features/preprints/models'; +import { PreprintProviderShortInfo } from '@osf/features/preprints/models'; @Component({ selector: 'osf-preprint-services', @@ -13,5 +13,5 @@ import { PreprintProviderToAdvertise } from '@osf/features/preprints/models'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class PreprintServicesComponent { - preprintProvidersToAdvertise = input.required{{ 'preprints.helpDialog.message' | translate }} - {{ 'preprints.helpDialog.linkText' | translate }}.
diff --git a/src/app/features/preprints/constants/preprints.routes.ts b/src/app/features/preprints/constants/preprints.routes.ts index bdca37437..4832d5795 100644 --- a/src/app/features/preprints/constants/preprints.routes.ts +++ b/src/app/features/preprints/constants/preprints.routes.ts @@ -7,6 +7,7 @@ import { PreprintsState } from '@osf/features/preprints/store/preprints'; 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'; export const preprintsRoutes: Routes = [ { @@ -18,6 +19,7 @@ export const preprintsRoutes: Routes = [ PreprintsDiscoverState, PreprintsResourcesFiltersState, PreprintsResourcesFiltersOptionsState, + SubmitPreprintState, ]), ], children: [ @@ -47,6 +49,13 @@ export const preprintsRoutes: Routes = [ (c) => c.PreprintProviderDiscoverComponent ), }, + { + path: 'select', + loadComponent: () => + import('@osf/features/preprints/pages/select-preprint-service/select-preprint-service.component').then( + (c) => c.SelectPreprintServiceComponent + ), + }, ], }, ]; diff --git a/src/app/features/preprints/mappers/preprints.mapper.ts b/src/app/features/preprints/mappers/preprints.mapper.ts index 5370489cb..aff80c2ee 100644 --- a/src/app/features/preprints/mappers/preprints.mapper.ts +++ b/src/app/features/preprints/mappers/preprints.mapper.ts @@ -1,7 +1,7 @@ import { PreprintProviderDetails, PreprintProviderDetailsGetResponse, - PreprintProviderToAdvertise, + PreprintProviderShortInfo, Subject, SubjectGetResponse, } from '@osf/features/preprints/models'; @@ -29,19 +29,20 @@ export class PreprintsMapper { secondaryColor: brandRaw.attributes.secondary_color, }, iri: response.links.iri, + faviconUrl: response.attributes.assets.favicon, }; } - static fromPreprintProvidersToAdvertiseGetResponse( + static toPreprintProviderShortInfoFromGetResponse( response: PreprintProviderDetailsGetResponse[] - ): PreprintProviderToAdvertise[] { - return response - .filter((item) => !item.id.includes('osf')) - .map((item) => ({ - id: item.id, - name: item.attributes.name, - whiteWideImageUrl: item.attributes.assets.wide_white, - })); + ): PreprintProviderShortInfo[] { + return response.map((item) => ({ + id: item.id, + descriptionHtml: item.attributes.description, + name: item.attributes.name, + whiteWideImageUrl: item.attributes.assets?.wide_white, + squareColorNoTransparentImageUrl: item.attributes.assets?.square_color_no_transparent, + })); } static fromSubjectsGetResponse(providerId: string, response: SubjectGetResponse[]): Subject[] { diff --git a/src/app/features/preprints/models/preprints.models.ts b/src/app/features/preprints/models/preprints.models.ts index 3c6fba4a6..26280982c 100644 --- a/src/app/features/preprints/models/preprints.models.ts +++ b/src/app/features/preprints/models/preprints.models.ts @@ -24,12 +24,15 @@ export interface PreprintProviderDetails { brand: Brand; lastFetched?: number; iri: string; + faviconUrl: string; } -export interface PreprintProviderToAdvertise { +export interface PreprintProviderShortInfo { id: string; name: string; + descriptionHtml: string; whiteWideImageUrl: string; + squareColorNoTransparentImageUrl: string; } export interface Subject { @@ -53,6 +56,8 @@ export interface PreprintProviderDetailsGetResponse { preprint_word: string; assets: { wide_white: string; + square_color_no_transparent: string; + favicon: string; }; allow_submissions: boolean; }; diff --git a/src/app/features/preprints/pages/landing/preprints-landing.component.html b/src/app/features/preprints/pages/landing/preprints-landing.component.html index 5021901d2..ab5d2de10 100644 --- a/src/app/features/preprints/pages/landing/preprints-landing.component.html +++ b/src/app/features/preprints/pages/landing/preprints-landing.component.html @@ -10,8 +10,8 @@+ + {{ 'preprints.selectService.description' | translate }} + + {{ + 'preprints.selectService.learnMore' | translate + }} +
+