Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1672 BackgroundSwitcher review #1823

Merged
merged 10 commits into from
May 18, 2017

Conversation

allyoucanmap
Copy link
Contributor

No description provided.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 79.416% when pulling 435a021 on allyoucanmap:background-selector into 5b0b8c3 on geosolutions-it:master.

* }
*/

const BackgroundSelectorPlugin = connect((state) => ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use reselect

};
},
componentWillUnmount() {
this.props.setControlProperty('backgroundSelector', 'currentLayer', {});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use a separate reducer or bind this method to background selector from the plugin. I don't want to make components aware of the setControlProperty method if it is possible.

@coveralls
Copy link

coveralls commented May 15, 2017

Coverage Status

Coverage increased (+0.6%) to 79.863% when pulling 8e5b66a on allyoucanmap:background-selector into 5b0b8c3 on geosolutions-it:master.


const BackgroundSelector = React.createClass({
propTypes: {
drawerWidth: React.PropTypes.number,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something a component shouldn't know. Style should be enough to control all we need from the external selector

bottom: React.PropTypes.number,
isMobile: React.PropTypes.bool,
enabled: React.PropTypes.bool,
drawerEnabled: React.PropTypes.bool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something a component shouldn't know. Use style instead to get the left position

drawerWidth: React.PropTypes.number,
start: React.PropTypes.number,
bottom: React.PropTypes.number,
isMobile: React.PropTypes.bool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something a component shouldn't know, can we extract the differences in one or more specific properties?

currentLayer: React.PropTypes.object,
tempLayer: React.PropTypes.object,
size: React.PropTypes.object,
desktop: React.PropTypes.object,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something a component shouldn't know

tempLayer: React.PropTypes.object,
size: React.PropTypes.object,
desktop: React.PropTypes.object,
mobile: React.PropTypes.object,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something a component shouldn't know

const AerialWithLabels = require('./images/mapthumbs/AerialWithLabels.jpg');
const OpenTopoMap = require('./images/mapthumbs/OpenTopoMap.jpg');

const thumbs = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these should not stay here. Maybe in the plugin


return {pagination, listSize, visibleIconsLength};
},
renderDesktop() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's create one render method where properties can create both desktop and mobile versions. In the plugin, set properties for desktop or mobile.

};
},
render() {
let glyph = this.props.direction ? 'chevron-right' : 'chevron-left';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const glyph = glyphs[this.props.vertical][this.props.direction];

},
render() {
const containerClass = this.props.vertical ? 'background-preview-icon-container-vertical' : 'background-preview-icon-container-horizontal';
let type = this.props.layer.visibility ? containerClass + ' bg-primary' : containerClass + ' bg-body';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use const, let is not needed. You can do everything without calculating type twice

};
},
componentWillUnmount() {
this.props.resetWidth();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is needed. If the control is not enabled, width is 0, we don't need an additional property

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 79.707% when pulling 31a69ac on allyoucanmap:background-selector into 5b0b8c3 on geosolutions-it:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 79.707% when pulling 31a69ac on allyoucanmap:background-selector into 5b0b8c3 on geosolutions-it:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 79.707% when pulling f007e6a on allyoucanmap:background-selector into 5b0b8c3 on geosolutions-it:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 79.572% when pulling 3c7bf43 on allyoucanmap:background-selector into 27b303b on geosolutions-it:master.

@simboss simboss merged commit 0c7d62f into geosolutions-it:master May 18, 2017
@allyoucanmap allyoucanmap deleted the background-selector branch May 19, 2017 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants