Skip to content

Commit

Permalink
Core add prop vol1 (#356)
Browse files Browse the repository at this point in the history
* CORE: remove prop

* CORE: add prop for reader
  • Loading branch information
ekachxaidze98 authored Nov 13, 2024
1 parent 9634090 commit 895aa0f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 23 additions & 10 deletions templates/search/results.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const Results = ({ works, searchId }) =>
const fullTextLink = links.find((l) => l.type === 'download')?.url
const metadataLink = links.find((l) => l.type === 'display')?.url

const urlSearchString = window.location.search

const publicationDate = publishedDate
? formatDate(new Date(publishedDate))
: yearPublished !== null && toString(yearPublished)
Expand Down Expand Up @@ -70,6 +72,7 @@ const Results = ({ works, searchId }) =>
if (innerDownloadLink) return innerDownloadLink
return innerFullTextLink
}

return (
<SearchResult
id={`search-output-${id}`}
Expand All @@ -78,7 +81,10 @@ const Results = ({ works, searchId }) =>
className={styles.searchResults}
useLogo={!!checkBillingType()}
searchId={searchId}
renderRedirectLink
renderRedirectLink={
!urlSearchString.includes('author') &&
!window.location.pathname.includes('data-providers')
}
data={{
workId: id,
title,
Expand All @@ -87,15 +93,22 @@ const Results = ({ works, searchId }) =>
publicationDate: publicationDate || null,
thumbnailUrl: thumbnailLink || `//core.ac.uk/image/${id}/medium`,
metadataLink:
generateMetadataLink(metadataLink, searchId, id) ||
generateMetadataLink(displayLink, searchId, id),
fullTextLink: renderFullTextLink({
fullTextLink,
downloadLink,
modifiedReaderLink,
searchId,
id,
}),
!urlSearchString.includes('author') &&
!window.location.pathname.includes('data-providers')
? generateMetadataLink(metadataLink, searchId, id) ||
generateMetadataLink(displayLink, searchId, id)
: metadataLink || displayLink,
fullTextLink:
!urlSearchString.includes('author') &&
!window.location.pathname.includes('data-providers')
? renderFullTextLink({
fullTextLink,
downloadLink,
modifiedReaderLink,
searchId,
id,
})
: fullTextLink || readerLink || downloadLink,
dataProviders: dataProviders || [],
isRecommended: memberType?.billing_type === 'sustaining',
}}
Expand Down

0 comments on commit 895aa0f

Please sign in to comment.