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

Add multiselect projects field to state calculator #21

Merged
merged 24 commits into from
Oct 2, 2023

Conversation

ayangster
Copy link
Contributor

Added a multiselect option for the interested projects field in the state calculator, leveraging shoelace (https://shoelace.style/components/select).

ayangster and others added 9 commits September 15, 2023 14:45
## Description

This implements most of the spec'd design. There are some significant
pieces still missing. They're tracked in Asana, but just as a summary:

- Multiple selection of projects.

- Adding authority logos to the bottom of the page.

- Handling the case of entering a location outside RI.

- Adding an optional email field for people to join the mailing list.

In addition, there are some more pieces missing before this frontend
is ready to replace the existing IRA calculator wholesale:

- Spanish localization

- Analytics

- Appearance customizability via CSS

### Guide to new code

- New .html page for the RI calculator, which pretty much just has the
  embed. It's included in the Parcel targets, which means it will be
  built and deployed. It's not ready for the public yet, so it uses a
  meta tag to disable search engine indexing.

- `state-calculator.ts` is the custom HTML element. This contains all
  the state management.

- `state-incentive-details.ts` is the view layer.

  - A couple of sub-parts are factored out: `utility-selector.ts` and
    `icon-tab-bar.ts`.

- `calculator-types-v1.ts` corresponds to the shape of the API
  responses. This is manually maintained right now, not generated
  from the API in any way; eventually it'd be good to change that.

- `projects.ts` has icons and labels for the various projects.

## Test Plan

- Enter a RI zip code. 02807 for Block Island, 02861 for Providence
  (RI Energy only), 02814 for Pascoag (RIE and PUD available).

- Fill in the rest of the form, click Calculate. Look at results. In
  the 02814 case, switch to the other utility and make sure the
  incentives reload.

- Click the pill buttons to switch projects.

- Click the "Learn more" / "Visit site" buttons.

Resize the window to look at the three possible layouts. (1, 2, or 3
columns of incentive cards.)
@vercel
Copy link

vercel bot commented Sep 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
embed-rewiringamerica-org ✅ Ready (Inspect) Visit Preview Oct 2, 2023 6:14pm

@RandomEtc
Copy link
Member

I noticed that the select stays focused if I hit tab, even though the next field appears to be focused if I hit enter then one of the multiselect items gets toggled. I can't reproduce this on the shoelace docs. It could be something to do with our zip code field? Or it could be a missing event handler?

Screenshot 2023-09-21 at 4 17 49 PM

Base automatically changed from owen/rhode-island to main September 26, 2023 16:40
Copy link
Member

@oyamauchi oyamauchi left a comment

Choose a reason for hiding this comment

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

From playing with the Vercel preview I think this is in a good state, but could you do a rebase / resolve conflicts? The diff now shows a bunch of changes from me landing the RI work on main.

@ayangster
Copy link
Contributor Author

ayangster commented Oct 2, 2023

I noticed that the select stays focused if I hit tab, even though the next field appears to be focused if I hit enter then one of the multiselect items gets toggled. I can't reproduce this on the shoelace docs. It could be something to do with our zip code field? Or it could be a missing event handler?

Screenshot 2023-09-21 at 4 17 49 PM

@RandomEtc I have fixed this behavior so that if you hit tab on the open multiselect, it closes the dropdown but stays focused on the select and if you hit tab again it moves on to the next box (the zip).

@ayangster
Copy link
Contributor Author

From playing with the Vercel preview I think this is in a good state, but could you do a rebase / resolve conflicts? The diff now shows a bunch of changes from me landing the RI work on main.

@oyamauchi Did a rebase, please take a look again!

@RandomEtc
Copy link
Member

@RandomEtc I have fixed this behavior so that if you hit tab on the open multiselect, it closes the dropdown but stays focused on the select and if you hit tab again it moves on to the next box (the zip).

Nice! Looks good to me.

@oyamauchi oyamauchi mentioned this pull request Oct 2, 2023
Copy link
Member

@oyamauchi oyamauchi left a comment

Choose a reason for hiding this comment

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

Behavior seems right from playing with the preview, so let's do it!

(Side note: it's wild to me that you had to go to all that effort to get the focus behavior right... I really wonder why we're not getting this behavior out of the box)

@ayangster ayangster merged commit 6d29646 into main Oct 2, 2023
1 check passed
@ayangster ayangster deleted the project-multiselect branch October 2, 2023 19:29
@ayangster
Copy link
Contributor Author

Behavior seems right from playing with the preview, so let's do it!

(Side note: it's wild to me that you had to go to all that effort to get the focus behavior right... I really wonder why we're not getting this behavior out of the box)

Yeah, I asked the Shoelace creator about it and he said that the default behavior should be what I've corrected it to. I suspect there might be some tricky nuance in how shoelace elements interact with native html elements.

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.

3 participants