Skip to content

Commit

Permalink
CORE: track back
Browse files Browse the repository at this point in the history
  • Loading branch information
ekachxaidze98 committed Nov 22, 2024
1 parent ac61e27 commit ad937d6
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/modules/search-result/search-result.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,14 @@ const fullTextStatus = ({ title, fullTextLink } = {}) => {
}

const SearchResult = ({
renderRedirectLink,
children,
id,
className,
searchId,
useLogo = true,
data: {
workId,
title,
author = [],
publicationDate,
Expand Down Expand Up @@ -153,7 +156,11 @@ const SearchResult = ({
itemType="https://schema.org/Person"
>
<a
href={`/search?q=author:(${a.name})`}
href={
renderRedirectLink && searchId
? `/search?q=author:(${a.name})&t=${searchId}-${workId}`
: `/search?q=author:(${a.name})`
}
className={styles.link}
>
<span itemProp="name">{a.name.replace(',', ' ')}</span>
Expand Down Expand Up @@ -208,7 +215,11 @@ const SearchResult = ({
className={styles.dataProvider}
>
<Link
href={`//core.ac.uk/data-providers/${dataProvider.id}`}
href={
renderRedirectLink && searchId
? `/data-providers/${dataProvider.id}?t=${searchId}-${workId}`
: `/data-providers/${dataProvider.id}`
}
className={styles.repositoryLink}
>
<span itemProp="name">{dataProvider.name}</span>
Expand All @@ -223,9 +234,11 @@ const SearchResult = ({

SearchResult.propTypes = {
id: PropTypes.string.isRequired,
searchId: PropTypes.string,
useLogo: PropTypes.bool,
renderRedirectLink: PropTypes.bool,
data: PropTypes.shape({
id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
workId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
title: PropTypes.string,
author: PropTypes.arrayOf(
PropTypes.shape({
Expand Down

0 comments on commit ad937d6

Please sign in to comment.