Hook onUndo handler for cherry-picking

This commit is contained in:
Sergio Padrino 2021-08-23 13:13:03 +02:00
parent f09e9ec53e
commit 0c222c79b7
3 changed files with 5 additions and 9 deletions

View file

@ -60,7 +60,7 @@ export type Banner =
/** number of commits cherry picked */
readonly count: number
/** callback to run when user clicks undo link in banner */
readonly onUndoCherryPick: () => void
readonly onUndo: () => void
}
| {
readonly type: BannerType.CherryPickConflictsFound

View file

@ -79,7 +79,7 @@ export function renderBanner(
targetBranchName={banner.targetBranchName}
countCherryPicked={banner.count}
onDismissed={onDismissed}
onUndoCherryPick={banner.onUndoCherryPick}
onUndo={banner.onUndo}
/>
)
case BannerType.CherryPickConflictsFound:

View file

@ -5,7 +5,7 @@ interface ISuccessfulCherryPickBannerProps {
readonly targetBranchName: string
readonly countCherryPicked: number
readonly onDismissed: () => void
readonly onUndoCherryPick: () => void
readonly onUndo: () => void
}
export class SuccessfulCherryPick extends React.Component<
@ -16,18 +16,14 @@ export class SuccessfulCherryPick extends React.Component<
const {
countCherryPicked,
onDismissed,
onUndoCherryPick,
onUndo,
targetBranchName,
} = this.props
const pluralized = countCherryPicked === 1 ? 'commit' : 'commits'
return (
<SuccessBanner
timeout={15000}
onDismissed={onDismissed}
onUndo={onUndoCherryPick}
>
<SuccessBanner timeout={15000} onDismissed={onDismissed} onUndo={onUndo}>
<span>
Successfully copied {countCherryPicked} {pluralized} to{' '}
<strong>{targetBranchName}</strong>.