Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Extract shared methods to expose common structure #13

Merged
merged 3 commits into from
Aug 9, 2017

Conversation

c-w
Copy link
Contributor

@c-w c-w commented Jul 31, 2017

Not sure why we had three different ways of getting the mainEdge before. Would this refactor make sense?

@c-w c-w requested a review from erikschlegel July 31, 2017 16:18
Copy link
Contributor

@Smarker Smarker left a comment

Choose a reason for hiding this comment

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

LGTM

@c-w c-w force-pushed the dashboard-extract-shared branch from 63641ce to 081c8a5 Compare August 9, 2017 18:24
Copy link
Collaborator

@erikschlegel erikschlegel left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -145,7 +158,7 @@ export const Dashboard = React.createClass({
<div key={'locations'} className="doughnutChart">
<GraphCard cardHeader={cardHeader}>
<PopularLocationsChart
mainEdge={this.state.categoryValue["name_"+this.state.language]}
mainEdge={this.getMainEdge()}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you're going to run into translation issues here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The method this delegates to already takes care of localization :)

getMainEdge() {
  if (!this.state.categoryValue) {
    return undefined;
  }

  return this.state.categoryValue[`name_${this.state.language}`] || this.state.categoryValue.name;
}

@c-w c-w merged commit 71f8dc9 into master Aug 9, 2017
@c-w c-w deleted the dashboard-extract-shared branch August 9, 2017 19:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants