diff --git a/src/projects/components/projectsCard/ProjectCardBody.jsx b/src/projects/components/projectsCard/ProjectCardBody.jsx index dfc9431f8..daf2dcbff 100644 --- a/src/projects/components/projectsCard/ProjectCardBody.jsx +++ b/src/projects/components/projectsCard/ProjectCardBody.jsx @@ -1,7 +1,7 @@ import React from 'react' import PT from 'prop-types' import TextTruncate from 'react-text-truncate' -import { Link } from 'react-router-dom' +import { withRouter } from 'react-router-dom' import ProjectStatus from '../../../components/ProjectStatus/ProjectStatus' import editableProjectStatus from '../../../components/ProjectStatus/editableProjectStatus' import { @@ -17,7 +17,7 @@ import _ from 'lodash' const EnhancedProjectStatus = editableProjectStatus(ProjectStatus) function ProjectCardBody({ project, projectCanBeActive, currentMemberRole, descLinesCount = 8, - onChangeStatus, isSuperUser, showLink, showLinkURL, canEditStatus = true, hideStatus }) { + onChangeStatus, isSuperUser, showLink, showLinkURL, canEditStatus = true, hideStatus, history }) { if (!project) return null const canEdit = canEditStatus && ( @@ -31,6 +31,13 @@ function ProjectCardBody({ project, projectCanBeActive, currentMemberRole, descL ], currentMemberRole) > -1))) ) + const goToProjectDetails = (evt, showLinkURL, projectDetailsURL) => { + evt.stopPropagation() + evt.preventDefault() + evt.nativeEvent.stopImmediatePropagation() + history.push(showLinkURL || projectDetailsURL) + } + const progress = _.get(process, 'percent', 0) const projectDetailsURL = project.version === 'v3' @@ -44,7 +51,7 @@ function ProjectCardBody({ project, projectCanBeActive, currentMemberRole, descL line={descLinesCount} truncateText="..." text={_.unescape(project.description)} - textTruncateChild={showLink ? read more : read more} + textTruncateChild={showLink ? { goToProjectDetails(evt, showLinkURL, projectDetailsURL) }}>read more : read more} /> {!hideStatus &&