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

Feature/dynamic preferences #1167

Merged
merged 39 commits into from
Apr 29, 2021
Merged

Feature/dynamic preferences #1167

merged 39 commits into from
Apr 29, 2021

Conversation

dominikx96
Copy link
Collaborator

@dominikx96 dominikx96 commented Apr 23, 2021

Closes: #1130

@dominikx96 dominikx96 requested a review from slowbot April 23, 2021 14:13
@dominikx96 dominikx96 self-assigned this Apr 23, 2021
@dominikx96 dominikx96 added the wip This PR is not ready for review, do not review it's a “Work In Progress” label Apr 23, 2021
@exygy-dev exygy-dev temporarily deployed to bloom-refere-feature-dy-py2wdr April 23, 2021 14:13 Inactive
Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

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

There are accessibility issues in these changes.


return (
<>
<Select

This comment was marked as resolved.

@kathyccheng
Copy link
Collaborator

@dominikx96 how about /preferences/all?

@exygy-dev exygy-dev temporarily deployed to bloom-refere-feature-dy-lltdck April 27, 2021 16:59 Inactive
Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

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

👏 You fixed the issue(s)! Great work.

@exygy-dev exygy-dev temporarily deployed to bloom-refere-feature-dy-wd4cth April 28, 2021 07:07 Inactive
Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

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

👏 You fixed the issue(s)! Great work.

@exygy-dev exygy-dev temporarily deployed to bloom-refere-feature-dy-7odust April 28, 2021 07:12 Inactive
Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

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

👏 You fixed the issue(s)! Great work.

@netlify
Copy link

netlify bot commented Apr 28, 2021

Deploy preview for clever-edison-cd22c1 ready!

Built with commit 5dc694c

https://deploy-preview-1167--clever-edison-cd22c1.netlify.app

@dominikx96
Copy link
Collaborator Author

The Netlify errors are showing this btw:

Error: Export encountered errors on following paths:
5:27:14 AM: 	/applications/preferences/displaced
5:27:14 AM: 	/es/applications/preferences/displaced
5:27:14 AM: 	/vi/applications/preferences/displaced
5:27:14 AM: 	/zh/applications/preferences/displaced
5:27:14 AM:     at exportApp (/opt/build/repo/node_modules/next/dist/export/index.js:25:1103)
5:27:14 AM:     at processTicksAndRejections (internal/process/task_queues.js:97:5)
5:27:14 AM: error Command failed with exit code 1.

Thanks! I forgot to delete the old preference page from the next config, now netlify deploy is working!

@exygy-dev exygy-dev temporarily deployed to bloom-refere-feature-dy-jyjwge April 28, 2021 07:44 Inactive
Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

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

👏 You fixed the issue(s)! Great work.

@exygy-dev exygy-dev temporarily deployed to bloom-refere-feature-dy-vaopzy April 28, 2021 08:11 Inactive
Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

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

👏 You fixed the issue(s)! Great work.

@exygy-dev exygy-dev temporarily deployed to bloom-refere-feature-dy-vuwwki April 28, 2021 09:18 Inactive
Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

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

👏 You fixed the issue(s)! Great work.

@dominikx96
Copy link
Collaborator Author

I also fixed tests to fetch listing with at least 2 preferences to test every step without fail :)

Copy link
Collaborator

@jaredcwhite jaredcwhite 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! Lots of moving parts here. I just had a few comments, mostly around making things easier to scan/maintain.

conductor.routeToNextOrReturnUrl()
}

const buildOptionName = useCallback((metaKey: string, option: string) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we take this out of a React callback and move it up somewhere as just a regular function? From what I can tell it doesn't require anything React-specific.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure thing! I noticed, I can move it to the preference helper and share between public and partners forms :)


const watchPreferences = watch(allOptionFieldNames)

function uncheckPreference(metaKey: string, options: FormMetadataOptions[]) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

use the const fnNane = arrow syntax for consistency?

const hhMmembersOptions = useMemo(() => {
const { applicant } = application

const primaryApplicant = (() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm finding it hard to follow here why an IIFE inside of a useMemo is required? Can we simplify the pattern?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I used IIFE because we have conditions and some logic inside, so it prevents the use of let and I think it's more readable and it creates scope for primaryApplicant.

/*
Rehydration fix
*/
const [hasMounted, setHasMounted] = useState(false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Take a look at the OnClientSide hook—it's a way of doing this we've used before because of the weird form hydration issues

children: React.ReactChild
}

const ExpandableContent = ({ children }: ExpandableContentProps) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I realize this is sort of based on code I'd added in the previous preferences pages…but looking at this fresh I'm wondering if we can refactor to use a simple details/summary markup in the HTML directly. Prior art in the WhatToExpect component. Thoughts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm, we can - but here we have two different labels: read less / read more.
We can create a listener to watch this state and show the proper label, but I'm not sure which one is simpler in this case :D

Also - this solution is open e.g for animation in the future 💅

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good point. Maybe we can take a second look at this later on and see if it's something to standardize on for all the read more/less instances around the codebase.

@exygy-dev exygy-dev temporarily deployed to bloom-refere-feature-dy-eu2hw9 April 29, 2021 08:32 Inactive
Copy link

@accesslint accesslint bot left a comment

Choose a reason for hiding this comment

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

👏 You fixed the issue(s)! Great work.

@dominikx96 dominikx96 merged commit 0735935 into master Apr 29, 2021
@adriencyberspace adriencyberspace mentioned this pull request Apr 27, 2022
20 tasks
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.

Refactor front end to support preferences that are different from one application to the next
7 participants