-
Notifications
You must be signed in to change notification settings - Fork 2
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
refactor: naics UI improvements #1565
Conversation
dleard
commented
Mar 25, 2021
- More descriptive language in the delete confirmation dialog
- Two action buttons for clarity: "Delete" (red) and "Cancel" ('secondary' dark grey)
- Acronyms like NAICS should be capitalized ("New Naics Code" button -> "New NAICS Code")
- When a new code is added, on re-opening the New dialog again to add a subsequent one, the form validation styles should be cleared (not showing red/green).
- Warning & block mutation when adding a NAICS code that already exists AND is currently active (follow the pattern: delete -> re-add)
let codeExists = false; | ||
query.allNaicsCodes.edges.forEach((edge) => { | ||
if (edge.node.naicsCode === naicsCode) { | ||
codeExists = true; | ||
} | ||
}); | ||
return codeExists; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use some(...)
, it returns on the first found occurrence instead of looping through the entire array
let codeExists = false; | |
query.allNaicsCodes.edges.forEach((edge) => { | |
if (edge.node.naicsCode === naicsCode) { | |
codeExists = true; | |
} | |
}); | |
return codeExists; | |
return query.allNaicsCodes.edges.some((edge) => | |
edge.node.naicsCode === naicsCode | |
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's looking great! However while the below is no longer an issue, the red/green validation doesn't seem to be happening at all anymore 🤔
When a new code is added, on re-opening the New dialog again to add a subsequent one, the form validation styles should be cleared (not showing red/green).
5bef8e0
to
efd556d
Compare
efd556d
to
111fe11
Compare