Skip to content

Commit 85ef36d

Browse files
authored
Merge pull request #1986 from appirio-tech/feature/connectMobile
Feature/connect mobile
2 parents 6293d37 + 97adc94 commit 85ef36d

File tree

3 files changed

+25
-26
lines changed

3 files changed

+25
-26
lines changed

src/projects/list/components/Projects/ProjectCard.jsx

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,32 @@ import { getProjectRoleForCurrentUser } from '../../../../helpers/projectHelper'
55
import ProjectCardHeader from './ProjectCardHeader'
66
import ProjectCardBody from './ProjectCardBody'
77
import ProjectManagerAvatars from './ProjectManagerAvatars'
8-
import MediaQuery from 'react-responsive'
9-
import { SCREEN_BREAKPOINT_MD } from '../../../../config/constants'
108
import './ProjectCard.scss'
119

1210
function ProjectCard({ project, duration, disabled, currentUser, history, onChangeStatus}) {
1311
const className = `ProjectCard ${ disabled ? 'disabled' : 'enabled'}`
1412
if (!project) return null
1513
const currentMemberRole = getProjectRoleForCurrentUser({ project, currentUserId: currentUser.userId})
1614
return (
17-
<div className={className}>
15+
<div
16+
className={className}
17+
onClick={() => {
18+
history.push(`/projects/${project.id}/`)
19+
}}
20+
>
1821
<div className="card-header">
19-
<ProjectCardHeader
20-
project={project}
21-
onClick={() => {
22-
history.push(`/projects/${project.id}/`)
23-
}}
24-
/>
22+
<ProjectCardHeader project={project} />
2523
</div>
2624
<div className="card-body">
27-
<MediaQuery minWidth={SCREEN_BREAKPOINT_MD}>
28-
{(matches) => (
29-
<ProjectCardBody
30-
project={project}
31-
currentMemberRole={currentMemberRole}
32-
duration={duration}
33-
onChangeStatus={onChangeStatus}
34-
showLink
35-
showLinkURL={matches ? `/projects/${project.id}/specification` : `/projects/${project.id}`}
36-
/>
37-
)}
38-
</MediaQuery>
25+
<ProjectCardBody
26+
project={project}
27+
currentMemberRole={currentMemberRole}
28+
duration={duration}
29+
onChangeStatus={onChangeStatus}
30+
showLink
31+
showLinkURL={`/projects/${project.id}/specification`}
32+
canEditStatus={false}
33+
/>
3934
</div>
4035
<div className="card-footer">
4136
<ProjectManagerAvatars managers={project.members} maxShownNum={10} />

src/projects/list/components/Projects/ProjectCard.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
:global {
44
.ProjectCard {
55
position: relative;
6+
cursor: pointer;
67
display: flex;
78
flex-direction: column;
89
height: 100%;
@@ -65,7 +66,6 @@
6566
}
6667

6768
.card-header {
68-
cursor: pointer;
6969
margin-bottom: 4 * $base_unit;
7070

7171
@media screen and (max-width: $screen-md - 1px) {

src/projects/list/components/Projects/ProjectCardBody.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ import _ from 'lodash'
1212
const EnhancedProjectStatus = editableProjectStatus(ProjectStatus)
1313

1414
function ProjectCardBody({ project, duration, currentMemberRole, descLinesCount = 8,
15-
onChangeStatus, isSuperUser, showLink, showLinkURL }) {
15+
onChangeStatus, isSuperUser, showLink, showLinkURL, canEditStatus = true }) {
1616
if (!project) return null
1717

18-
const canEdit = project.status !== PROJECT_STATUS_COMPLETED && (isSuperUser || (currentMemberRole
18+
const canEdit = canEditStatus && (
19+
project.status !== PROJECT_STATUS_COMPLETED && (isSuperUser || (currentMemberRole
1920
&& (_.indexOf([PROJECT_ROLE_COPILOT, PROJECT_ROLE_MANAGER], currentMemberRole) > -1)))
21+
)
2022

2123
const progress = _.get(process, 'percent', 0)
2224

@@ -54,15 +56,17 @@ function ProjectCardBody({ project, duration, currentMemberRole, descLinesCount
5456

5557
ProjectCardBody.defaultTypes = {
5658
showLink: false,
57-
showLinkURL: ''
59+
showLinkURL: '',
60+
canEditStatus: true
5861
}
5962

6063
ProjectCardBody.propTypes = {
6164
project: PT.object.isRequired,
6265
currentMemberRole: PT.string,
6366
duration: PT.object.isRequired,
6467
showLink: PT.bool,
65-
showLinkURL: PT.string
68+
showLinkURL: PT.string,
69+
canEditStatus: PT.bool
6670
}
6771

6872
export default ProjectCardBody

0 commit comments

Comments
 (0)