Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Get location #148

Merged
merged 6 commits into from
Jul 16, 2017
Merged

Get location #148

merged 6 commits into from
Jul 16, 2017

Conversation

wbprice
Copy link
Member

@wbprice wbprice commented Jul 5, 2017

Expects an environment variable GOOGLE_API_KEY to be defined.

Solves #137 #138 #139. Moving to the next page (Select a survey) is not implemented here.

@wbprice wbprice requested review from qwo and ttavenner July 5, 2017 23:23
const address = JSON.stringify(request.query.address);

fetch(`${geocodingUrl}?address=${address}&key=${GOOGLE_API_KEY}`)
.then((response) => response.json())
Copy link
Member

Choose a reason for hiding this comment

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

parens superfluous on single param arrow functions

Copy link
Member Author

Choose a reason for hiding this comment

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

The style guide doesn't have an opinion on this.


Hr.propTypes = {
label: PropTypes.string,
color: PropTypes.string
Copy link
Member

Choose a reason for hiding this comment

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

color is not used at all in this component

Copy link
Member Author

Choose a reason for hiding this comment

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

The goal was that the developer could change the color of the HR where needed. I'll update the PR.

<TextField
label="Locate Using Address"
name="address"
value={this.state.value}
Copy link
Member

Choose a reason for hiding this comment

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

is this implicitly the state or are we setting an object 'value'

Copy link
Member Author

Choose a reason for hiding this comment

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

This works (because JavaScript), but it we should be setting this.state.address instead.

@@ -24,12 +31,14 @@ class Home extends Component {
}

Home.propTypes = {
user: PropTypes.object
user: PropTypes.object,
Copy link
Member

Choose a reason for hiding this comment

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

how is user passed into this component? unclear after looking at top level routes.

https://github.com/wbprice/okcandidate-platform/blob/f8a167ce5dafb941157062f952b18142153ff84d/frontend/js/routes.js

Copy link
Member Author

Choose a reason for hiding this comment

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

It would be coming from the global store through connect at the bottom of Home.js (or any other environment). What user is doing isn't well defined yet, so I'll remove it for now.

{this.props.label}
</label>
}
<div className={`text-field-input ${this.props.button && 'has-button'}`}>
Copy link
Member

Choose a reason for hiding this comment

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

we've declared this.props.button as an element type but using it in this context as a string, what happens? would be serializing the elm?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is checking to see if this.props.button is truthy, and if so it returns the string has-button.

}
// If there are multiple results
else if (response.results.length > 1) {
// TODO
Copy link
Member

Choose a reason for hiding this comment

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

pick the first was always fine before but can see if you wanted to display these in a a dropdown ux...

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's open a separate issue for that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Opened #150

});
case GET_LOCATION_BY_GPS_FAILURE:
return Object.assign({}, state, {
status: {
Copy link
Member

Choose a reason for hiding this comment

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

d this need a isFetching prop also?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch.

@rydente
Copy link
Collaborator

rydente commented Jul 7, 2017

@wbprice what issue does this refer to? Also, I see this deals with configuration, maybe @BretFisher and you should get together with this on his Docker changes?

@wbprice
Copy link
Member Author

wbprice commented Jul 7, 2017

@ryayak1460 Addresses #137, #138, and #139. #147 introduces some changes to how we treat environment variables. If that gets merged before this one, I'll update this PR.

@qwo qwo merged commit ecc100e into Code4HR:develop Jul 16, 2017
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.

3 participants