Skip to content

Create Rev79 Id input fields for Projects and Engagements#1776

Merged
rdonigian merged 3 commits intodevelopfrom
rev79-fields
Mar 4, 2026
Merged

Create Rev79 Id input fields for Projects and Engagements#1776
rdonigian merged 3 commits intodevelopfrom
rev79-fields

Conversation

@rdonigian
Copy link
Contributor

API PR: SeedCompany/cord-api-v3#3666

This adds a "uses Rev79" checkbox to the Project edit for Momentum Projects. If true, a Rev79 project id and engagement community id input will be rendered.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 2, 2026

Warning

Rate limit exceeded

@rdonigian has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 5 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 50bda57 and 4689ac0.

📒 Files selected for processing (2)
  • src/scenes/Projects/Overview/ProjectOverview.tsx
  • src/scenes/Projects/Update/UpdateProjectDialog.tsx
📝 Walkthrough

Walkthrough

Adds Rev79 support: exposes rev79CommunityId on LanguageEngagement and rev79ProjectId/usesRev79 on Project, updates GraphQL fragments, UI (DataButton/TextField/Checkbox), form initial values, and form submission handling to surface and edit these fields.

Changes

Cohort / File(s) Summary
LanguageEngagement — Edit dialog
src/scenes/Engagement/EditEngagement/EditEngagementDialog.tsx
Adds rev79CommunityId to EditableEngagementField, renders it as a TextField in fieldMapping, and includes it in initial form values and fullInitialValuesFields.
LanguageEngagement — Header fragment & UI
src/scenes/Engagement/LanguageEngagement/Header/LanguageEngagementHeader.graphql, src/scenes/Engagement/LanguageEngagement/Header/LanguageEngagementHeader.tsx
Extends header fragment with parent { usesRev79 { value } } and rev79CommunityId { canRead, canEdit, value }; conditionally renders a Rev79 DataButton when parent uses Rev79.
LanguageEngagement — Detail fragment
src/scenes/Engagement/LanguageEngagement/LanguageEngagementDetail.graphql
Adds parent { ...Id; name { value } } selection to support parent/Rev79 relationship.
Project — Overview fragment & component
src/scenes/Projects/Overview/ProjectOverview.graphql, src/scenes/Projects/Overview/ProjectOverview.tsx
Adds usesRev79 and rev79ProjectId to fragment; switches dialog generic from EditableProjectField to ProjectFieldName and conditionally renders Rev79 DataButton controls in two UI locations.
Project — Update dialog
src/scenes/Projects/Update/UpdateProjectDialog.tsx
Introduces `ProjectFieldName = EditableProjectField

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding Rev79 Id input fields to Projects and Engagements, which matches the changeset's primary objective.
Description check ✅ Passed The description is directly related to the changeset, explaining the feature addition of a Rev79 checkbox and conditional input fields for Momentum Projects.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rev79-fields

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
src/scenes/Engagement/LanguageEngagement/Header/LanguageEngagementHeader.graphql (2)

44-48: Consider fetching canRead for usesRev79 to enable permission-aware rendering.

Currently only value is fetched. If the user lacks permission to read this field, the UI won't be able to distinguish between "usesRev79 is false" and "user can't read usesRev79".

  parent {
    usesRev79 {
+     canRead
      value
    }
  }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/scenes/Engagement/LanguageEngagement/Header/LanguageEngagementHeader.graphql`
around lines 44 - 48, The GraphQL fragment currently fetches only
parent.usesRev79.value which prevents distinguishing between a false value and
lack of read permission; update the fragment to also request the permission
field (e.g., parent.usesRev79.canRead) so the UI can perform permission-aware
rendering—locate the fragment that references usesRev79 and add fetching of
canRead alongside value, then update any consuming code (renderers that read
parent.usesRev79.value) to check canRead before interpreting the value.

49-55: Redundant inline fragment.

The fragment is already defined on LanguageEngagement, so the ... on LanguageEngagement inline fragment is unnecessary.

♻️ Proposed simplification
-  ... on LanguageEngagement {
-    rev79CommunityId {
-      canRead
-      canEdit
-      value
-    }
+  rev79CommunityId {
+    canRead
+    canEdit
+    value
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/scenes/Engagement/LanguageEngagement/Header/LanguageEngagementHeader.graphql`
around lines 49 - 55, The inline fragment "... on LanguageEngagement" is
redundant because the surrounding selection is already on the LanguageEngagement
type; remove the inline fragment wrapper and place the rev79CommunityId
selection (canRead, canEdit, value) directly under the LanguageEngagement
selection so the rev79CommunityId field is selected without the unnecessary "...
on LanguageEngagement" wrapper.
src/scenes/Engagement/LanguageEngagement/Header/LanguageEngagementHeader.tsx (1)

176-189: Consider handling the case where usesRev79 is not readable.

The conditional engagement.parent.usesRev79.value accesses .value directly without checking canRead. If the user doesn't have permission to read usesRev79, this could result in rendering nothing (which may be the intended behavior) or potentially accessing an undefined value depending on how the API returns non-readable fields.

Consider adding a canRead check for defensive coding:

-        {engagement.parent.usesRev79.value && (
+        {engagement.parent.usesRev79.canRead && engagement.parent.usesRev79.value && (

Note: The Biome lint warning about children prop is a false positive here—DataButton explicitly accepts children as a prop (either a render function or ReactNode) per the component's interface in src/components/DataButton/DataButton.tsx.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/scenes/Engagement/LanguageEngagement/Header/LanguageEngagementHeader.tsx`
around lines 176 - 189, The conditional should guard reading the field by
checking read permission before accessing .value: update the condition that
currently uses engagement.parent.usesRev79.value to verify
engagement.parent.usesRev79.canRead (and then .value) so you only access the
value when readable; apply the same defensive pattern around rendering the
DataButton (which uses rev79CommunityId and show) to ensure you don't
dereference a non-readable field (leave DataButton's children usage as-is since
it's an accepted prop).
src/scenes/Projects/Update/UpdateProjectDialog.tsx (1)

88-97: Consider hiding usesRev79 when user lacks edit permission rather than showing it disabled.

The usesRev79 checkbox is disabled when !project.rev79ProjectId.canEdit, but it's still rendered. This differs from the pattern for departmentId (lines 98-102) which returns null when the user can't edit. For consistency and cleaner UX, consider not rendering the checkbox at all if the user can't edit Rev79 fields.

♻️ Proposed fix
  usesRev79: ({ project }) => (
+   !project.rev79ProjectId.canEdit ? null : (
    <CheckboxField
      name="usesRev79"
      label="Uses Rev79"
-     disabled={!project.rev79ProjectId.canEdit}
    />
+   )
  ),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/scenes/Projects/Update/UpdateProjectDialog.tsx` around lines 88 - 97, The
usesRev79 checkbox is rendered disabled when the user lacks permission but
should be hidden like departmentId; update the usesRev79 renderer (the usesRev79
function) to return null when project.rev79ProjectId.canEdit is false instead of
rendering a disabled CheckboxField, matching the departmentId pattern and
improving UX—keep the rev79ProjectId TextField behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/scenes/Projects/Overview/ProjectOverview.tsx`:
- Around line 442-454: The DataButton for the Rev79 Project ID uses the wrong
permission field: change the secured prop from project.usesRev79 to
project.rev79ProjectId so read/redaction checks use the actual field; update the
secured prop on the DataButton inside ProjectOverview (component rendering Rev79
Project ID) to reference project.rev79ProjectId (keep other props like label,
redacted, children, and onClick unchanged).

---

Nitpick comments:
In
`@src/scenes/Engagement/LanguageEngagement/Header/LanguageEngagementHeader.graphql`:
- Around line 44-48: The GraphQL fragment currently fetches only
parent.usesRev79.value which prevents distinguishing between a false value and
lack of read permission; update the fragment to also request the permission
field (e.g., parent.usesRev79.canRead) so the UI can perform permission-aware
rendering—locate the fragment that references usesRev79 and add fetching of
canRead alongside value, then update any consuming code (renderers that read
parent.usesRev79.value) to check canRead before interpreting the value.
- Around line 49-55: The inline fragment "... on LanguageEngagement" is
redundant because the surrounding selection is already on the LanguageEngagement
type; remove the inline fragment wrapper and place the rev79CommunityId
selection (canRead, canEdit, value) directly under the LanguageEngagement
selection so the rev79CommunityId field is selected without the unnecessary "...
on LanguageEngagement" wrapper.

In
`@src/scenes/Engagement/LanguageEngagement/Header/LanguageEngagementHeader.tsx`:
- Around line 176-189: The conditional should guard reading the field by
checking read permission before accessing .value: update the condition that
currently uses engagement.parent.usesRev79.value to verify
engagement.parent.usesRev79.canRead (and then .value) so you only access the
value when readable; apply the same defensive pattern around rendering the
DataButton (which uses rev79CommunityId and show) to ensure you don't
dereference a non-readable field (leave DataButton's children usage as-is since
it's an accepted prop).

In `@src/scenes/Projects/Update/UpdateProjectDialog.tsx`:
- Around line 88-97: The usesRev79 checkbox is rendered disabled when the user
lacks permission but should be hidden like departmentId; update the usesRev79
renderer (the usesRev79 function) to return null when
project.rev79ProjectId.canEdit is false instead of rendering a disabled
CheckboxField, matching the departmentId pattern and improving UX—keep the
rev79ProjectId TextField behavior unchanged.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a39ca9d and 7161983.

📒 Files selected for processing (7)
  • src/scenes/Engagement/EditEngagement/EditEngagementDialog.tsx
  • src/scenes/Engagement/LanguageEngagement/Header/LanguageEngagementHeader.graphql
  • src/scenes/Engagement/LanguageEngagement/Header/LanguageEngagementHeader.tsx
  • src/scenes/Engagement/LanguageEngagement/LanguageEngagementDetail.graphql
  • src/scenes/Projects/Overview/ProjectOverview.graphql
  • src/scenes/Projects/Overview/ProjectOverview.tsx
  • src/scenes/Projects/Update/UpdateProjectDialog.tsx

@rdonigian rdonigian requested a review from a team as a code owner March 3, 2026 18:07
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/scenes/Projects/Update/UpdateProjectDialog.tsx (1)

17-17: Use the canonical Link import path

Please import Link from ~/components/Routing/Link instead of ~/components/Routing to match the repo rule.

As per coding guidelines: "Use ~/components/Routing/Link for link components — never MUI's Link or React Router's Link directly".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/scenes/Projects/Update/UpdateProjectDialog.tsx` at line 17, The import
for Link in UpdateProjectDialog.tsx should use the canonical path; replace the
current import "import { Link } from '~/components/Routing';" with a default or
named import from '~/components/Routing/Link' so the UpdateProjectDialog
component (referencing Link) uses the repo-standard Link export instead of
importing from the barrel; update any references to Link in this file to match
the exported shape from '~/components/Routing/Link'.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/scenes/Projects/Update/UpdateProjectDialog.tsx`:
- Around line 91-97: The usesRev79 CheckboxField in UpdateProjectDialog is being
disabled via project.rev79ProjectId.canEdit but is still rendered outside the
SecuredField pattern, allowing the field to be visible/editable when permissions
differ; wrap the usesRev79 field rendering with the SecuredField component (or
conditionally render it using the same permission check) so that
CheckboxField(name="usesRev79", label="Uses Rev79") is only mounted when
project.rev79ProjectId.canEdit is true, mirroring the secured-field pattern used
elsewhere in this file.

---

Nitpick comments:
In `@src/scenes/Projects/Update/UpdateProjectDialog.tsx`:
- Line 17: The import for Link in UpdateProjectDialog.tsx should use the
canonical path; replace the current import "import { Link } from
'~/components/Routing';" with a default or named import from
'~/components/Routing/Link' so the UpdateProjectDialog component (referencing
Link) uses the repo-standard Link export instead of importing from the barrel;
update any references to Link in this file to match the exported shape from
'~/components/Routing/Link'.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7161983 and 50bda57.

📒 Files selected for processing (1)
  • src/scenes/Projects/Update/UpdateProjectDialog.tsx

Copy link
Contributor

@brentkulwicki brentkulwicki left a comment

Choose a reason for hiding this comment

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

I did not pull and test locally, but everything makes sense and I have no issues when looking at the code. ✅

@rdonigian rdonigian merged commit bb0b189 into develop Mar 4, 2026
8 checks passed
@rdonigian rdonigian deleted the rev79-fields branch March 4, 2026 14:42
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.

2 participants