Repository navigation
fix: show field on pending document - #1158
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe updates in this codebase primarily involve refactoring field retrieval functions and adjusting related components. The Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
|
🚨 @ephraimduncan has 4 pull requests awaiting review. Please consider reviewing them when possible. 🚨 |
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx (4 hunks)
- apps/web/src/components/document/document-pending-readonly-fields.tsx (1 hunks)
- packages/lib/server-only/field/get-fields-for-document.ts (1 hunks)
Additional comments not posted (3)
packages/lib/server-only/field/get-fields-for-document.ts (1)
29-38: Well-implemented query inclusion for recipient details in document fields.The inclusion of
Signatureand detailed recipient information (name,signingStatus) in thegetFieldsForDocumentfunction is well-aligned with the PR's objectives to enhance handling of document fields. This change supports the frontend's ability to filter and display fields based on signing status, which is crucial for the new functionality.apps/web/src/components/document/document-pending-readonly-fields.tsx (1)
19-78: Excellent implementation of theDocumentPendingFieldscomponent.The component is well-designed with clear separation of concerns. The use of
useStateto manage the visibility of fields and thehandleHideFieldmethod to update this state are appropriate. The rendering logic insideElementVisibleis clean, and the use ofPopoverHoverandAvatarcomponents enhances the user interface. This implementation aligns well with the PR's objective to allow users to interact with pending fields effectively.apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx (1)
Line range hint
89-174: Effective integration of field handling in the document page view.The integration of
DocumentPendingFieldsfor displaying pending fields based on the document status is well executed. The use ofPromise.allto fetch recipients and fields concurrently is efficient and improves page load performance. The filtering logic to separate pending and completed fields based on theSigningStatusis clear and functional. This setup ensures that the UI components receive the correct data subset to work with, which is crucial for maintaining a responsive and accurate user interface.
[APROVED]
There was a problem hiding this comment.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx (3 hunks)
- apps/web/src/components/document/document-read-only-fields.tsx (3 hunks)
- packages/lib/server-only/field/get-completed-fields-for-token.ts (1 hunks)
- packages/lib/server-only/field/get-fields-for-document.ts (2 hunks)
Files skipped from review as they are similar to previous changes (2)
- apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx
- packages/lib/server-only/field/get-fields-for-document.ts
Additional context used
Biome
apps/web/src/components/document/document-read-only-fields.tsx
[error] 71-75: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
formelement. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
Additional comments not posted (4)
packages/lib/server-only/field/get-completed-fields-for-token.ts (1)
29-29: Approved addition ofsigningStatusin the selection object.This change enhances the data retrieved by including the signing status, which is crucial for the new functionality related to handling document fields based on their signing status.
apps/web/src/components/document/document-read-only-fields.tsx (3)
5-5: Approved new imports for UI enhancements.The addition of
EyeOffIconandmatchsupports new UI functionalities, such as hiding fields and matching field types for rendering, which aligns with the PR objectives.
14-14: Approved update of type fromCompletedFieldtoDocumentField.This change aligns with the updated data handling strategy across the application, ensuring consistency in how document fields are managed.
17-17: Approved addition ofFieldTypeandSigningStatusfor enhanced field handling.Incorporating these types from
prisma/clientdirectly into the component allows for more precise control over the rendering based on the field's type and signing status.
| <button | ||
| className="absolute right-0 top-0 my-1 p-2 focus:outline-none focus-visible:ring-0" | ||
| onClick={() => handleHideField(field.secondaryId)} | ||
| title="Hide field" | ||
| > |
There was a problem hiding this comment.
Add an explicit type attribute to the button to prevent form submission issues.
The button used to hide fields should have an explicit type='button' to ensure it does not inadvertently submit forms if nested within one.
- <button
+ <button type="button"Committable suggestion was skipped due to low confidence.
Tools
Biome
[error] 71-75: Provide an explicit type prop for the button element. (lint/a11y/useButtonType)
The default type of a button is submit, which causes the submission of a form when placed inside a
formelement. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx
Description
This pull request introduces the functionality to display pending fields on the document page view. This enhancement allows users to see which fields are pending and need to be completed.
Changes Made
getPendingFieldsForDocumentfunction inpackages/lib/server-only/field/get-pending-fields-for-document.tsto fetch pending fields for a document.DocumentPendingFieldsindocument-pending-fields.tsxto display the pending fields with options to hide individual fields.Testing Performed
Checklist
Additional Notes
No additional notes.
Summary by CodeRabbit
New Features
Refactor
getCompletedFieldsForDocumentwithgetFieldsForDocument.DocumentReadOnlyFieldscomponent toDocumentPendingFields.Bug Fixes
Style