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

Create modal form for user story. #240

Merged
merged 2 commits into from
Dec 9, 2021
Merged

Conversation

hlavu
Copy link
Contributor

@hlavu hlavu commented Dec 5, 2021

Here are some tasks I have done to fix #232 :

  • create a modal form for user story
  • fields should have title, description, location( using react-country-region-selector)
  • check that the fields are not empty
  • post valid story to the table stories using react-supabase
  • display any errors for the user
  • use a spinner when posting the data you could use FetchingButton.jsx in layout
  • success should close the modal
  • have the option to reset fields
  • be sure to clear the fields after closing the modal
  • write some tests

Please take a look and give me some suggestion.

@netlify
Copy link

netlify bot commented Dec 5, 2021

👷 Deploy request for pawternityhub pending review.
Visit the deploys page to approve it

🔨 Explore the source changes: beb6673

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Don't forget to link the issues and a screenshot (if possible) of the work. If you are having errors related to formatting, run yarn format.

Copy link
Owner

@redxzeta redxzeta left a comment

Choose a reason for hiding this comment

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

alright good work so far. sorry about the db issues. just need to fix some issues and use the components from react-bootstrap and react-supabase to make things easier.

src/components/stories/Stories.jsx Outdated Show resolved Hide resolved
src/components/stories/Stories.jsx Outdated Show resolved Hide resolved
src/components/stories/Stories.jsx Outdated Show resolved Hide resolved
src/components/stories/Stories.jsx Outdated Show resolved Hide resolved
src/components/stories/Stories.jsx Outdated Show resolved Hide resolved
src/components/stories/Stories.jsx Outdated Show resolved Hide resolved
Comment on lines 20 to 37
label {
font-weight: bold;
margin: 0.5em 0em 0.3em 0em;
}
input,
textarea,
.country,
.region {
border: solid 0.5px #000;
border-radius: 4px;
padding: 0.3em;
}
input,
textarea {
display: block;
width: 100%;
}
textarea {
Copy link
Owner

Choose a reason for hiding this comment

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

double check if it affected the other forms or inputs in the site

</Modal.Header>
<Modal.Body>
<div className="formContainer">
<form onSubmit={handleSubmit(onSubmit)}>
Copy link
Owner

Choose a reason for hiding this comment

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

use the Form component from react-bootstrap

src/components/stories/Stories.jsx Outdated Show resolved Hide resolved
@hlavu
Copy link
Contributor Author

hlavu commented Dec 9, 2021

Hi @redxzeta, I have modified the code based on your suggestions, please take a look and let me know if you want any change. Thanks a lot.

Copy link
Owner

@redxzeta redxzeta left a comment

Choose a reason for hiding this comment

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

Awesome changes :)

Just one minor small fix

Comment on lines 53 to 55
<Button className="story_btn" onClick={handleShow}>
Create your Story
</Button>
Copy link
Owner

Choose a reason for hiding this comment

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

Show this button to only logged in users.

Show a button with a link to the login page so users can login

package.json Outdated
"react-dom": "^17.0.0",
"react-hook-form": "^7.20.5",
Copy link
Owner

Choose a reason for hiding this comment

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

hmm are you still using this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh right, I forgot to uninstall it.

Copy link
Owner

@redxzeta redxzeta left a comment

Choose a reason for hiding this comment

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

Just one more minor fix

)}
{!user && (
<Button className="story_btn" as={Link} to={"/login"}>
Create your Story
Copy link
Owner

Choose a reason for hiding this comment

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

Login

if you want you could user ternary operator

@redxzeta redxzeta linked an issue Dec 9, 2021 that may be closed by this pull request
10 tasks
@redxzeta redxzeta merged commit 66489fa into redxzeta:paw-dev Dec 9, 2021
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.

create modal form for user story
2 participants