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(chat): added copy feature to message #1192

Merged
merged 1 commit into from
Sep 17, 2023
Merged

Conversation

StanGirard
Copy link
Collaborator

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Checklist before requesting a review

Please delete options that are not relevant.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented hard-to-understand areas
  • I have ideally added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

Screenshots (if appropriate):

@StanGirard StanGirard temporarily deployed to preview September 17, 2023 22:26 — with GitHub Actions Inactive
@vercel
Copy link

vercel bot commented Sep 17, 2023

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

Name Status Preview Updated (UTC)
docs 🔄 Building (Inspect) Visit Preview Sep 17, 2023 10:26pm
quivrapp 🔄 Building (Inspect) Visit Preview Sep 17, 2023 10:26pm

@StanGirard StanGirard merged commit 143d32d into main Sep 17, 2023
6 of 8 checks passed
@github-actions
Copy link
Contributor

Risk Level 2 - /home/runner/work/quivr/quivr/frontend/app/chat/[chatId]/components/ChatDialogueArea/components/ChatDialogue/components/QADisplay/components/MessageRow/MessageRow.tsx

  1. The handleCopy function uses console.error to log errors. This is not a good practice for production code as it can expose sensitive information. Consider using a dedicated error handling service or library that provides more control over what gets logged and where the logs go.

  2. The handleCopy function also sets the isCopied state to false after a delay of 2 seconds. This could lead to unexpected behavior if the user tries to copy the text again within this time frame. Consider resetting the isCopied state immediately after the copy operation is complete.

  3. The QuestionBrain and QuestionPrompt components have been removed. If these components are not used elsewhere, consider removing their import statements as well to keep the code clean.

Example code:

const handleCopy = async () => {
  try {
    await navigator.clipboard.writeText(text);
    setIsCopied(true);
  } catch (err) {
    // Handle error
  } finally {
    setIsCopied(false);
  }
};
// Remove unused imports
// import { QuestionBrain } from \"./components/QuestionBrain\";
// import { QuestionPrompt } from \"./components/QuestionPrompt\";

🔒🔄🧹


Powered by Code Review GPT

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.

None yet

1 participant