Optional fields - #435
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the grants UI to treat several previously-required fields as optional and adds a reusable label component to visually mark required inputs with a red asterisk.
Changes:
- Display “N/A” for missing due dates / estimated completion time and hide the granter contact card when absent.
- Relax client-side validation so due date, start date, estimated completion time, and granter contact are no longer always required.
- Introduce
FieldLabelto standardize required-field labeling (red asterisk) across edit forms.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/main-page/grants/grant-view/GrantView.tsx | Shows “N/A” for missing estimated completion time and conditionally renders the granter contact card. |
| frontend/src/main-page/grants/grant-view/components/GrantCard.tsx | Shows “N/A” instead of formatting a missing due date. |
| frontend/src/main-page/grants/edit-grant/EditGrant.tsx | Updates validation rules to make several fields optional. |
| frontend/src/main-page/grants/edit-grant/components/EditGrantInfo.tsx | Replaces labels with FieldLabel and marks required fields with an asterisk. |
| frontend/src/main-page/grants/edit-grant/components/EditGrantContacts.tsx | Uses FieldLabel to mark the contacts section as required. |
| frontend/src/components/FieldLabel.tsx | Adds a reusable label wrapper that can render a red required asterisk. |
Suppressed comments (1)
frontend/src/main-page/grants/edit-grant/EditGrant.tsx:100
- This validation only checks
< 0, which does not catchNaN. Because the estimated completion time input usesvalueAsNumber, clearing the field producesNaN, which will pass validation and then be serialized (often asnull) when sending the request. If the field is intended to be optional, consider modeling it asnumber | nulland explicitly mapping empty input tonull; otherwise add a finite-number check here.
if (form.estimatedCompletionTime < 0) return "Estimated completion time cannot be negative";
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
maxn990
self-requested a review
August 17, 2026 21:16
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
maxn990
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ℹ️ Issue
Closes N/A
📝 Description
Made these fields optional, as per BCAN's request:
Also added red asterisk for the required fields.
✔️ Verification
What steps did you take to verify your changes work? These should be clear enough for someone to be able to clone the branch and follow the steps themselves.
Provide screenshots of any new components, styling changes, or pages.
Test Changes
If your new feature required some test to be changed or added to fit the new functionality or changes please document these changes here.
🏕️ (Optional) Future Work / Notes
Did you notice anything ugly during the course of this ticket? Any bugs, design challenges, or unexpected behavior? Write it down so we can clean it up in a future ticket!