Skip to content

Commit 961631e

Browse files
author
Sachin Maheshwari
committed
Project sidebar changes - creating new component ProjectSidebarInfo, changes in LinksMenu css
1 parent b35a7ea commit 961631e

File tree

5 files changed

+165
-14
lines changed

5 files changed

+165
-14
lines changed

src/components/LinksMenu/LinksMenu.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const LinksMenu = ({ links, limit, canDelete, isAddingNewLink, onAddingNewLink,
6161
}
6262
</ul>
6363
{links.length > limit && <div className="links-footer">
64-
<a href="javascript:" onClick={() => onChangeLimit(10000)}>view more</a>
64+
<a href="javascript:" onClick={() => onChangeLimit(10000)}>View all</a>
6565
</div>}
6666
</div>
6767
</Panel>

src/components/LinksMenu/LinksMenu.scss

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
li{
55
@include roboto-medium;
66
font-size: $tc-label-md;
7-
color: $tc-gray-70;
7+
color: $tc-dark-blue;
88
line-height: $base-unit*6;
99
padding-left: $base-unit*4;
1010
display: flex;
@@ -29,12 +29,21 @@
2929
.links-footer{
3030
@include roboto;
3131
font-size: $tc-label-xs;
32-
color: $tc-dark-blue-70;
32+
color: $tc-gray-70;
3333
line-height: $base-unit*6;
3434
padding-left: $base-unit*4;
3535
}
3636

3737
.delete-link-modal {
3838
margin-left: -4*$base-unit;
3939
}
40+
41+
li:before {
42+
content: '\b7\a0';
43+
font-size: 200%;
44+
color: $tc-dark-blue
45+
}
46+
}
47+
.panel {
48+
box-shadow:none;
4049
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import _ from 'lodash'
2+
import moment from 'moment'
3+
import React, { PropTypes as PT } from 'react'
4+
import { Link } from 'react-router-dom'
5+
import TextTruncate from 'react-text-truncate'
6+
import { getProjectRoleForCurrentUser } from '../../helpers/projectHelper'
7+
import ProjectProgress from '../ProjectProgress/ProjectProgress'
8+
import ProjectStatus from '../ProjectStatus/ProjectStatus'
9+
import { findCategory } from '../../config/projectWizard'
10+
import SVGIconImage from '../SVGIconImage'
11+
import { PROJECT_STATUS_ACTIVE } from '../../config/constants'
12+
import './ProjectSidebarInfo.scss'
13+
14+
function ProjectSidebarInfo({ project, duration, currentMemberRole}) {
15+
16+
if (!project) return null
17+
18+
const category = findCategory(project.type)
19+
// icon for the category, use default generic work project icon for categories which no longer exist now
20+
const categoryIcon = _.get(category, 'icon', 'tech-32px-outline-work-project')
21+
return (
22+
<div className="project-sidebar-info">
23+
<div className="header">
24+
<div className="project-header">
25+
<div className="project-type-icon"><SVGIconImage filePath={categoryIcon} /></div>
26+
<div className="project-details">
27+
<div className="project-name">
28+
<TextTruncate
29+
containerClassName="project-name"
30+
line={1}
31+
truncateText="..."
32+
text={project.name}
33+
/>
34+
</div>
35+
<div className="project-date">{moment(project.updatedAt).format('MMM DD, YYYY')}</div>
36+
</div>
37+
</div>
38+
</div>
39+
<div className="body">
40+
<TextTruncate
41+
containerClassName="project-description"
42+
line={4}
43+
truncateText="..."
44+
text={project.description}
45+
textTruncateChild={<span><Link className="read-more-link" to={`/projects/${project.id}/specification`}> read more </Link></span>}
46+
/>
47+
<div className="project-status">
48+
{project.status !== PROJECT_STATUS_ACTIVE &&
49+
<ProjectStatus
50+
status={project.status}
51+
showText
52+
withoutLabel
53+
currentMemberRole={currentMemberRole}
54+
canEdit={false}
55+
unifiedHeader={false}
56+
/>
57+
}
58+
{project.status === PROJECT_STATUS_ACTIVE &&
59+
<ProjectProgress {...duration} viewType={ProjectProgress.ViewTypes.CIRCLE} percent={46}>
60+
<span className="progress-text">{duration.percent}% completed</span>
61+
</ProjectProgress>
62+
}
63+
</div>
64+
</div>
65+
</div>
66+
)
67+
}
68+
69+
ProjectSidebarInfo.defaultTypes = {
70+
}
71+
72+
ProjectSidebarInfo.propTypes = {
73+
project: PT.object.isRequired,
74+
currentMemberRole: PT.string,
75+
duration: PT.object.isRequired,
76+
}
77+
78+
export default ProjectSidebarInfo
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
@import 'tc-includes';
2+
3+
.project-sidebar-info {
4+
display: flex;
5+
flex-direction: column;
6+
background-color: $tc-white;
7+
border-top-left-radius: 6px;
8+
border-top-right-radius: 6px;
9+
padding: 4 * $base_unit;
10+
11+
.header {
12+
flex: 1;
13+
14+
.project-header {
15+
display: flex;
16+
flex-direction: row;
17+
min-height: 60px;
18+
max-height: 60px;
19+
overflow: hidden;
20+
21+
.project-details {
22+
display: flex;
23+
flex-direction: column;
24+
margin-left: 4 * $base_unit;
25+
26+
.project-name {
27+
color: $tc-black;
28+
}
29+
30+
.project-date {
31+
@include tc-body-extra-small;
32+
text-transform: uppercase;
33+
line-height: 4 * $base_unit;
34+
color: $tc-gray-50;
35+
}
36+
}
37+
}
38+
}
39+
40+
.body {
41+
flex: 2;
42+
.project-description {
43+
overflow: hidden;
44+
max-height: 120px;
45+
min-height: 120px;
46+
}
47+
48+
.project-status {
49+
border-top: 1px solid $tc-gray-10;
50+
border-bottom: 1px solid $tc-gray-10;
51+
padding: 10px 0px;
52+
display: flex;
53+
justify-content: center;
54+
55+
.status-header {
56+
.status-label {
57+
text-transform: uppercase;
58+
}
59+
}
60+
61+
.project-progress {
62+
display: flex;
63+
.progress-text {
64+
text-transform: uppercase;
65+
margin-left: 10px;
66+
line-height: 16px;
67+
}
68+
}
69+
}
70+
}
71+
}

src/projects/detail/containers/ProjectInfoContainer.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { updateProject, deleteProject } from '../../actions/project'
1010
import { setDuration } from '../../../helpers/projectHelper'
1111
import { PROJECT_ROLE_OWNER, PROJECT_ROLE_COPILOT, PROJECT_ROLE_MANAGER,
1212
DIRECT_PROJECT_URL, SALESFORCE_PROJECT_LEAD_LINK, PROJECT_STATUS_CANCELLED } from '../../../config/constants'
13+
import ProjectSidebarInfo from '../../../components/ProjectInfo/ProjectSidebarInfo'
1314

1415
class ProjectInfoContainer extends React.Component {
1516

@@ -99,26 +100,18 @@ class ProjectInfoContainer extends React.Component {
99100
}
100101
return (
101102
<div>
102-
<ProjectInfo
103-
projectId={project.id}
104-
canDeleteProject={canDeleteProject}
105-
onDeleteProject={this.onDeleteProject}
106-
directLinks={directLinks}
103+
<ProjectSidebarInfo
104+
project={project}
107105
currentMemberRole={currentMemberRole}
108-
description={project.description}
109-
type={project.type}
110-
devices={ devices }
111-
status={project.status} onChangeStatus={this.onChangeStatus}
112106
duration={duration}
113-
budget={budget}
114107
/>
115108
<LinksMenu
116109
links={project.bookmarks || []}
117110
canDelete={!!currentMemberRole}
118111
onAddNewLink={this.onAddNewLink}
119112
onDelete={this.onDeleteLink}
120113
/>
121-
<TeamManagementContainer projectId={project.id} members={project.members}/>
114+
<TeamManagementContainer projectId={project.id} members={project.members} />
122115
<FooterV2 />
123116
</div>
124117
)

0 commit comments

Comments
 (0)