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

Added users backend and fetched them in the dropdown #38

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

girijaasoni
Copy link
Owner

No description provided.

@girijaasoni girijaasoni requested a review from Ron-Lavi January 24, 2023 16:34
This was linked to issues Jan 24, 2023
@girijaasoni girijaasoni changed the title created basic few users and fetched them in the dropdown Added users backend and fetched them in the dropdown Jan 24, 2023
@Ron-Lavi
Copy link
Collaborator

Hey @girijaasoni, I created a PR to better test our frontend code in #42
and also fixed the warnings there. Now going to rebase your PR.

@Ron-Lavi
Copy link
Collaborator

sorry, wrong push 🤣 but now it's rebased

Copy link
Collaborator

@Ron-Lavi Ron-Lavi left a comment

Choose a reason for hiding this comment

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

Nice work @girijaasoni !
one concern is that we save the Article.creator as a string nor as a reference to the User model.

Comment on lines +44 to +45
{users.map((user) => (
<DropdownItem key="group 1 action" component="button">
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you use the user.id as a key?

currently there's an error:

Warning: Each child in a list should have a unique "key" prop.

const handleChange = (value, key) => {
setData({
...data,
[key]: value
});
};
const onToggle = (isDropdownOpen) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

as a convention, in Foreman we use 'handleToggle' instead of 'onToggle'

</Button>{' '}
<PfButton
variant="link"
icon={<PlusCircleIcon />}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice! looks better.

@@ -1,4 +1,5 @@
Rails.application.routes.draw do
resources :users
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you move it below the root route?

Comment on lines +37 to +39
const onSelect = (event) => {
const value = event.target.innerHTML;
setSelectedUser(value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

instead of passing the string value of the user name,
can you pass the ID of the user? and also link in the database the Article.creator to User?

Comment on lines +37 to +39
const onSelect = (event) => {
const value = event.target.innerHTML;
setSelectedUser(value);
Copy link
Collaborator

Choose a reason for hiding this comment

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

instead of passing the string value of the user name,
can you pass the ID of the user? and also link in the database the Article.creator to User?

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.

Add User's drop down Create backend for users
2 participants