Skip to content

feat: add signing link copy - #1449

Merged
dguyen merged 1 commit into
mainfrom
feat/copy-signing-links
Nov 6, 2024
Merged

dguyen merged 1 commit into
mainfrom
feat/copy-signing-links

Conversation

@dguyen

@dguyen dguyen commented Nov 6, 2024 •

Copy link
Copy Markdown
Collaborator

Description

Add more options to copy signing links.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new dialog for copying signing links, enhancing document sharing capabilities.
    • Added clearer recipient status indicators, improving user interface and feedback.
    • Implemented a new button component for copying text with visual feedback.
  • Bug Fixes

    • Preserved error handling during document download processes.
  • Documentation

    • Updated components to improve clarity and maintainability.
  • Chores

    • Added utility functions and hooks to support new features.

@vercel

vercel Bot commented Nov 6, 2024 •

Copy link
Copy Markdown

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

Name Status Preview Comments Updated (UTC)
prd-openpage-api ❌ Failed (Inspect) Nov 6, 2024 0:12am
stg-marketing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 0:12am
5 Skipped Deployments
Name Status Preview Comments Updated (UTC)
prd-app ⬜️ Ignored (Inspect) Nov 6, 2024 0:12am
prd-docs ⬜️ Ignored (Inspect) Nov 6, 2024 0:12am
prd-marketing ⬜️ Ignored (Inspect) Nov 6, 2024 0:12am
stg-app ⬜️ Ignored (Inspect) Visit Preview Nov 6, 2024 0:12am
stg-docs ⬜️ Ignored (Inspect) Nov 6, 2024 0:12am

@coderabbitai

coderabbitai Bot commented Nov 6, 2024 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes in this pull request introduce several enhancements across multiple components related to document management. A new DocumentRecipientLinkCopyDialog component is added to facilitate sharing signing links. Modifications include the introduction of a state variable to track document status, conditional rendering of UI elements based on permissions and document states, and improved user feedback mechanisms. The updates aim to provide clearer recipient status indicators and enhance the overall functionality of document actions within the dropdown menus.

Changes

File Path Change Summary
apps/web/src/app/(dashboard)/documents/[id]/document-page-view-dropdown.tsx Added DocumentRecipientLinkCopyDialog import, introduced isPending state, and added dropdown item for signing links.
apps/web/src/app/(dashboard)/documents/[id]/document-page-view-recipients.tsx Added imports for formatSigningLink and useToast, refactored recipient status rendering, and improved badge clarity.
apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx Added DocumentRecipientLinkCopyDialog import and conditional rendering for the dialog based on document status.
apps/web/src/app/(dashboard)/documents/data-table-action-dropdown.tsx Added DocumentRecipientLinkCopyDialog import, defined isPending, and included new dropdown item for signing links.
apps/web/src/components/document/document-recipient-link-copy-dialog.tsx Introduced DocumentRecipientLinkCopyDialog component for copying signing links, with props for trigger and recipients.
packages/lib/utils/recipients.ts Added formatSigningLink function for constructing signing links.
packages/ui/components/common/copy-text-button.tsx Introduced CopyTextButton component for copying text to clipboard with visual feedback.

Suggested labels

apps: web, version bump 👀, apps: marketing

Suggested reviewers

  • Mythie
  • ephraimduncan

🐰 In the meadow where we play,
New links to share brighten the day!
With badges bright and dialogs neat,
Document tasks are now a treat!
So hop along, let’s spread the cheer,
For signing links are finally here! 🌼✨


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 4

🧹 Outside diff range and nitpick comments (11)
packages/lib/utils/recipients.ts (1)

3-5: Add input validation and type safety to formatSigningLink.

While the implementation is straightforward, consider adding these safety measures:

  1. Type validation for the token parameter
  2. URL path sanitization to handle potential trailing slashes

Consider this improved implementation:

-export const formatSigningLink = (token: string) => `${NEXT_PUBLIC_WEBAPP_URL()}/sign/${token}`;
+export const formatSigningLink = (token: string): string => {
+  if (!token) {
+    throw new Error('Token is required for signing link generation');
+  }
+  const baseUrl = NEXT_PUBLIC_WEBAPP_URL().replace(/\/+$/, '');
+  return `${baseUrl}/sign/${encodeURIComponent(token)}`;
+};
packages/ui/components/common/copy-text-button.tsx (2)

1-19: Consider adding validation for empty values.

The props interface is well-defined, but the value prop could benefit from runtime validation to handle empty strings gracefully.

Consider adding a check in the component:

export const CopyTextButton = ({
  value,
  onCopySuccess,
  badgeContentUncopied,
  badgeContentCopied,
}: CopyTextButtonProps) => {
+ if (!value?.trim()) {
+   console.warn('CopyTextButton: Empty or whitespace-only value provided');
+ }

21-82: Consider performance optimizations.

The component could benefit from memoization and proper cleanup handling.

Consider these architectural improvements:

  1. Memoize the component for better performance:
export const CopyTextButton = memo(({...props}: CopyTextButtonProps) => {
  // Component implementation
});
  1. Move timeout cleanup to useEffect:
useEffect(() => {
  return () => {
    if (copiedTimeout) {
      clearTimeout(copiedTimeout);
    }
  };
}, [copiedTimeout]);
apps/web/src/components/document/document-recipient-link-copy-dialog.tsx (3)

37-52: Consider adding type safety for search params.

While the implementation is correct, consider adding type safety for the search params to prevent potential runtime issues.

-  const actionSearchParam = searchParams?.get('action');
+  type ValidActions = 'view-signing-links' | null;
+  const actionSearchParam = searchParams?.get('action') as ValidActions;

67-72: Optimize useEffect dependencies.

The current effect setup might cause unnecessary re-renders since open and setOpen are included in the dependency array.

   useEffect(() => {
     if (actionSearchParam === 'view-signing-links') {
       setOpen(true);
       updateSearchParams({ action: null });
     }
-  }, [actionSearchParam, open, setOpen, updateSearchParams]);
+  }, [actionSearchParam, updateSearchParams]);

74-151: Consider adding loading states and list virtualization.

The component could benefit from the following improvements:

  1. Loading states during clipboard operations
  2. List virtualization for better performance with large recipient lists

Consider using a virtualized list component like react-window or react-virtualized when dealing with large lists of recipients. This would improve performance by only rendering visible items.

Also, consider adding loading states during clipboard operations:

   const [open, setOpen] = useState(false);
+  const [isLoading, setIsLoading] = useState(false);

   const onBulkCopy = async () => {
+    setIsLoading(true);
     try {
       // ... existing copy logic
     } catch (error) {
       // ... error handling
+    } finally {
+      setIsLoading(false);
     }
   };

   // In the button JSX:
-  <Button type="button" onClick={onBulkCopy}>
+  <Button type="button" onClick={onBulkCopy} disabled={isLoading}>
     <Trans>Bulk Copy</Trans>
   </Button>
apps/web/src/app/(dashboard)/documents/[id]/document-page-view-recipients.tsx (1)

77-116: Consider extracting badge rendering logic into a separate component.

The badge rendering logic using pattern matching is comprehensive but could be more maintainable if extracted into a dedicated component.

Consider creating a new component like this:

type RecipientBadgeProps = {
  role: RecipientRole;
  documentStatus: DocumentStatus;
};

const RecipientBadge = ({ role, documentStatus }: RecipientBadgeProps) => {
  return (
    <Badge variant="default">
      {match(role)
        .with(RecipientRole.APPROVER, () => (
          <>
            <CheckIcon className="mr-1 h-3 w-3" />
            <Trans>Approved</Trans>
          </>
        ))
        // ... other cases
        .exhaustive()}
    </Badge>
  );
};

This would simplify the main component and make the badge logic more reusable and testable.

apps/web/src/app/(dashboard)/documents/[id]/document-page-view-dropdown.tsx (2)

151-164: Add documentation for event handling.

Consider adding a comment explaining why preventDefault() is used in the onSelect handler, as this might not be immediately obvious to other developers.

              <DropdownMenuItem
                disabled={!isPending || isDeleted}
+               // Prevent closing the dropdown when selecting this item
                onSelect={(e) => e.preventDefault()}
              >

155-158: Consider extracting the disabled condition.

The disabled state combines multiple conditions. Consider extracting this into a descriptive constant for better maintainability and readability.

+             const isSigningLinksDisabled = !isPending || isDeleted;
              <DropdownMenuItem
-               disabled={!isPending || isDeleted}
+               disabled={isSigningLinksDisabled}
                onSelect={(e) => e.preventDefault()}
              >
apps/web/src/app/(dashboard)/documents/data-table-action-dropdown.tsx (1)

196-208: Consider accessibility and performance improvements.

While the implementation is functional, consider the following improvements:

  1. Accessibility: Replace the div with a button or span inside the DropdownMenuItem for better semantic structure.
  2. Performance: Consider passing only necessary recipient data instead of the full array.

Here's a suggested improvement:

  <DocumentRecipientLinkCopyDialog
-   recipients={row.Recipient}
+   recipients={row.Recipient.map(({ id, email, name, token }) => ({
+     id,
+     email,
+     name,
+     token,
+   }))}
    trigger={
      <DropdownMenuItem disabled={!isPending} asChild onSelect={(e) => e.preventDefault()}>
-       <div>
+       <span>
          <Copy className="mr-2 h-4 w-4" />
          <Trans>Signing Links</Trans>
-       </div>
+       </span>
      </DropdownMenuItem>
    }
  />
apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx (1)

138-140: Consider enhancing dialog control and positioning.

While the implementation is clean, consider the following improvements:

  1. Add a controlled state for the dialog to manage its visibility from this component
  2. Consider passing additional props for positioning context, especially since this dialog appears at the page level
-      {document.status === DocumentStatus.PENDING && (
-        <DocumentRecipientLinkCopyDialog recipients={recipients} />
-      )}
+      {document.status === DocumentStatus.PENDING && (
+        <DocumentRecipientLinkCopyDialog
+          recipients={recipients}
+          position="top-right"
+          onOpenChange={(open) => {
+            // Handle dialog state
+          }}
+        />
+      )}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1b10c55 and ac9a1f4.

📒 Files selected for processing (7)
  • apps/web/src/app/(dashboard)/documents/[id]/document-page-view-dropdown.tsx (3 hunks)
  • apps/web/src/app/(dashboard)/documents/[id]/document-page-view-recipients.tsx (4 hunks)
  • apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx (2 hunks)
  • apps/web/src/app/(dashboard)/documents/data-table-action-dropdown.tsx (3 hunks)
  • apps/web/src/components/document/document-recipient-link-copy-dialog.tsx (1 hunks)
  • packages/lib/utils/recipients.ts (1 hunks)
  • packages/ui/components/common/copy-text-button.tsx (1 hunks)
🔇 Additional comments (12)
packages/lib/utils/recipients.ts (1)

5-5: LGTM! Well-integrated with existing functionality.

The new formatSigningLink function is appropriately placed in this utility module and maintains good separation of concerns with the existing recipient-related functions.

apps/web/src/components/document/document-recipient-link-copy-dialog.tsx (1)

1-35: LGTM! Well-structured imports and type definitions.

The component follows TypeScript best practices with proper type definitions and necessary imports.

apps/web/src/app/(dashboard)/documents/[id]/document-page-view-recipients.tsx (4)

Line range hint 1-31: LGTM! Clean import organization and component setup.

The new imports are properly organized and necessary for the enhanced functionality.


32-33: LGTM! Proper hook initialization.

The toast hook is correctly initialized at the component level following React hooks best practices.


118-124: LGTM! Clear status indication for pending recipients.

The pending status badge provides clear visual feedback with appropriate iconography.


Line range hint 1-139: Implementation aligns well with PR objectives.

The changes successfully enhance the signing link functionality by:

  1. Adding copy capability for relevant recipients
  2. Providing clear user feedback through toast notifications
  3. Maintaining proper access controls based on document and recipient status
apps/web/src/app/(dashboard)/documents/[id]/document-page-view-dropdown.tsx (2)

36-37: LGTM: Clean import statement.

The import follows the project's conventions and is properly organized.


67-67: LGTM: Clear and consistent state tracking.

The isPending constant follows the existing pattern of status checks and is well-named.

apps/web/src/app/(dashboard)/documents/data-table-action-dropdown.tsx (3)

40-41: LGTM: Import statement follows project conventions.

The import of DocumentRecipientLinkCopyDialog aligns with the PR objective and follows the project's module resolution pattern.


74-74: LGTM: Status variable follows existing patterns.

The isPending variable is well-placed among other status checks and correctly uses the DocumentStatus enum.


196-209: LGTM: Well-integrated within the Share section.

The new signing links feature is logically placed in the Share section and follows the established patterns for conditional rendering and user permissions.

apps/web/src/app/(dashboard)/documents/[id]/document-page-view.tsx (1)

29-29: LGTM!

The import statement is clean and follows the existing import organization pattern.

Comment on lines +45 to +81
return (
<Button
type="button"
variant="none"
className="ml-2 h-7 rounded border bg-neutral-50 px-0.5 font-normal dark:border dark:border-neutral-500 dark:bg-neutral-600"
onClick={async () => onCopy()}
>
<AnimatePresence mode="wait" initial={false}>
<motion.div
className="flex flex-row items-center"
key={copiedTimeout ? 'copied' : 'copy'}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0, transition: { duration: 0.1 } }}
>
{copiedTimeout ? badgeContentCopied : badgeContentUncopied}

<div
className={cn(
'flex h-6 w-6 items-center justify-center rounded transition-all hover:bg-neutral-200 hover:active:bg-neutral-300 dark:hover:bg-neutral-500 dark:hover:active:bg-neutral-400',
{
'ml-1': Boolean(badgeContentCopied || badgeContentUncopied),
},
)}
>
<div className="absolute">
{copiedTimeout ? (
<CheckSquareIcon className="h-3.5 w-3.5" />
) : (
<CopyIcon className="h-3.5 w-3.5" />
)}
</div>
</div>
</motion.div>
</AnimatePresence>
</Button>
);

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.

🛠️ Refactor suggestion

Enhance accessibility attributes.

The button needs proper ARIA attributes to improve accessibility for screen readers.

Apply these accessibility improvements:

    <Button
      type="button"
      variant="none"
+     aria-label={`Copy ${value}`}
+     aria-pressed={Boolean(copiedTimeout)}
      className="ml-2 h-7 rounded border bg-neutral-50 px-0.5 font-normal dark:border dark:border-neutral-500 dark:bg-neutral-600"
      onClick={async () => onCopy()}
    >

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +31 to +43
const onCopy = async () => {
await copy(value).then(() => onCopySuccess?.());

if (copiedTimeout) {
clearTimeout(copiedTimeout);
}

setCopiedTimeout(
setTimeout(() => {
setCopiedTimeout(null);
}, 2000),
);
};

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.

🛠️ Refactor suggestion

Enhance error handling and configurability.

The copy operation could fail silently, and the timeout duration is hardcoded.

Consider these improvements:

+ const COPY_FEEDBACK_DURATION = 2000;
+
export const CopyTextButton = ({
  value,
  onCopySuccess,
+ onCopyError,
+ feedbackDuration = COPY_FEEDBACK_DURATION,
  badgeContentUncopied,
  badgeContentCopied,
}: CopyTextButtonProps) => {
  // ...
  const onCopy = async () => {
-   await copy(value).then(() => onCopySuccess?.());
+   try {
+     await copy(value);
+     onCopySuccess?.();
+   } catch (error) {
+     onCopyError?.(error);
+     return;
+   }

    if (copiedTimeout) {
      clearTimeout(copiedTimeout);
    }

    setCopiedTimeout(
      setTimeout(() => {
        setCopiedTimeout(null);
-     }, 2000),
+     }, feedbackDuration),
    );
  };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const onCopy = async () => {
await copy(value).then(() => onCopySuccess?.());
if (copiedTimeout) {
clearTimeout(copiedTimeout);
}
setCopiedTimeout(
setTimeout(() => {
setCopiedTimeout(null);
}, 2000),
);
};
const COPY_FEEDBACK_DURATION = 2000;
export const CopyTextButton = ({
value,
onCopySuccess,
onCopyError,
feedbackDuration = COPY_FEEDBACK_DURATION,
badgeContentUncopied,
badgeContentCopied,
}: CopyTextButtonProps) => {
// ...
const onCopy = async () => {
try {
await copy(value);
onCopySuccess?.();
} catch (error) {
onCopyError?.(error);
return;
}
if (copiedTimeout) {
clearTimeout(copiedTimeout);
}
setCopiedTimeout(
setTimeout(() => {
setCopiedTimeout(null);
}, feedbackDuration),
);
};

Comment on lines +53 to +65
const onBulkCopy = async () => {
const generatedString = recipients
.filter((recipient) => recipient.role !== RecipientRole.CC)
.map((recipient) => `${recipient.email}\n${NEXT_PUBLIC_WEBAPP_URL()}/sign/${recipient.token}`)
.join('\n\n');

await copy(generatedString).then(() => {
toast({
title: _(msg`Copied to clipboard`),
description: _(msg`All signing links have been copied to your clipboard.`),
});
});
};

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.

🛠️ Refactor suggestion

Add error handling for clipboard operations.

The bulk copy functionality should handle potential clipboard API failures to provide better user feedback.

   const onBulkCopy = async () => {
     const generatedString = recipients
       .filter((recipient) => recipient.role !== RecipientRole.CC)
       .map((recipient) => `${recipient.email}\n${NEXT_PUBLIC_WEBAPP_URL()}/sign/${recipient.token}`)
       .join('\n\n');
 
-    await copy(generatedString).then(() => {
-      toast({
-        title: _(msg`Copied to clipboard`),
-        description: _(msg`All signing links have been copied to your clipboard.`),
-      });
-    });
+    try {
+      await copy(generatedString);
+      toast({
+        title: _(msg`Copied to clipboard`),
+        description: _(msg`All signing links have been copied to your clipboard.`),
+      });
+    } catch (error) {
+      toast({
+        title: _(msg`Failed to copy`),
+        description: _(msg`Unable to copy signing links to clipboard. Please try again.`),
+        variant: 'destructive',
+      });
+    }
   };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const onBulkCopy = async () => {
const generatedString = recipients
.filter((recipient) => recipient.role !== RecipientRole.CC)
.map((recipient) => `${recipient.email}\n${NEXT_PUBLIC_WEBAPP_URL()}/sign/${recipient.token}`)
.join('\n\n');
await copy(generatedString).then(() => {
toast({
title: _(msg`Copied to clipboard`),
description: _(msg`All signing links have been copied to your clipboard.`),
});
});
};
const onBulkCopy = async () => {
const generatedString = recipients
.filter((recipient) => recipient.role !== RecipientRole.CC)
.map((recipient) => `${recipient.email}\n${NEXT_PUBLIC_WEBAPP_URL()}/sign/${recipient.token}`)
.join('\n\n');
try {
await copy(generatedString);
toast({
title: _(msg`Copied to clipboard`),
description: _(msg`All signing links have been copied to your clipboard.`),
});
} catch (error) {
toast({
title: _(msg`Failed to copy`),
description: _(msg`Unable to copy signing links to clipboard. Please try again.`),
variant: 'destructive',
});
}
};

Comment on lines +126 to +138
{document.status === DocumentStatus.PENDING &&
recipient.signingStatus === SigningStatus.NOT_SIGNED &&
recipient.role !== RecipientRole.CC && (
<CopyTextButton
value={formatSigningLink(recipient.token)}
onCopySuccess={() => {
toast({
title: _(msg`Copied to clipboard`),
description: _(msg`The signing link has been copied to your clipboard.`),
});
}}
/>
)}

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.

🛠️ Refactor suggestion

Add error handling for copy operation.

While the copy functionality works well, it should handle potential failures gracefully.

Consider adding error handling:

  <CopyTextButton
    value={formatSigningLink(recipient.token)}
    onCopySuccess={() => {
      toast({
        title: _(msg`Copied to clipboard`),
        description: _(msg`The signing link has been copied to your clipboard.`),
      });
    }}
+   onCopyError={() => {
+     toast({
+       title: _(msg`Failed to copy`),
+       description: _(msg`Please try copying the link manually.`),
+       variant: 'destructive',
+     });
+   }}
  />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{document.status === DocumentStatus.PENDING &&
recipient.signingStatus === SigningStatus.NOT_SIGNED &&
recipient.role !== RecipientRole.CC && (
<CopyTextButton
value={formatSigningLink(recipient.token)}
onCopySuccess={() => {
toast({
title: _(msg`Copied to clipboard`),
description: _(msg`The signing link has been copied to your clipboard.`),
});
}}
/>
)}
{document.status === DocumentStatus.PENDING &&
recipient.signingStatus === SigningStatus.NOT_SIGNED &&
recipient.role !== RecipientRole.CC && (
<CopyTextButton
value={formatSigningLink(recipient.token)}
onCopySuccess={() => {
toast({
title: _(msg`Copied to clipboard`),
description: _(msg`The signing link has been copied to your clipboard.`),
});
}}
onCopyError={() => {
toast({
title: _(msg`Failed to copy`),
description: _(msg`Please try copying the link manually.`),
variant: 'destructive',
});
}}
/>
)}

This branch had an error being deployed

1 failed, 1 active, and 1 inactive deployments
Preview – stg-marketing — ac9a1f43 Deployed Nov 6, 2024 by vercel[bot]
Preview – prd-openpage-api — ac9a1f43 Deployed Nov 6, 2024 by vercel[bot]
Preview – stg-app — ac9a1f43 Deployed Nov 6, 2024 by vercel[bot]
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant