Improve major/minor form fields - #229
En-Natalie wants to merge 38 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
I like this change, but I hate that there is 2 functions for practically the same schema(not your fault), and different requirements. I assume these are the inconsistencies you were referring to. So if you would like, you can combine them into a single accountSchema, with all requirements from the settings schema. Then fix any code that called the old functions. This way we can get done with it all in one PR. Another option is to open another issue for this specifically.
ZeyadAbbas
left a comment
There was a problem hiding this comment.
I have left 3 comments on 3 different files, please check them and make the necessary fixes.
There was a problem hiding this comment.
This account-specific block duplicates src/lib/schemas/account.ts. Delete lines 7–51 and keep the account contract only in the account schema. This duplication was caused by the refactor changes, so not your fault.
There was a problem hiding this comment.
This file is a duplicate of src/systems/account/data/utdDegrees.ts. Delete the entire file. Caused by refactor.
There was a problem hiding this comment.
The new enum validation is only consumed by client forms. userMetadata.updateById still validates with insertUserMetadata.partial(), so a caller can submit any major or minor directly to /api/trpc. Reuse field-level major/minor schemas in the router input while preserving partial updates for username-only changes.
Description
Improves visual warnings for invalid input of major and minor on the settings and onboarding pages.
Also resolves #224 and #228.
Testing
The following can be done from both the onboarding and settings pages. While doing so, notice that the the validation updates when text is changed.
Input can be entered through only typing, typing then selecting a dropdown, or only selecting a dropdown. Text can be deleted by manually backspacing or by pressing the x.
I probably missed testing something because I haven't tested all ~27ish combinations (depending on what you count to be a distinct combination) systematically, but surely everything works.
AI Disclosure
Not used.
Checklist