| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | */ |
| 7 | |
| 8 | import type {TrackEventName} from 'isl-server/src/analytics/eventNames'; |
| 9 | import type {CommitInfo} from '../../types'; |
| 10 | |
| 11 | import type {Button} from 'isl-components/Button'; |
| 12 | import {T} from '../../i18n'; |
| 13 | import {SplitCommitIcon} from '../../icons/SplitCommitIcon'; |
| 14 | import {BaseSplitButton} from './BaseSplitButton'; |
| 15 | |
| 16 | /** Button to open split UI for the current commit. Expected to be shown on the head commit. |
| 17 | * Loads that one commit in the split UI. */ |
| 18 | export function SplitButton({ |
| 19 | commit, |
| 20 | trackerEventName, |
| 21 | ...buttonProps |
| 22 | }: { |
| 23 | commit: CommitInfo; |
| 24 | trackerEventName: TrackEventName; |
| 25 | } & React.ComponentProps<typeof Button>) { |
| 26 | return ( |
| 27 | <BaseSplitButton |
| 28 | commit={commit} |
| 29 | trackerEventName={trackerEventName} |
| 30 | bumpSplitFromSuggestion={trackerEventName === 'SplitOpenFromSplitSuggestion'} |
| 31 | {...buttonProps}> |
| 32 | <SplitCommitIcon /> |
| 33 | <T>Split</T> |
| 34 | </BaseSplitButton> |
| 35 | ); |
| 36 | } |
| 37 | |