Skip to content
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

feat: add visible completed fields #1109

Merged
merged 4 commits into from
Apr 25, 2024
Merged

feat: add visible completed fields #1109

merged 4 commits into from
Apr 25, 2024

Conversation

dguyen
Copy link
Collaborator

@dguyen dguyen commented Apr 18, 2024

Description

Added the ability for recipients to see fields from other recipients who have completed the document when they are signing the document

Added the ability for the document owner to see fields from recipients who have completed the field on the document page view (only visible when the document is pending)

🚨🚨 Migrations🚨🚨

  • Drop all Fields that do not have a Recipient set (not sure how it was possible in the first place)
  • Remove optional Recipient field on Field which doesn't make sense

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced document viewing by adding read-only fields based on document status.
    • Improved signing page by fetching and displaying completed fields for tokens.
    • Updated avatar component to show recipient status with tooltips for better user interaction.
  • Bug Fixes

    • Made recipientId a required field in the database to ensure data consistency.
  • Refactor

    • Optimized popover functionality in UI components for better performance and user experience.
  • Documentation

    • Added detailed component and function descriptions for new features in the system.

Copy link

vercel bot commented Apr 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
stg-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 22, 2024 6:38am
stg-marketing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 22, 2024 6:38am
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
prd-app ⬜️ Ignored (Inspect) Apr 22, 2024 6:38am
prd-marketing ⬜️ Ignored (Inspect) Apr 22, 2024 6:38am

@github-actions github-actions bot added apps: web Issues related to the webapp 🚨 migrations 🚨 labels Apr 18, 2024
Copy link
Contributor

coderabbitai bot commented Apr 18, 2024

Walkthrough

The updates across the system focus on enhancing document and signing functionalities by integrating new components and refining data interactions. Key changes include managing completed fields for documents and tokens, rendering read-only fields based on document status, and improving UI components like popovers. Additionally, database schema adjustments ensure data integrity by making certain fields mandatory.

Changes

File Path Change Summary
.../document-page-view.tsx, .../page.tsx, .../signing-page-view.tsx Enhanced handling and display of completed fields in documents and signing pages. Added DocumentReadOnlyFields component for read-only view based on document status.
.../stack-avatars-with-tooltip.tsx Refactored to use PopoverHover for better interaction and state management. Updated rendering logic based on recipient status.
.../document-read-only-fields.tsx, .../get-completed-fields-for-document.ts, .../get-completed-fields-for-token.ts, .../fields.ts Introduced DocumentReadOnlyFields component and functions to fetch completed fields from the database. Added CompletedField type definition.
.../migration.sql, .../schema.prisma Database schema updated to make recipientId a required field in the Field model.
.../popover.tsx Extended with PopoverHover component to manage popover visibility based on mouse hover, enhancing user interaction.

Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between f6e6dac and afaeba9.
Files selected for processing (1)
  • apps/web/src/components/document/document-read-only-fields.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/web/src/components/document/document-read-only-fields.tsx

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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 2

Comment on lines +41 to +49
const [document, fields, recipient, completedFields] = await Promise.all([
getDocumentAndSenderByToken({
token,
userId: user?.id,
requireAccessAuth: false,
}).catch(() => null),
getFieldsForToken({ token }),
getRecipientByToken({ token }).catch(() => null),
getCompletedFieldsForToken({ token }),
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Several files in the codebase still use the old function signature.

  • The getCompletedFieldsForToken function is used in the Promise.all array without explicit error handling attached directly to its call. This might be an oversight or a deliberate choice depending on the error handling strategy of the application. It is recommended to ensure consistency in error handling across all asynchronous operations.
Analysis chain

Added completedFields to the array of promises to fetch document-related data concurrently. Ensure that error handling is in place for this asynchronous operation.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify error handling for fetching completed fields.
rg --type ts --context 5 "getCompletedFieldsForToken" apps/web/src/app/(signing)/sign/[token]/page.tsx

Length of output: 239



Script:

#!/bin/bash
# Verify error handling for fetching completed fields.
rg --type ts --context 5 "getCompletedFieldsForToken" 'apps/web/src/app/(signing)/sign/[token]/page.tsx'

Length of output: 1454

Copy link

github-actions bot commented Apr 19, 2024

Thank you for following the naming conventions for pull request titles! 💚🚀

@ElTimuro
Copy link
Member

@dguyen should we keep the recipientless fields a bit (or at least download them) if we need the data later for debugging?

@dguyen
Copy link
Collaborator Author

dguyen commented Apr 20, 2024

@dguyen should we keep the recipientless fields a bit (or at least download them) if we need the data later for debugging?

We can't run the migration without them gone

I don't think the data is really useful, but I'll try to get a copy anyway

Copy link
Collaborator

@Mythie Mythie left a comment

Choose a reason for hiding this comment

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

im trustin ya on this one but we should revisit it later

@Mythie Mythie merged commit 0062359 into main Apr 25, 2024
14 checks passed
@Mythie Mythie deleted the feat/visible-fields branch April 25, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apps: web Issues related to the webapp 🚨 migrations 🚨
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants