-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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. 🚨 |
apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx
Outdated
Show resolved
Hide resolved
apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx
Outdated
Show resolved
Hide resolved
apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx
Outdated
Show resolved
Hide resolved
apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Signature
and detailed recipient information (name
,signingStatus
) in thegetFieldsForDocument
function 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 theDocumentPendingFields
component.The component is well-designed with clear separation of concerns. The use of
useState
to manage the visibility of fields and thehandleHideField
method to update this state are appropriate. The rendering logic insideElementVisible
is clean, and the use ofPopoverHover
andAvatar
components 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
DocumentPendingFields
for displaying pending fields based on the document status is well executed. The use ofPromise.all
to fetch recipients and fields concurrently is efficient and improves page load performance. The filtering logic to separate pending and completed fields based on theSigningStatus
is 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
form
element. 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 ofsigningStatus
in 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
EyeOffIcon
andmatch
supports 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 fromCompletedField
toDocumentField
.This change aligns with the updated data handling strategy across the application, ensuring consistency in how document fields are managed.
17-17
: Approved addition ofFieldType
andSigningStatus
for enhanced field handling.Incorporating these types from
prisma/client
directly 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
form
element. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
getPendingFieldsForDocument
function inpackages/lib/server-only/field/get-pending-fields-for-document.ts
to fetch pending fields for a document.DocumentPendingFields
indocument-pending-fields.tsx
to display the pending fields with options to hide individual fields.Testing Performed
Checklist
Additional Notes
No additional notes.
Summary by CodeRabbit
New Features
Refactor
getCompletedFieldsForDocument
withgetFieldsForDocument
.DocumentReadOnlyFields
component toDocumentPendingFields
.Bug Fixes
Style