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

[DUOS-1759][risk=no] Updated step selector for data access request page #1787

Merged
merged 53 commits into from
Sep 14, 2022

Conversation

lu-c
Copy link
Contributor

@lu-c lu-c commented Sep 2, 2022

Lots of ugliness in the code to accomodate keeping the existing page as it is!


Have you read Terra's Contributing Guide lately? If not, do that first.

  • Label PR with a Jira ticket number and include a link to the ticket
  • Label PR with a security risk modifier [no, low, medium, high]
  • PR describes scope of changes
  • Get a minimum of one thumbs worth of review, preferably two if enough team members are available
  • Get PO sign-off for all non-trivial UI or workflow changes
  • Verify all tests go green
  • Test this change deployed correctly and works on dev environment after deployment

lu-c and others added 25 commits August 23, 2022 23:26
… request page

- Added radio group option to forms
- Added global styles (initial start)
- Modified forms to extract some of the specific styling to the data submission form (that this page doesnt share)
Co-authored-by: Gregory Rushton <rushtong@users.noreply.github.com>
…to change the normal select so it does not allow you to add a value, but later. Moved new researcher code to the existing researcher component.
…nt to change the normal select so it does not allow you to add a value, but later
… Removed explicit creatable formfieldType - it will now create if a creatableConfig is provided, otherwise, it will not allow the user to add new fields
…DUOS-1752

# Conflicts:
#	src/components/forms/forms.css
#	src/components/forms/forms.js
…not saving value, converted input checkboxes to FormField components - will update the radio later :(
@lu-c lu-c requested a review from a team as a code owner September 2, 2022 19:35
Copy link
Contributor

@connorlbark connorlbark left a comment

Choose a reason for hiding this comment

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

the tabs themselves look good!

}
}, [
h(Tab, {
// key: `dar-request-step-1`,
Copy link
Contributor

Choose a reason for hiding this comment

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

is this comment needed? if not, maybe delete.

@lu-c lu-c changed the base branch from develop to DUOS-1752 September 6, 2022 18:38
@lu-c
Copy link
Contributor Author

lu-c commented Sep 7, 2022

sorry, didnt read the ticket thoroughly enough, will continue work on the behavior of this today (this pr just focused on the UI)

@lu-c lu-c closed this Sep 7, 2022
1. position-stickyed the step bar
2. added window eventListener to watch for changes in scroll position and select the appropriate step.
3. One hiccup was that when you clicked on a section, it would slowly scroll there in the tab selector since the onScroll would update for the current position, overtaking the default where the tab selector would immediately change, and that ~.5s delay felt realy bad... so I added a debounce manually. Tried to do it through lodash, but it wasn't working, and I wasnt sure why.
@lu-c
Copy link
Contributor Author

lu-c commented Sep 7, 2022

IT'S READY AGAIN, lots of changes this time - read the ticket more closely, this is lookin' pretty sweet ;)

@lu-c lu-c reopened this Sep 7, 2022
@@ -215,6 +230,8 @@ class DataAccessRequestApplicationNew extends Component {
prev.formData = merge(prev.formData, formData);
return prev;
});

window.addEventListener('scroll', this.onScroll);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shoot, i didnt realize codacy wouldnt like this... I don't know how to do this part of the ticket without adding an event listener though. :[ Let me brainstorm

Copy link
Contributor

Choose a reason for hiding this comment

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

If codacy is giving us false positives here, we can change that. I'm not sure what the best practice is, but codacy shouldn't be the primary roadblock.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TIL you can bypass codacy warnings by adding disabling eslint on the same lines - would this be okay? XD I guess I'll let the reviewers weigh in hehe

Copy link
Contributor

@JVThomas JVThomas Sep 12, 2022

Choose a reason for hiding this comment

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

There's nothing wrong with your function. It's a textbook definition of a debounce with a reset when the function is called repeatedly.

Codacy's issue is that it's not context aware of its warnings. Generally setTimeout is frowned upon for anything regarding data since defining a fixed time delay on async operations (where time to completion is indeterminate) can be dangerous. In this context though the UI changes are independent of anything else going on in the component, so it's not a problem.

If you care about Codacy warnings, try looking into lodash's (vanilla, not fp) debounce function and see if that does anything (though odds are it'll be doing the same things under the hood).

That said, I have no idea about eventListener warnings. If Codacy is giving you warnings about onScroll then you can ignore them.

Copy link
Contributor

@connorlbark connorlbark left a comment

Choose a reason for hiding this comment

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

This is really cool! It's very satisfying! There's some weird behavior around step 4 on my laptop (seems to prefer staying on 3 or 5) but clicking each of them works as expected and this is likely just some weirdness with heights and such.

@@ -1062,7 +1094,12 @@ class DataAccessRequestApplicationNew extends Component {
})
]),

div({ isRendered: this.state.step === 4 }, [
div({id: 'step-4', className: 'step-container'}, [
Copy link
Contributor

@JVThomas JVThomas Sep 12, 2022

Choose a reason for hiding this comment

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

You don't have to worry about the Progress Report component right now. The mocks have it set up, but we won't be implementing the feature on the back-end for a while due to Data Submitter and the DAR Form UI redesign being a higher priority.

The funky behavior in the scroll is probably because the div is so small that the typical user's scroll movement will shift this component in and out of your designated windowTop threshold during the debounce period.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok i will remove this for now

Copy link
Contributor

@JVThomas JVThomas left a comment

Choose a reason for hiding this comment

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

Overall the code looks good. I've left two comments (the Codacy related one is optional) for you to look over, but the left navbar is working smoothly.

@lu-c
Copy link
Contributor Author

lu-c commented Sep 12, 2022

This is really cool! It's very satisfying! There's some weird behavior around step 4 on my laptop (seems to prefer staying on 3 or 5) but clicking each of them works as expected and this is likely just some weirdness with heights and such.

I think this is because step 4 is literally like 30 pixels large or something, so it's really hard to catch - when this component is fleshed out and implemented, we won't see this issue anymore! :)

Base automatically changed from DUOS-1752 to develop September 14, 2022 00:49
@lu-c lu-c merged commit 875e43a into develop Sep 14, 2022
@lu-c lu-c deleted the DUOS-1759 branch September 14, 2022 01:30
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