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

Updated Domestic/Foreign toggle to affect summary results #30

Merged
merged 9 commits into from
Jan 11, 2017

Conversation

Bray-Michael-bah
Copy link
Contributor

No description provided.

@@ -51,7 +51,7 @@ export default class LocationList extends Typeahead {
this.typeahead.list = this.props.autocompleteLocations;

this.props.autocompleteLocations.forEach((value) => {
let key = `<strong>${value.place}</strong><br>${_.upperCase(value.place_type)}`;
let key = `<b>${value.place}</b><br>${_.upperCase(value.place_type)}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to approach this a different way than having HTML in the autocomplete list:
screen shot 2017-01-09 at 11 50 38 am

screen shot 2017-01-09 at 11 51 32 am

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressing this in a new story, since this will affect several filters

@@ -14,7 +14,8 @@ const initialState = {
timePeriodFY: new Set(),
timePeriodStart: null,
timePeriodEnd: null,
selectedLocations: new Set()
selectedLocations: new Set(),
locationDomesticForeign: ''
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the default be all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, added

{selectedLocations}
</div>
);
}
}

export default connect(
Copy link
Contributor

Choose a reason for hiding this comment

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

This is now a container, not a component. The container-related code (anything that has to do with API calls or manipulating data that's not directly display-related) needs to be moved to its parent container (LocationSearchContainer). Components are not allowed to be connected to Redux directly.

Please refactor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this all back to LocationListContainer

super(props);

this.state = {
locationOption: 'all',
Copy link
Contributor

Choose a reason for hiding this comment

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

Since Redux now tracks the locationDomesticForeign value, the autocomplete location scope should be controlled by Redux (ie, read from the props, write via the action rather than maintain its own state).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

placeHolder="State, City, County, ZIP, or District"
ref={(input) => {
this.locationList = input;
}} />
);
}

}

Copy link
Contributor

Choose a reason for hiding this comment

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

Why has this container been disconnected from Redux? If a container is no longer required, delete the entire file and just use the child component. However, remember that components should be dumb, in other words they do not directly make API calls, they only perform logic related to display and layout.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved Redux implementation back to this container

… radio button labels, handled country selection toggle completely through Redux instead of a component state, set default option for locationDomesticForeign
@kevinli-work kevinli-work merged commit e99260d into dev Jan 11, 2017
@kevinli-work kevinli-work deleted the feature-location-filter branch January 30, 2017 22:18
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.

2 participants