Skip to content

Adds an options menu to the Commit Summary component - #2045

Merged
joshaber merged 48 commits into
masterfrom
commit-options
Aug 2, 2017
Merged

joshaber merged 48 commits into
masterfrom
commit-options

Conversation

@iAmWillShepherd

@iAmWillShepherd iAmWillShepherd commented Jun 18, 2017 •

Copy link
Copy Markdown
Contributor

Fixes #752.

To Do

  • Add gear menu
  • Add ability to copy SHA
  • Add ability to open commit on GitHub
  • Add ability to revert commit
  • Figure out how to handle remote commits not hosted on GitHub

Updated UI

2017-06-18_13-30-25

@iAmWillShepherd iAmWillShepherd added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jun 19, 2017
@joshaber joshaber self-assigned this Jun 21, 2017

@joshaber joshaber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🍖

Comment thread app/src/lib/git/commit.ts Outdated
}
}

export async function revertCommit(repository: Repository, SHA: string) {

This comment was marked as spam.

Comment thread app/src/ui/app.tsx Outdated

const url = `${repository.gitHubRepository.htmlURL}/commit/${SHA}`

if (url) {

This comment was marked as spam.

This comment was marked as spam.

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

const items: IMenuItem[] = [
{
label: __DARWIN__ ? 'Revert this Commit' : 'Revert this commit',

This comment was marked as spam.

Comment thread app/src/ui/history/commit-summary.tsx Outdated
{
label: 'View on GitHub',
action: this.onViewOnGitHub,
enabled: !this.props.isLocal || !this.props.repository.gitHubRepository,

This comment was marked as spam.

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

private onRevertCommit = async () => {
await revertCommit(this.props.repository, this.props.sha)

This comment was marked as spam.

Comment thread app/src/ui/history/commit-summary.tsx Outdated
onContextMenu={this.onShowCommitOptions}
>
<span aria-hidden='true'>
<Octicon symbol={OcticonSymbol.gear} />

This comment was marked as spam.

@donokuda

Copy link
Copy Markdown
Contributor

I pushed some changes and here's what it looks like so far:

What about a button?
More ▼
This clearly indicates interactivity, without being a link.

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.

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

@donokuda
The spacing of the text Action seems a bit too far to the right to me. Is this intentional?

@donokuda

donokuda commented Aug 1, 2017

Copy link
Copy Markdown
Contributor

The spacing of the text Action seems a bit too far to the right to me. Is this intentional?

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:

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

💯

@joshaber joshaber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I noticed a couple things in testing this:

  1. Try to revert a commit:

screen shot 2017-08-01 at 2 22 49 pm

It looks like we should only pass the -m 1 arguments if the commit has more than 1 parent.

  1. I thought we agreed to stop linking the SHA?

Comment thread app/src/ui/app.tsx

const baseURL = repository.gitHubRepository.htmlURL

if (baseURL) {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment thread app/src/ui/app.tsx Outdated
const baseURL = repository.gitHubRepository.htmlURL

if (baseURL) {
this.props.dispatcher.openInBrowser(`${baseURL}/commits/${SHA}`)

This comment was marked as spam.

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

const url = `${gitHubRepository.htmlURL}/commit/${this.props.sha}`
const isDotCom = gitHubRepository.endpoint === getDotComAPIEndpoint()
if (gitHubRepository !== null) {

This comment was marked as spam.

Comment thread app/src/ui/repository.tsx Outdated
onViewCommitOnGitHub={this.props.onViewCommitOnGitHub}
/>
)
} else if (selectedSection === RepositorySection.History) {

This comment was marked as spam.

@iAmWillShepherd iAmWillShepherd added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Aug 1, 2017
@donokuda

donokuda commented Aug 1, 2017

Copy link
Copy Markdown
Contributor

The reasoning was that I wanted to separate out actions from commit information.

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:

  1. It's an interaction we currently use in the app
  2. We won't be conflating the commit summary section with more UI elements
  3. I wouldn't consider the actions that we are surfacing apart of a core-workflow. They're actions you would take in special situations (reverting, copying SHA's for cherry-picking or checking out, etc)

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.

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

I feel like right-clicking on the commit list is a better place for these actions to live:

I'm not opposed to this idea. Making that change shouldn't take too long, but maybe another issue for it?

@donokuda

donokuda commented Aug 1, 2017

Copy link
Copy Markdown
Contributor

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.

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

👀

@joshaber joshaber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread app/src/ui/history/commit-summary.tsx Outdated
{
label: label,
action: this.onViewOnGitHub,
enabled: !this.props.isLocal && gitHubRepository !== null,

This comment was marked as spam.

@iAmWillShepherd

Copy link
Copy Markdown
Contributor Author

👀

@joshaber joshaber left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🌝

Comment thread app/src/ui/history/commit-summary.tsx Outdated
{
label: label,
action: this.onViewOnGitHub,
enabled: !this.props.isLocal && !gitHubRepository,

This comment was marked as spam.

This comment was marked as spam.

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

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants