Skip to content

Community create group#678

Open
bavjean wants to merge 66 commits intodevelopfrom
community-create-group
Open

Community create group#678
bavjean wants to merge 66 commits intodevelopfrom
community-create-group

Conversation

@bavjean
Copy link
Copy Markdown
Contributor

@bavjean bavjean commented Jul 13, 2020

Probably want to redirect to the view-group page but don't think that has been implemented yet.

Could use some css, and a better button to link to the page.(unsure best place to put it, so I just stuck it in the community join group page)

  • Any known bugs/strange behavior:

  • Is there specific feedback you would like on these changes
    I still need to add the things I mentioned above, mostly just wanted to get some feedback in case I need to change anything major.

I was originally using the form from the onboarding page(FilterSettingsForm) since it was exactly what I was trying to do, but realized the back end does not support interests within the group model. After considering changing the model, I decided it wouldn't make a whole lot of sense to include interests with this since the location and title should be enough to determine if the user wants to join.

  • Screenshot(s):

bavjean and others added 30 commits July 2, 2020 15:40
…tform/CoTrip into community-group-page-detail
@bavjean bavjean requested a review from Underwaterr July 14, 2020 13:04
Copy link
Copy Markdown
Contributor

@0xZakk 0xZakk left a comment

Choose a reason for hiding this comment

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

@bavjean This is a great start! See my comments to your code, as well as my notes below.

This is what I see when I go to create a group:

Screen Shot 2020-07-14 at 10 29 43 AM

There are a couple of things you can do to really improve this form:

  • Put a max-width on the container or wrap it somehow. Use your best judgement, but it probably shouldn't be much wider than like 500px.
  • Put some space between the inputs
  • Add labels to the inputs (in addition to the placeholder text)
  • Give the form a title
  • Make the button more visible. Buttons shouldn't be full width, instead have it be the width of the text with some padding and have it justified to the left.

This is a great resource on building forms: https://www.carbondesignsystem.com/patterns/forms-pattern

<div>
<header className="CommunityPage__header">
Groups in WASHINGTON, DC: <a href="./view-group"> View Sample Page </a>
Groups in WASHINGTON, DC: <a href="./view-group"> View Sample Page </a><a href="./create-group">Create Group</a>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You can remove the sample page link, since the group pages should now link to groups!

Comment on lines +26 to +37
submit = () => {
console.log(this.state);
axios({
method: 'POST',
url: `${BASE_URL}/groups`,
data: {
title: this.state.title,
description: this.state.description,
location: this.state.location
}
})
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All ajax requests should go in a service in the services/ directory

Comment on lines +43 to +48
getUSStates = () => {
axios.get(`${BASE_URL}/location/states`).then(res => {
console.log(res.data);
this.setState({ USStates: res.data });
});
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This should also be in a service

Comment on lines +50 to +68
getCitiesFromState = event => {
if (event.target.textContent === "") this.setState({ stateFound: false });

let USStates = this.state.USStates;

//TextContent because materialUI outputs an <li> tag
let userSubmission = event.target.textContent.toLowerCase();

USStates.forEach(state => {
if (state.name.toLowerCase() === userSubmission) {
axios.get(`${BASE_URL}/location/bystate?state__code=${state.code}`).then(res => {
this.setState({
stateFound: true,
currentStateCities: res.data
});
});
}
});
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is going to be a lot of ajax requests - maybe we can load the cities once the state is selected, like we do on the account creation flow?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I used the account creation flow to do this part. I thought that with the conditional there it will wait to find a match for a valid state before loading the cities.


let userSubmission = event.target.textContent.toLowerCase();

// for(let i=0;i<currentStateCities.length)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Always delete commented out code!


setLocationID = event => {
let currentStateCities = this.state.currentStateCities;
// console.log(currentStateCities);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Delete commented out code and always remove any console.log statements

Comment on lines +92 to +110
binarySearch = (cities, userSubmission, start, end) => {
// Base Condition
if (start > end) return false;

// Find the middle index
let mid = Math.floor((start + end) / 2);

// Compare mid with given key x
if (cities[mid].name.toLowerCase() === userSubmission)
return { found: true, location: cities[mid] };

// If element at mid is greater than x,
// search in the left half of mid
if (cities[mid].name.toLowerCase() > userSubmission)
return this.binarySearch(cities, userSubmission, start, mid - 1);
// If element at mid is smaller than x,
// search in the right half of mid
else return this.binarySearch(cities, userSubmission, mid + 1, end);
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There has to be a better way to do this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the only part I have not had time to mess with yet, this also came from the account creation flow.

return (
<div className="CommunityPage">
<Banner background={Banner__Community}>
<div className="community-page-header">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use the CSS naming convention in the documentation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

*For all your CSS class names

@bavjean bavjean requested a review from 0xZakk July 15, 2020 00:44
Copy link
Copy Markdown
Contributor

@0xZakk 0xZakk left a comment

Choose a reason for hiding this comment

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

Merge #654 and test everything out

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.

4 participants