Repository navigation
Adds an options menu to the Commit Summary component - #2045
Conversation
| } | ||
| } | ||
|
|
||
| export async function revertCommit(repository: Repository, SHA: string) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| const url = `${repository.gitHubRepository.htmlURL}/commit/${SHA}` | ||
|
|
||
| if (url) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| const items: IMenuItem[] = [ | ||
| { | ||
| label: __DARWIN__ ? 'Revert this Commit' : 'Revert this commit', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| { | ||
| label: 'View on GitHub', | ||
| action: this.onViewOnGitHub, | ||
| enabled: !this.props.isLocal || !this.props.repository.gitHubRepository, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
|
|
||
| private onRevertCommit = async () => { | ||
| await revertCommit(this.props.repository, this.props.sha) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| onContextMenu={this.onShowCommitOptions} | ||
| > | ||
| <span aria-hidden='true'> | ||
| <Octicon symbol={OcticonSymbol.gear} /> |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
I pushed some changes and here's what it looks like so far:
I could be open to a button, but it would also add a level of hierarchy to the commit summary that I don't believe is justified to introduce here. I think the dropdown arrow is commonly used pattern for most people and should be sufficient. |
|
@donokuda |
It was intentional, but it definitely wasn't obvious enough. The reasoning was that I wanted to separate out actions from commit information. One thing that I've tried out is adding a left border to the actions dropdown. That might help visually separate the intentions between the two sections: |
|
💯 |
|
|
||
| const baseURL = repository.gitHubRepository.htmlURL | ||
|
|
||
| if (baseURL) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| const baseURL = repository.gitHubRepository.htmlURL | ||
|
|
||
| if (baseURL) { | ||
| this.props.dispatcher.openInBrowser(`${baseURL}/commits/${SHA}`) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| const url = `${gitHubRepository.htmlURL}/commit/${this.props.sha}` | ||
| const isDotCom = gitHubRepository.endpoint === getDotComAPIEndpoint() | ||
| if (gitHubRepository !== null) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| onViewCommitOnGitHub={this.props.onViewCommitOnGitHub} | ||
| /> | ||
| ) | ||
| } else if (selectedSection === RepositorySection.History) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
I've been Thinking About This UX and I'm not sure if the commit summary is the appropriate place for these actions. We currently use a context menu for these types of actions in other places such as the changed files list: And based on that, I feel like right-clicking on the commit list is a better place for these actions to live: Couple of reasons for my thinking:
That said, I don't believe my concerns are reasons to hold up this PR given that the main functionality is implemented here, but if we agree on moving these to the commit list I'm more than happy to make that change in a subsequent PR. |
I'm not opposed to this idea. Making that change shouldn't take too long, but maybe another issue for it? |
Sounds good, I've opened #2382 to track this idea. |
|
👀 |
joshaber
left a comment
There was a problem hiding this comment.
A couple little bits left and then we can land it 🛩
| readonly summary: string | ||
| readonly body: string | ||
| readonly sha: string | ||
| readonly commit: Commit |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| { | ||
| label: label, | ||
| action: this.onViewOnGitHub, | ||
| enabled: !this.props.isLocal && gitHubRepository !== null, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
👀 |
| { | ||
| label: label, | ||
| action: this.onViewOnGitHub, | ||
| enabled: !this.props.isLocal && !gitHubRepository, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.





Fixes #752.
To Do
Updated UI