Observation form UX improvements#1079
Conversation
|
@Rory-Sullivan that looks pretty dang good! I'm excited to play with it in Preview. I might trim a few things but excited to test first! |
| // it from top margin of the HStack to stop the first row of buttons from being offset down. | ||
| const rowMargin = 5; | ||
|
|
||
| let isQuickPick = false; |
There was a problem hiding this comment.
I would change this to make it a State and call it something like isQuickPickSelected and have it updated in the quickPickSelectionHandlers. It makes it more clear what it's controlling and that it's updating the state of something
There was a problem hiding this comment.
For this one I decided to make isQuickPickSelected a memoized value that gets updated when the field value changes. Making it a state value and trying to update that from the selection handler is a little tricky because the user is able select one of the quick pick dates from the generic date selector. Happy to discuss this more though if you have particular thoughts on it.
There was a problem hiding this comment.
I didn't explain the whole thing super well at all, but I was thinking that in quickPickSelectionHandler you would be able to set isQuickPickSelected to true without doing any checks and then in onDateSelected you could do the check to see if the date that was selected also is a quick pick date.
The useMemo seems fine too. Definitely not a blocker
|
It doesn't have to be a part of this PR, but if these changes are added to the |
| placeholder: 'Describe the location of the avalanche.', | ||
| multiline: true, | ||
| }} | ||
| required |
There was a problem hiding this comment.
I found that there's a preexisting bug here that allows users to save the avalanche without setting the location field. I'll open an issue on myself to fix this once this code gets checked in
There was a problem hiding this comment.
Yeah the behavior of this one is a little weird and I am not entirely sure what is going on.
- Add ButtonSelectField component for quick selects - Convert aspect and avalanche size fields to button select
- Add ButtonSelectDateField component for quick selects of dates - Convert date field to button select
Updates the format function used to display the date of an avalanche. The avalanche date field is sent from the backend without time or timezone information, so when it is converted to UTC then back to a local date it is off by one day. Renames a function that is used to convert observation start dates to a local date string to make it more generic.
…rm (NWACus#961) - Update button select component to have an optional select dropdown for cases with many items. - Update trigger field on avalanche submission form to have quick select items and dropdown select.
96515c0 to
d3674ed
Compare
- Add 'other' text to general date picker - Fix bug that clears date selection when there is a preset value - Memoize is quick pick selected variable
- Create new FieldLabel component - Use new component in various Field components
Move help text to helpStrings.ts file.
Update trigger quick pick items to map of schema items instead of hard coded list.
I have merged the |
Remove '2 days ago' from quick pick date items.
|
Latest change also removes '2 days ago' from the quick pick date items per a request on Slack. |
components/form/SelectField.tsx
Outdated
| interface HelpText { | ||
| title: string; | ||
| contentHtml: string; | ||
| } |
There was a problem hiding this comment.
Nit: This can be removed since it's in FieldLabel
There was a problem hiding this comment.
Good catch, I removed this.
kevinherdez
left a comment
There was a problem hiding this comment.
Looks good! I tested it locally and it seems to be working great.

This PR is currently focused on the avalanche observation form, though I expect we may want to roll some changes into the observation form as well. It addresses the following issues;
InfoTooltipcomponent that is is used for things like the help text on danger ratings in the observation detail view. @rustynwac you mentioned doing some design work on this item, I'm super happy to adjust this to whatever comes out of that, I just took the path of least resistance to get this functionality in there.From a technical perspective this PR adds two new components
ButtonSelectFieldandButtonSelectDateField.ButtonSelectFieldis very similar to theSelectFieldcomponent but it adds the ability to have quick select items as well as the drop down select. The main limitation to theButtonSelectFieldcomponent overSelectFieldis that it does not support multi-select fields.ButtonSelectDateFieldadds quick pick items to a date selector.It also adjusts existing field components to improve the visibility of required fields and errors.