Skip to content

Commit 7f92415

Browse files
author
Vikas Agarwal
committed
Merge branch 'dev' into feature/topbar-filters-visual-indicator
* dev: Github issue #287 after applying search if click on Connect logo, should lands user to project listing page -- Fixed. Now it reloads the page even if user is already on project listing page. Fixed lint errors Github issue #317 [Specification] - no option to remove the color added -- Fixed the edge case bug where user wasn't able to add new colors even if he/she has removed colors after max limit reached. -- Removed colors state variable as it is not needed now because we don't have enable/disable kind of behaviour.
2 parents 3f9f197 + f77cca5 commit 7f92415

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

src/components/ColorSelector/ColorSelector.jsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, {PropTypes} from 'react'
22
import './ColorSelector.scss'
33
import { SketchPicker } from 'react-color'
4-
import _ from 'lodash'
54
import { HOC as hoc } from 'formsy-react'
65
import {PROJECT_MAX_COLORS} from '../../config/constants'
76
import { Icons } from 'appirio-tech-react-components'
@@ -13,15 +12,14 @@ class ColorSelector extends React.Component {
1312

1413
this.state = {
1514
isPickerVisible: false,
16-
newColor: '#fff',
17-
colors: _.uniq([...props.defaultColors, ...props.value])
15+
newColor: '#fff'
1816
}
1917
}
2018

2119
render() {
22-
const {getValue, name, onChange, setValue} = this.props
23-
const value = getValue() || []
24-
const {isPickerVisible, colors, newColor} = this.state
20+
const {getValue, name, onChange, setValue, defaultColors } = this.props
21+
const value = getValue() || defaultColors
22+
const {isPickerVisible, newColor} = this.state
2523

2624
const onColorToggle = (color) => {
2725
const index = value.indexOf(color)
@@ -54,7 +52,7 @@ class ColorSelector extends React.Component {
5452
</a>
5553
)}
5654

57-
{colors.length < PROJECT_MAX_COLORS &&
55+
{value.length < PROJECT_MAX_COLORS &&
5856
<a
5957
href="javascript:"
6058
onClick={() => this.setState({isPickerVisible: true})}
@@ -72,11 +70,6 @@ class ColorSelector extends React.Component {
7270
<button type="button" className="tc-btn tc-btn-primary tc-btn-md"
7371
onClick={() => {
7472
this.setState({isPickerVisible: false})
75-
if (colors.indexOf(newColor) === -1) {
76-
this.setState({colors: [...colors, newColor], newColor: '#fff'})
77-
} else {
78-
this.setState({newColor: '#fff'})
79-
}
8073
const newValue = [...value, newColor]
8174
setValue(newValue)
8275
onChange(name, newValue)

src/components/TopBar/TopBar.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class TopBar extends Component {
6767
]
6868
const logo = (
6969
<div className="logo-wrapper">
70-
<Link className="logo" to={logoTargetUrl}><ConnectLogoBeta /></Link>
70+
<Link className="logo" to={logoTargetUrl} target="_self"><ConnectLogoBeta /></Link>
7171
</div>
7272
)
7373
const avatar = (

0 commit comments

Comments
 (0)