Skip to content

Add clipboard button#7607

Closed
KTibow wants to merge 4 commits intohome-assistant:devfrom
KTibow:clipboard-button
Closed

Add clipboard button#7607
KTibow wants to merge 4 commits intohome-assistant:devfrom
KTibow:clipboard-button

Conversation

@KTibow
Copy link
Copy Markdown
Contributor

@KTibow KTibow commented Nov 6, 2020

Moved to #8411

Proposed change

This adds a button next to the entity ID that copies the ID to the clipboard.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

image

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@KTibow KTibow marked this pull request as ready for review November 7, 2020 01:06
@spacegaier
Copy link
Copy Markdown
Member

Can you please post a screenshot.

@KTibow
Copy link
Copy Markdown
Contributor Author

KTibow commented Nov 7, 2020

Okay... Let me get my dev instance running.

@KTibow
Copy link
Copy Markdown
Contributor Author

KTibow commented Nov 7, 2020

image
I can adjust the padding or whatever if you want. Originally the button was on the right but now it's next to the more info button.

@KTibow KTibow force-pushed the patch-9 branch 2 times, most recently from 2f0643d to cadb6c8 Compare November 7, 2020 18:36
@spacegaier
Copy link
Copy Markdown
Member

image
I can adjust the padding or whatever if you want. Originally the button was on the right but now it's next to the more info button.

Yeah, I think currently the new button is not justified between the more-info button and the hyperlink. Needs to move slightly to the left I think.

@KTibow
Copy link
Copy Markdown
Contributor Author

KTibow commented Nov 8, 2020

@spacegaier What would be a good way to do that? I know using   is a bad practice. Would adding 12px for margin-right work?

@spacegaier
Copy link
Copy Markdown
Member

@spacegaier What would be a good way to do that? I know using   is a bad practice. Would adding 12px for margin-right work?

Not sure what the best way is (not a CSS guru myself). Perhaps putting all three elements into a flex box might work and sort that out. The more manual approach would be so set a CSS class for the second icon that removes the left margin if that is causing the too wide gap to the first icon.

Comment thread src/panels/developer-tools/state/developer-tools-state.js Outdated
@bramkragten
Copy link
Copy Markdown
Member

Make sure there is enough space between the buttons so you can touch it on mobile. Check the guidelines: https://material.io/develop/web/components/buttons/icon-buttons

Related: #4259

@bramkragten
Copy link
Copy Markdown
Member

You should rebase, not merge everything in your branch.

Comment thread src/panels/developer-tools/state/developer-tools-state.js Outdated
@KTibow
Copy link
Copy Markdown
Contributor Author

KTibow commented Nov 10, 2020

Just curious: Why did #4259 cause lag? How can I prevent this PR from causing lag?

@bramkragten
Copy link
Copy Markdown
Member

Because it had a dropdown menu and button on every row, that needed to be rendered/calculated, since this is just 1 icon on every row it should be ok.

Comment thread src/common/util/copy-clipboard.ts Outdated
Comment thread src/common/util/copy-clipboard.ts Outdated
Comment thread src/common/util/copy-clipboard.ts Outdated
@bramkragten
Copy link
Copy Markdown
Member

@KTibow KTibow force-pushed the clipboard-button branch 2 times, most recently from 1578b06 to 237391a Compare November 11, 2020 15:23
KTibow and others added 3 commits November 11, 2020 07:28
The clipboard fallback triggers if navigator.clipboard is falsey, or if
an error occurs using navigator.clipboard.
Thanks for helping improve the code Bram!

Co-Authored-By: Bram Kragten <bramkragten@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 9, 2021

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@github-actions github-actions Bot added the stale label Feb 9, 2021
@github-actions github-actions Bot closed this Feb 17, 2021
@KTibow KTibow deleted the clipboard-button branch February 17, 2021 17:55
@KTibow KTibow mentioned this pull request Feb 17, 2021
9 tasks
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants