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 b77f664e1..c4eb7d713 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 @@ -122,7 +122,7 @@

{{ 'preprints.preprintStepper.review.sections.metadata.tags' | translate }}<

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

@if (preprint()?.originalPublicationDate) { - {{ preprint()?.originalPublicationDate | date: 'MMM d, y, h:mm a' }} + {{ preprint()?.originalPublicationDate | date: 'MMM d, y' }} } @else {

{{ 'common.labels.notApplicable' | translate }}

} diff --git a/src/app/shared/components/search-results-container/search-results-container.component.html b/src/app/shared/components/search-results-container/search-results-container.component.html index a6c3658fd..aa4a67c7b 100644 --- a/src/app/shared/components/search-results-container/search-results-container.component.html +++ b/src/app/shared/components/search-results-container/search-results-container.component.html @@ -22,7 +22,7 @@ }

- @if (searchCount() > 10000) { + @if (searchCount() >= 10000) { 10 000+ {{ 'collections.searchResults.results' | translate }} } @else if (searchCount() > 0) { {{ searchCount() }} {{ 'collections.searchResults.results' | translate }} diff --git a/src/app/shared/models/search/index-card-search-json-api.models.ts b/src/app/shared/models/search/index-card-search-json-api.models.ts index fabdbd47e..340e4359e 100644 --- a/src/app/shared/models/search/index-card-search-json-api.models.ts +++ b/src/app/shared/models/search/index-card-search-json-api.models.ts @@ -3,7 +3,7 @@ import { ApiData, JsonApiResponse } from '@shared/models'; export type IndexCardSearchResponseJsonApi = JsonApiResponse< { attributes: { - totalResultCount: number; + totalResultCount: number | { '@id': string }; }; relationships: { searchResultPage: SearchResultPageJsonApi; diff --git a/src/app/shared/services/global-search.service.ts b/src/app/shared/services/global-search.service.ts index b9fb70742..3271bf229 100644 --- a/src/app/shared/services/global-search.service.ts +++ b/src/app/shared/services/global-search.service.ts @@ -80,11 +80,29 @@ export class GlobalSearchService { return { resources: MapResources(response), filters: MapFilters(response), - count: response.data.attributes.totalResultCount, + count: this.parseTotalCount(response), self: response.data.links.self, first: response.data?.relationships?.searchResultPage.links?.first?.href ?? null, next: response.data?.relationships?.searchResultPage.links?.next?.href ?? null, previous: response.data?.relationships?.searchResultPage.links?.prev?.href ?? null, }; } + + private parseTotalCount(response: IndexCardSearchResponseJsonApi) { + let totalCount = 0; + const rawTotalCount = response.data.attributes.totalResultCount; + + if (typeof rawTotalCount === 'number') { + totalCount = rawTotalCount; + } else if ( + typeof rawTotalCount === 'object' && + rawTotalCount !== null && + '@id' in rawTotalCount && + String(rawTotalCount['@id']).includes('ten-thousands-and-more') + ) { + totalCount = 10000; + } + + return totalCount; + } }