Skip to content

Commit 60b468b

Browse files
author
vikasrohit
authored
Merge pull request #1324 from appirio-tech/feature/project-listing-updates#1268
Feature/project listing updates#1268
2 parents 34f5f1e + bccf0b3 commit 60b468b

File tree

8 files changed

+39
-17
lines changed

8 files changed

+39
-17
lines changed

src/components/ProjectInfo/ProjectInfo.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ProjectInfo extends Component {
2828
}
2929

3030
render() {
31-
const { project, currentMemberRole, duration, canDeleteProject, onChangeStatus, directLinks } = this.props
31+
const { project, currentMemberRole, duration, canDeleteProject, onChangeStatus, directLinks, isManager } = this.props
3232
const { showDeleteConfirm } = this.state
3333
return (
3434
<div className="project-info">
@@ -54,6 +54,7 @@ class ProjectInfo extends Component {
5454
duration={duration}
5555
descLinesCount={4}
5656
onChangeStatus={onChangeStatus}
57+
isManager={isManager}
5758
/>
5859
<ProjectDirectLinks
5960
directLinks={directLinks}

src/components/ProjectStatus/ProjectStatus.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ $status-height : 20px;
154154
@include roboto-medium;
155155
font-size: $tc-label-md;
156156
text-align: left;
157-
color: $tc-light-blue;
157+
color: $tc-black;
158158
line-height: 30px;
159159
padding-left: 20px;
160160
margin-bottom: 20px;
@@ -179,6 +179,7 @@ $status-height : 20px;
179179
.status-label {
180180
color: #394146;
181181
padding-right: 0px;
182+
font-size: 13px;
182183
}
183184
}
184185
}

src/projects/detail/Dashboard.jsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ import spinnerWhileLoading from '../../components/LoadingSpinner'
77

88
require('./Dashboard.scss')
99

10-
const DashboardView = ({project, currentMemberRole, route, params}) => (
10+
const DashboardView = ({project, currentMemberRole, route, params, isManager }) => (
1111
<div>
1212
<div className="dashboard-container">
1313
<div className="left-area">
1414
<Sticky top={80}>
1515
<div className="dashboard-left-panel">
16-
<ProjectInfoContainer currentMemberRole={currentMemberRole} project={project} />
16+
<ProjectInfoContainer
17+
currentMemberRole={currentMemberRole}
18+
project={project}
19+
isManager={isManager}
20+
/>
1721
</div>
1822
</Sticky>
1923
</div>

src/projects/detail/ProjectDetail.jsx

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import { connect } from 'react-redux'
55
import _ from 'lodash'
66
import { renderComponent, branch, compose, withProps } from 'recompose'
77
import { loadProjectDashboard } from '../actions/projectDashboard'
8-
import { LOAD_PROJECT_FAILURE, PROJECT_ROLE_CUSTOMER, PROJECT_ROLE_OWNER } from '../../config/constants'
8+
import {
9+
LOAD_PROJECT_FAILURE, PROJECT_ROLE_CUSTOMER, PROJECT_ROLE_OWNER,
10+
ROLE_ADMINISTRATOR, ROLE_CONNECT_MANAGER
11+
} from '../../config/constants'
912
import spinnerWhileLoading from '../../components/LoadingSpinner'
1013
import CoderBot from '../../components/CoderBot/CoderBot'
1114

@@ -26,7 +29,8 @@ const ProjectDetailView = (props) => {
2629
const children = React.Children.map(props.children, (child) => {
2730
return React.cloneElement(child, {
2831
project: props.project,
29-
currentMemberRole: props.currentMemberRole
32+
currentMemberRole: props.currentMemberRole,
33+
isManager: props.isManager
3034
})
3135
})
3236
return <div>{children}</div>
@@ -67,7 +71,15 @@ class ProjectDetail extends Component {
6771

6872
render() {
6973
const currentMemberRole = this.getProjectRoleForCurrentUser(this.props)
70-
return <EnhancedProjectDetailView {...this.props} currentMemberRole={currentMemberRole} />
74+
const managerRoles = [ROLE_ADMINISTRATOR, ROLE_CONNECT_MANAGER]
75+
const isManager = this.props.currentUserRoles.some((role) => managerRoles.indexOf(role) !== -1)
76+
return (
77+
<EnhancedProjectDetailView
78+
{...this.props}
79+
currentMemberRole={currentMemberRole}
80+
isManager={isManager}
81+
/>
82+
)
7183
}
7284
}
7385

@@ -77,9 +89,11 @@ const mapStateToProps = ({projectState, projectDashboard, loadUser}) => {
7789
isLoading: projectDashboard.isLoading,
7890
isProcessing: projectState.processing,
7991
error: projectState.error,
80-
project: projectState.project
92+
project: projectState.project,
93+
currentUserRoles: loadUser.user.roles
8194
}
8295
}
96+
8397
const mapDispatchToProps = { loadProjectDashboard }
8498

8599
ProjectDetail.propTypes = {

src/projects/detail/containers/ProjectInfoContainer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ class ProjectInfoContainer extends React.Component {
7474

7575
render() {
7676
const { duration } = this.state
77-
const { project, currentMemberRole } = this.props
78-
77+
const { project, currentMemberRole, isManager } = this.props
7978
let directLinks = null
8079
// check if direct links need to be added
8180
const isMemberOrCopilot = _.indexOf([PROJECT_ROLE_COPILOT, PROJECT_ROLE_MANAGER], currentMemberRole) > -1
@@ -108,6 +107,7 @@ class ProjectInfoContainer extends React.Component {
108107
onDeleteProject={this.onDeleteProject}
109108
onChangeStatus={this.onChangeStatus}
110109
directLinks={directLinks}
110+
isManager={isManager}
111111
/>
112112
<LinksMenu
113113
links={project.bookmarks || []}

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ import TextTruncate from 'react-text-truncate'
44
import ProjectProgress from '../../../../components/ProjectProgress/ProjectProgress'
55
import ProjectStatus from '../../../../components/ProjectStatus/ProjectStatus'
66
import editableProjectStatus from '../../../../components/ProjectStatus/editableProjectStatus'
7-
import { PROJECT_STATUS_ACTIVE, PROJECT_ROLE_COPILOT, PROJECT_ROLE_MANAGER } from '../../../../config/constants'
7+
import { PROJECT_STATUS_ACTIVE, PROJECT_ROLE_COPILOT } from '../../../../config/constants'
88
import './ProjectCardBody.scss'
99
import _ from 'lodash'
1010

1111
const EnhancedProjectStatus = editableProjectStatus(ProjectStatus)
1212

1313
function ProjectCardBody({ project, duration, currentMemberRole, descLinesCount = 8,
14-
onChangeStatus }) {
14+
onChangeStatus, isManager }) {
1515
if (!project) return null
16-
const canEdit = currentMemberRole
17-
&& _.indexOf([PROJECT_ROLE_COPILOT, PROJECT_ROLE_MANAGER], currentMemberRole) > -1
16+
17+
const canEdit = isManager || (currentMemberRole
18+
&& (_.indexOf([PROJECT_ROLE_COPILOT], currentMemberRole) > -1))
1819

1920
return (
2021
<div className="project-card-body">
@@ -26,7 +27,7 @@ function ProjectCardBody({ project, duration, currentMemberRole, descLinesCount
2627
textTruncateChild={<span><Link className="read-more-link" to={`/projects/${project.id}/specification`}> read more </Link></span>}
2728
/>
2829
<div className="project-status">
29-
{project.status !== PROJECT_STATUS_ACTIVE &&
30+
{(duration && duration.percent === 0) &&
3031
<EnhancedProjectStatus
3132
status={project.status}
3233
showText
@@ -37,7 +38,7 @@ function ProjectCardBody({ project, duration, currentMemberRole, descLinesCount
3738
onChangeStatus={onChangeStatus}
3839
/>
3940
}
40-
{project.status === PROJECT_STATUS_ACTIVE &&
41+
{(project.status === PROJECT_STATUS_ACTIVE && duration && duration.percent !== 0) &&
4142
<ProjectProgress {...duration} viewType={ProjectProgress.ViewTypes.CIRCLE} percent={46}>
4243
<span className="progress-text">{duration.percent}% completed</span>
4344
</ProjectProgress>

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
.project-status {
1919
border-top: 1px solid $tc-gray-10;
2020
border-bottom: 1px solid $tc-gray-10;
21-
padding: 10px 0px;
2221
display: flex;
2322
justify-content: center;
2423
margin-top: 20px;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
color: $tc-gray-40;
77
line-height: $base-unit*6;
88
padding-top: 2 * $base_unit;
9+
padding-left: 4 * $base_unit;
10+
padding-right: 4 * $base_unit;
911
ul {
1012
padding: 0;
1113
li {

0 commit comments

Comments
 (0)