Repository navigation
Add link to copy SHA to clipboard - #1778
Conversation
@xt0rted an alternative idea that you might not have tried - what if we left the existing behaviour to make the link launch the browser, if the commit has been published, and added a clipboard icon icon alongside which would add the SHA to the clipboard? That might prevent this menu from becoming cluttered with words and iconography, but might need some design input to ensure it's clear that the new icon is clickable... |
Unless I'm missing something here it seems to me that such an approach would lead to us having two icons right next to each other (clipboard and file icon for the number of changed files). I think the approach @xt0rted has here with an extra item is a step in the right direction. I've never been a big fan of the sha linking to GitHub, it's not very intuitive whereas there's no ambiguity about what the View on GitHub link will do. We need to make sure it still works okay when the sidebar is expanded all the way and the window is at its minimum width though. We've also discussed having an overflow/drawer menu or context menu where we could stick both these actions and have the row be exclusively read-only information. An additional context menu on commit list items seems prudent as well. I'll add this to the list of things to discuss at our next design sync-up (which is probably going to be this coming Wednesday). cc @donokuda |
|
Might one to fix this as part of the new feature: |
| </span> | ||
|
|
||
| {url ? <LinkButton uri={url}>{shortSHA}</LinkButton> : shortSHA} | ||
| <LinkButton onClick={() => clipboard.writeText(longSHA)}>{shortSHA}</LinkButton> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| <li className='commit-summary-meta-item' | ||
| title="View this commit on github.com"> | ||
| <span aria-hidden='true'> | ||
| <Octicon symbol={OcticonSymbol.octoface} /> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| <li className='commit-summary-meta-item' | ||
| title={shortSHA} aria-label='SHA'> | ||
| title="Copy SHA to clipboard" aria-label='SHA'> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| return ( | ||
| <li className='commit-summary-meta-item' | ||
| title="View this commit on github.com"> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| @@ -1,5 +1,6 @@ | |||
| import * as React from 'react' | |||
| import * as classNames from 'classnames' | |||
| import {clipboard} from 'electron' | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.


This is to get feedback on the feature. It updates the commit sha link so when clicked it copies it to the clipboard. The existing link is moved to a new View on GitHub link similar to the native client and only shows if the commit isn't local.
The style rule added in #1291 was removed since you no longer need to select the link in order to copy it.
cc #1501