| b69ab31 | | | 1 | /** |
| b69ab31 | | | 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| b69ab31 | | | 3 | * |
| b69ab31 | | | 4 | * This source code is licensed under the MIT license found in the |
| b69ab31 | | | 5 | * LICENSE file in the root directory of this source tree. |
| b69ab31 | | | 6 | */ |
| b69ab31 | | | 7 | |
| b69ab31 | | | 8 | import {Button} from 'isl-components/Button'; |
| b69ab31 | | | 9 | import {Icon} from 'isl-components/Icon'; |
| b69ab31 | | | 10 | import {Kbd} from 'isl-components/Kbd'; |
| b69ab31 | | | 11 | import {KeyCode, Modifier} from 'isl-components/KeyboardShortcuts'; |
| b69ab31 | | | 12 | import {Tooltip} from 'isl-components/Tooltip'; |
| b69ab31 | | | 13 | import {CleanupAllButton} from './Cleanup'; |
| b69ab31 | | | 14 | import {DropdownFields} from './DropdownFields'; |
| b69ab31 | | | 15 | import {useCommandEvent} from './ISLShortcuts'; |
| b69ab31 | | | 16 | import {SelectAllButton} from './SelectAllCommits'; |
| b69ab31 | | | 17 | import {SuggestedRebaseButton} from './SuggestedRebase'; |
| b69ab31 | | | 18 | import {T} from './i18n'; |
| b69ab31 | | | 19 | |
| b69ab31 | | | 20 | import './BulkActionsMenu.css'; |
| b69ab31 | | | 21 | |
| b69ab31 | | | 22 | export function BulkActionsMenu() { |
| b69ab31 | | | 23 | const additionalToggles = useCommandEvent('ToggleBulkActionsDropdown'); |
| b69ab31 | | | 24 | return ( |
| b69ab31 | | | 25 | <Tooltip |
| b69ab31 | | | 26 | component={dismiss => <BulkActions dismiss={dismiss} />} |
| b69ab31 | | | 27 | trigger="click" |
| b69ab31 | | | 28 | placement="bottom" |
| b69ab31 | | | 29 | group="topbar" |
| b69ab31 | | | 30 | title={ |
| b69ab31 | | | 31 | <T replace={{$shortcut: <Kbd keycode={KeyCode.B} modifiers={[Modifier.ALT]} />}}> |
| b69ab31 | | | 32 | Bulk Actions ($shortcut) |
| b69ab31 | | | 33 | </T> |
| b69ab31 | | | 34 | } |
| b69ab31 | | | 35 | additionalToggles={additionalToggles.asEventTarget()}> |
| b69ab31 | | | 36 | <Button icon data-testid="bulk-actions-button"> |
| b69ab31 | | | 37 | <Icon icon="run-all" /> |
| b69ab31 | | | 38 | </Button> |
| b69ab31 | | | 39 | </Tooltip> |
| b69ab31 | | | 40 | ); |
| b69ab31 | | | 41 | } |
| b69ab31 | | | 42 | |
| b69ab31 | | | 43 | function BulkActions({dismiss}: {dismiss: () => void}) { |
| b69ab31 | | | 44 | return ( |
| b69ab31 | | | 45 | <DropdownFields |
| b69ab31 | | | 46 | title={<T>Bulk Actions</T>} |
| b69ab31 | | | 47 | icon="run-all" |
| b69ab31 | | | 48 | className="bulk-actions-dropdown" |
| b69ab31 | | | 49 | data-testid="bulk-actions-dropdown"> |
| b69ab31 | | | 50 | <SelectAllButton dismiss={dismiss} /> |
| b69ab31 | | | 51 | <SuggestedRebaseButton afterRun={dismiss} /> |
| b69ab31 | | | 52 | <CleanupAllButton /> |
| b69ab31 | | | 53 | </DropdownFields> |
| b69ab31 | | | 54 | ); |
| b69ab31 | | | 55 | } |