mirror of
https://github.com/desktop/desktop
synced 2024-10-30 17:25:09 +00:00
Merge pull request #17549 from desktop/commit-summary-expansion-lines-changed
Commit Summary Expansion: Replace added/deleted lines tooltip with plain text
This commit is contained in:
commit
467e62b6c1
2 changed files with 30 additions and 30 deletions
|
@ -12,7 +12,6 @@ import { CommitAttribution } from '../lib/commit-attribution'
|
|||
import { Tokenizer, TokenResult } from '../../lib/text-token-parser'
|
||||
import { wrapRichTextCommitMessage } from '../../lib/wrap-rich-text-commit-message'
|
||||
import { IChangesetData } from '../../lib/git'
|
||||
import { TooltippedContent } from '../lib/tooltipped-content'
|
||||
import uniqWith from 'lodash/uniqWith'
|
||||
import { LinkButton } from '../lib/link-button'
|
||||
import { UnreachableCommitsTab } from './unreachable-commits-dialog'
|
||||
|
@ -544,34 +543,29 @@ export class ExpandableCommitSummary extends React.Component<
|
|||
}
|
||||
|
||||
private renderLinesChanged() {
|
||||
const linesAdded = this.props.changesetData.linesAdded
|
||||
const linesDeleted = this.props.changesetData.linesDeleted
|
||||
if (linesAdded + linesDeleted === 0) {
|
||||
const { changesetData, selectedCommits, isExpanded } = this.props
|
||||
const { linesAdded, linesDeleted } = changesetData
|
||||
|
||||
if (
|
||||
(linesAdded === 0 && linesDeleted === 0) ||
|
||||
selectedCommits.length > 1
|
||||
) {
|
||||
return null
|
||||
}
|
||||
|
||||
const linesAddedPlural = linesAdded === 1 ? 'line' : 'lines'
|
||||
const linesDeletedPlural = linesDeleted === 1 ? 'line' : 'lines'
|
||||
const linesAddedTitle = `${linesAdded} ${linesAddedPlural} added`
|
||||
const linesDeletedTitle = `${linesDeleted} ${linesDeletedPlural} deleted`
|
||||
|
||||
return (
|
||||
<>
|
||||
<TooltippedContent
|
||||
tagName="div"
|
||||
className="ecs-meta-item without-truncation lines-added"
|
||||
tooltip={linesAddedTitle}
|
||||
>
|
||||
+{linesAdded}
|
||||
</TooltippedContent>
|
||||
<TooltippedContent
|
||||
tagName="div"
|
||||
className="ecs-meta-item without-truncation lines-deleted"
|
||||
tooltip={linesDeletedTitle}
|
||||
>
|
||||
-{linesDeleted}
|
||||
</TooltippedContent>
|
||||
</>
|
||||
<div className="ecs-meta-item lines-added-deleted">
|
||||
<div className="lines-added">
|
||||
{!isExpanded ? <>+{linesAdded}</> : <>{linesAdded} added lines</>}
|
||||
</div>
|
||||
<div className="lines-deleted">
|
||||
{!isExpanded ? (
|
||||
<>-{linesDeleted}</>
|
||||
) : (
|
||||
<>{linesDeleted} removed lines</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -171,12 +171,18 @@
|
|||
}
|
||||
}
|
||||
|
||||
&.lines-added {
|
||||
color: var(--color-new);
|
||||
}
|
||||
&.lines-added-deleted {
|
||||
div {
|
||||
padding-right: var(--spacing-half);
|
||||
}
|
||||
|
||||
&.lines-deleted {
|
||||
color: var(--color-deleted);
|
||||
.lines-added {
|
||||
color: var(--color-new);
|
||||
}
|
||||
|
||||
.lines-deleted {
|
||||
color: var(--color-deleted);
|
||||
}
|
||||
}
|
||||
|
||||
.tags {
|
||||
|
|
Loading…
Reference in a new issue