From 4283fcd181e416eceffb8f7d510529038beda58a Mon Sep 17 00:00:00 2001 From: Maksym Mykhailenko Date: Wed, 2 May 2018 13:12:18 +0800 Subject: [PATCH] status is not selectable on card view, cards are whole links instead of title only --- .../list/components/Projects/ProjectCard.jsx | 37 ++++++++----------- .../list/components/Projects/ProjectCard.scss | 2 +- .../components/Projects/ProjectCardBody.jsx | 12 ++++-- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/src/projects/list/components/Projects/ProjectCard.jsx b/src/projects/list/components/Projects/ProjectCard.jsx index efde30da2..ea9f876b0 100644 --- a/src/projects/list/components/Projects/ProjectCard.jsx +++ b/src/projects/list/components/Projects/ProjectCard.jsx @@ -5,8 +5,6 @@ import { getProjectRoleForCurrentUser } from '../../../../helpers/projectHelper' import ProjectCardHeader from './ProjectCardHeader' import ProjectCardBody from './ProjectCardBody' import ProjectManagerAvatars from './ProjectManagerAvatars' -import MediaQuery from 'react-responsive' -import { SCREEN_BREAKPOINT_MD } from '../../../../config/constants' import './ProjectCard.scss' function ProjectCard({ project, duration, disabled, currentUser, history, onChangeStatus}) { @@ -14,28 +12,25 @@ function ProjectCard({ project, duration, disabled, currentUser, history, onChan if (!project) return null const currentMemberRole = getProjectRoleForCurrentUser({ project, currentUserId: currentUser.userId}) return ( -
+
{ + history.push(`/projects/${project.id}/`) + }} + >
- { - history.push(`/projects/${project.id}/`) - }} - /> +
- - {(matches) => ( - - )} - +
diff --git a/src/projects/list/components/Projects/ProjectCard.scss b/src/projects/list/components/Projects/ProjectCard.scss index 9799893e3..eb79eb98b 100644 --- a/src/projects/list/components/Projects/ProjectCard.scss +++ b/src/projects/list/components/Projects/ProjectCard.scss @@ -3,6 +3,7 @@ :global { .ProjectCard { position: relative; + cursor: pointer; display: flex; flex-direction: column; height: 100%; @@ -65,7 +66,6 @@ } .card-header { - cursor: pointer; margin-bottom: 4 * $base_unit; @media screen and (max-width: $screen-md - 1px) { diff --git a/src/projects/list/components/Projects/ProjectCardBody.jsx b/src/projects/list/components/Projects/ProjectCardBody.jsx index a7708c0c5..2ab8383f6 100644 --- a/src/projects/list/components/Projects/ProjectCardBody.jsx +++ b/src/projects/list/components/Projects/ProjectCardBody.jsx @@ -12,11 +12,13 @@ import _ from 'lodash' const EnhancedProjectStatus = editableProjectStatus(ProjectStatus) function ProjectCardBody({ project, duration, currentMemberRole, descLinesCount = 8, - onChangeStatus, isSuperUser, showLink, showLinkURL }) { + onChangeStatus, isSuperUser, showLink, showLinkURL, canEditStatus = true }) { if (!project) return null - const canEdit = project.status !== PROJECT_STATUS_COMPLETED && (isSuperUser || (currentMemberRole + const canEdit = canEditStatus && ( + project.status !== PROJECT_STATUS_COMPLETED && (isSuperUser || (currentMemberRole && (_.indexOf([PROJECT_ROLE_COPILOT, PROJECT_ROLE_MANAGER], currentMemberRole) > -1))) + ) const progress = _.get(process, 'percent', 0) @@ -54,7 +56,8 @@ function ProjectCardBody({ project, duration, currentMemberRole, descLinesCount ProjectCardBody.defaultTypes = { showLink: false, - showLinkURL: '' + showLinkURL: '', + canEditStatus: true } ProjectCardBody.propTypes = { @@ -62,7 +65,8 @@ ProjectCardBody.propTypes = { currentMemberRole: PT.string, duration: PT.object.isRequired, showLink: PT.bool, - showLinkURL: PT.string + showLinkURL: PT.string, + canEditStatus: PT.bool } export default ProjectCardBody