Skip to content

Add link to copy SHA to clipboard - #1778

Merged
niik merged 5 commits into
desktop:masterfrom
xt0rted:issue-1501
Jun 22, 2017
Merged

niik merged 5 commits into
desktop:masterfrom
xt0rted:issue-1501

Conversation

@xt0rted

@xt0rted xt0rted commented May 25, 2017 •

Copy link
Copy Markdown
Contributor

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.

image

cc #1501

@shiftkey

Copy link
Copy Markdown
Member

This is to get feedback on the feature.

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

@niik

niik commented May 26, 2017

Copy link
Copy Markdown
Member

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?

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

@niik niik added the design-input-needed Issues that require design input from the core team before the work can be started label May 26, 2017
@tierninho

Copy link
Copy Markdown
Contributor

Might one to fix this as part of the new feature:
#1267

@xt0rted

xt0rted commented Jun 8, 2017

Copy link
Copy Markdown
Contributor Author

Updated Icon

image

@niik niik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking good @xtorted, I added a few requests for changes.

Comment thread app/src/ui/history/commit-summary.tsx Outdated
</span>

{url ? <LinkButton uri={url}>{shortSHA}</LinkButton> : shortSHA}
<LinkButton onClick={() => clipboard.writeText(longSHA)}>{shortSHA}</LinkButton>

This comment was marked as spam.

Comment thread app/src/ui/history/commit-summary.tsx Outdated
<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.

Comment thread app/src/ui/history/commit-summary.tsx Outdated

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

Comment thread app/src/ui/history/commit-summary.tsx Outdated

return (
<li className='commit-summary-meta-item'
title="View this commit on github.com">

This comment was marked as spam.

Comment thread app/src/ui/history/commit-summary.tsx Outdated
@@ -1,5 +1,6 @@
import * as React from 'react'
import * as classNames from 'classnames'
import {clipboard} from 'electron'

This comment was marked as spam.

@niik niik self-assigned this Jun 20, 2017
@xt0rted

xt0rted commented Jun 20, 2017 •

Copy link
Copy Markdown
Contributor Author

This is how it looks after the icon update.

image

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

Labels

design-input-needed Issues that require design input from the core team before the work can be started

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants