Skip to content

Optional fields - #435

Merged
maxn990 merged 3 commits into
mainfrom
optional-fields
Aug 17, 2026
Merged

Optional fields#435
maxn990 merged 3 commits into
mainfrom
optional-fields

Conversation

@lyannne

@lyannne lyannne commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

ℹ️ Issue

Closes N/A

📝 Description

Made these fields optional, as per BCAN's request:

  • due date
  • start date
  • estimated completion time
  • granter contact information

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!

Copilot AI lite review requested due to automatic review settings August 17, 2026 19:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 FieldLabel to 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 catch NaN. Because the estimated completion time input uses valueAsNumber, clearing the field produces NaN, which will pass validation and then be serialized (often as null) when sending the request. If the field is intended to be optional, consider modeling it as number | null and explicitly mapping empty input to null; 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.

Comment thread frontend/src/main-page/grants/grant-view/GrantView.tsx
Comment thread frontend/src/main-page/grants/edit-grant/EditGrant.tsx
@maxn990
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
maxn990 merged commit 7133b0e into main Aug 17, 2026
1 check passed
@maxn990
maxn990 deleted the optional-fields branch August 17, 2026 21:20
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