Skip to content

Commit 346ca2b

Browse files
author
vikasrohit
authored
Merge pull request #1211 from appirio-tech/feature/second-level-project-category-performance
Feature/second level project category performance
2 parents d1c7568 + 73231aa commit 346ca2b

File tree

6 files changed

+32
-22
lines changed

6 files changed

+32
-22
lines changed

src/projects/create/components/FillProjectDetails.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import _ from 'lodash'
22
import React, { PropTypes as PT, Component } from 'react'
3+
import { Link } from 'react-router'
34
import Sticky from 'react-stickynode'
45

56
import config from '../../../config/projectWizard'
@@ -34,9 +35,9 @@ class FillProjectDetails extends Component {
3435

3536
render() {
3637
const { project, dirtyProject, processing, submitBtnText, userRoles } = this.props
38+
const isLoggedIn = userRoles && userRoles.length
39+
const logoTargetUrl = isLoggedIn ? '/projects' : '/'
3740
const product = _.get(project, 'details.products[0]')
38-
// const projectName = _.get(project, 'name')
39-
// const projectRef = _.get(project, 'details.utm.code', '')
4041
const projectTypeId = _.get(project, 'type')
4142
const subConfig = config[_.findKey(config, {id : projectTypeId})]
4243
const productName = _.findKey(subConfig.subtypes, {id : product})
@@ -48,8 +49,8 @@ class FillProjectDetails extends Component {
4849
return (
4950
<div className="FillProjectDetailsWrapper">
5051
<div className="header headerFillProjectDetails">
51-
{ (!userRoles || !userRoles.length) && <SVGIconImage filePath="connect-logo-mono" className="connectLogo" />}
52-
{ (!userRoles || !userRoles.length) && <button className="tc-btn tc-btn-default tc-btn-sm" onClick={ this.props.onChangeProjectType }><SVGIconImage filePath="arrows-undo" />Change project type</button> }
52+
{ !isLoggedIn && <Link className="logo" to={logoTargetUrl} target="_self"><SVGIconImage filePath="connect-logo-mono" className="connectLogo"/></Link>}
53+
{ !isLoggedIn && <button className="tc-btn tc-btn-default tc-btn-sm" onClick={ this.props.onChangeProjectType }><SVGIconImage filePath="arrows-undo" />Change project type</button> }
5354
</div>
5455
<div className="FillProjectDetails">
5556
<div className="header">

src/projects/create/components/IncompleteProjectConfirmation.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import React, { PropTypes as PT } from 'react'
2+
import { Link } from 'react-router'
23
import SVGIconImage from '../../../components/SVGIconImage'
34
import './IncompleteProjectConfirmation.scss'
45

5-
function IncompleteProjectConfirmation({ loadIncompleteProject, removeIncompleteProject }) {
6-
6+
function IncompleteProjectConfirmation({ loadIncompleteProject, removeIncompleteProject, userRoles }) {
7+
const isLoggedIn = userRoles && userRoles.length
8+
const logoTargetUrl = isLoggedIn ? '/projects' : '/'
79
return (
810
<div className="IncompleteProjectConfirmation">
911
<div className="header">
10-
<SVGIconImage filePath="connect-logo-mono" />
12+
{ !isLoggedIn && <Link className="logo" to={logoTargetUrl} target="_self"><SVGIconImage filePath="connect-logo-mono" className="connectLogo"/></Link>}
1113
</div>
1214
<h3>Welcome back!</h3>
1315
<h5>You started a project with us recently.</h5>

src/projects/create/components/ProjectWizard.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ class ProjectWizard extends Component {
161161
window.scrollTo(0, 0)
162162
const { onStepChange, onProjectUpdate } = this.props
163163
const products = findProductsOfCategory(projectType)
164-
console.log(products, 'products')
165164
const updateQuery = { }
166165
// restore common fields from dirty project
167166
// this.restoreCommonDetails(products, updateQuery, detailsQuery)
@@ -325,9 +324,11 @@ class ProjectWizard extends Component {
325324
<IncompleteProjectConfirmation
326325
loadIncompleteProject={ this.loadIncompleteProject }
327326
removeIncompleteProject={ this.removeIncompleteProject }
327+
userRoles={ userRoles }
328328
/>
329329
<SelectProjectType
330330
onProjectTypeChange={ this.updateProjectType }
331+
userRoles={ userRoles }
331332
/>
332333
<SelectProduct
333334
onProductChange={ this.updateProducts }

src/projects/create/components/SelectProduct.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { PropTypes as PT } from 'react'
2+
import { Link } from 'react-router'
23
import config from '../../../config/projectWizard'
34
import ProductCard from './ProductCard'
45
import SVGIconImage from '../../../components/SVGIconImage'
@@ -7,6 +8,8 @@ import './SelectProduct.scss'
78

89
function SelectProduct(props) {
910
const { userRoles, projectType, onChangeProjectType } = props
11+
const isLoggedIn = userRoles && userRoles.length
12+
const logoTargetUrl = isLoggedIn ? '/projects' : '/'
1013
const cards = []
1114
for (const key in config) {
1215
const type = config[key]
@@ -33,8 +36,8 @@ function SelectProduct(props) {
3336
return (
3437
<div>
3538
<div className="header headerSelectProduct">
36-
{ (!userRoles || !userRoles.length) && <SVGIconImage filePath="connect-logo-mono" />}
37-
{ (!userRoles || !userRoles.length) && <button className="tc-btn tc-btn-default tc-btn-sm" onClick={ onChangeProjectType }><SVGIconImage filePath="arrows-undo" />Change project type</button> }
39+
{ !isLoggedIn && <Link className="logo" to={logoTargetUrl} target="_self"><SVGIconImage filePath="connect-logo-mono" className="connectLogo"/></Link>}
40+
{ !isLoggedIn && <button className="tc-btn tc-btn-default tc-btn-sm" onClick={ onChangeProjectType }><SVGIconImage filePath="arrows-undo" />Change project type</button> }
3841
</div>
3942
<div className="SelectProduct">
4043
<h1> { projectCategory.name } projects </h1>

src/projects/create/components/SelectProjectType.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { PropTypes as PT } from 'react'
2+
import { Link } from 'react-router'
23
import config from '../../../config/projectWizard'
34
import ProjectTypeCard from './ProjectTypeCard'
45
import SVGIconImage from '../../../components/SVGIconImage'
@@ -7,6 +8,8 @@ import './SelectProjectType.scss'
78

89
function SelectProjectType(props) {
910
const { userRoles } = props
11+
const isLoggedIn = userRoles && userRoles.length
12+
const logoTargetUrl = isLoggedIn ? '/projects' : '/'
1013
const cards = []
1114
for (const key in config) {
1215
const item = config[key]
@@ -26,7 +29,7 @@ function SelectProjectType(props) {
2629
return (
2730
<div>
2831
<div className="header headerSelectProjectType">
29-
{ (!userRoles || !userRoles.length) && <SVGIconImage filePath="connect-logo-mono" className="connectLogo"/>}
32+
{ !isLoggedIn && <Link className="logo" to={logoTargetUrl} target="_self"><SVGIconImage filePath="connect-logo-mono" className="connectLogo"/></Link>}
3033
</div>
3134
<div className="SelectProjectType">
3235
<h1>Create a new project</h1>

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Walkthrough from '../Walkthrough/Walkthrough'
1010

1111
import UserWithName from '../../../../components/User/UserWithName'
1212
import CoderBot from '../../../../components/CoderBot/CoderBot'
13+
import { findCategory } from '../../../../config/projectWizard'
1314
import { ROLE_CONNECT_MANAGER, ROLE_CONNECT_COPILOT, PROJECT_STATUS } from '../../../../config/constants'
1415

1516
// This handles showing a spinner while the state is being loaded async
@@ -32,17 +33,15 @@ const EnhancedGrid = enhance(GridView)
3233
require('./ProjectsView.scss')
3334

3435
/*eslint-disable quote-props */
35-
const projectTypeMap = {
36-
'generic': 'Work Project',
37-
'visual_design': 'Design',
38-
'visual_prototype': 'Design & Prototype',
39-
'app_dev': 'Full App'
40-
}
4136
const projectTypeClassMap = {
42-
'generic': 'purple-block',
43-
'visual_design': 'blue-block',
44-
'visual_prototype': 'blue-block',
45-
'app_dev': 'green-block'
37+
'generic' : 'purple-block',
38+
'visual_design' : 'blue-block',
39+
'visual_prototype' : 'blue-block',
40+
'app_dev' : 'green-block',
41+
'app' : 'green-block',
42+
'website' : 'green-block',
43+
'chatbot' : 'green-block',
44+
'quality_assurance' : 'green-block',
4645
}
4746
/*eslint-enable */
4847

@@ -79,11 +78,12 @@ const ProjectsView = props => {
7978
const url = `/projects/${item.id}`
8079
const code = _.get(item, 'details.utm.code', '')
8180
const projectTypeClass = projectTypeClassMap[item.type]
81+
const projectType = _.get(findCategory(item.type), 'name', '')
8282
return (
8383
<div className="spacing">
8484
<Link to={url} className="link-title">{item.name}</Link>
8585
<div className="project-metadata">
86-
<span className={ projectTypeClass }>{projectTypeMap[item.type]}</span>
86+
<span className={ projectTypeClass }>{ projectType }</span>
8787
{ code && <span className="item-ref-code txt-gray-md">Ref: {code}</span> }
8888
<span className="txt-time">{moment(item.createdAt).format('DD MMM YYYY')}</span>
8989
</div>

0 commit comments

Comments
 (0)