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

[O2B-1386] Check if clipboard is available #1774

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mariscalromeroalejandro
Copy link
Collaborator

@mariscalromeroalejandro mariscalromeroalejandro commented Oct 3, 2024

I DON'T have JIRA ticket

  • explain what this PR does
  • if it is a new feature, explain how you plan to use it
  • tests are added
  • documentation was updated or added

I have a JIRA ticket

  • branch and/or PR name(s) include(s) JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected

Notable changes for users:

  • Users can only press "copy to..." button when the clipboard is available. Otherwise, they will see a message explaining the reason.

Notable changes for developers:

Changes made to the database:

*
* @returns {{ available: boolean, message: string }}
* - `available`: True if the clipboard is available; false otherwise.
* - `message`: A reason if the clipboard is not available, otherwise an empty string.
Copy link
Collaborator

Choose a reason for hiding this comment

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

If message do not apply (meaning: it makes no sense to have a message, in the case the clipboard is available) you should rather use null or undefined (basically return { available: true }).

Another possibility is to have a function like checkClipboardAvailability that throws an error if one of the check fails, and you use the error message as message.

@@ -59,6 +110,8 @@ export class CopyToClipboardComponent extends StatefulComponent {
{
id: `copy-${id}`,
onclick: () => this.copyToClipboard(clipboardTargetValue),
disabled: !available,
title: `${message}`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

If message is already a string, no need for ``

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants