debugIdBundleDeleteButton.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import Access from 'sentry/components/acl/access';
  2. import type {ButtonProps} from 'sentry/components/button';
  3. import {Button} from 'sentry/components/button';
  4. import Confirm from 'sentry/components/confirm';
  5. import {Tooltip} from 'sentry/components/tooltip';
  6. import {IconDelete} from 'sentry/icons';
  7. import {t} from 'sentry/locale';
  8. interface DebugIdBundleDeleteButtonProps {
  9. onDelete: () => void;
  10. size?: ButtonProps['size'];
  11. }
  12. export function DebugIdBundleDeleteButton({
  13. onDelete,
  14. size = 'xs',
  15. }: DebugIdBundleDeleteButtonProps) {
  16. return (
  17. <Access access={['project:releases']}>
  18. {({hasAccess}) => (
  19. <Tooltip
  20. disabled={hasAccess}
  21. title={t('You do not have permission to delete bundles.')}
  22. >
  23. <Confirm
  24. onConfirm={onDelete}
  25. message={t('Are you sure you want to delete this bundle?')}
  26. disabled={!hasAccess}
  27. >
  28. <Button icon={<IconDelete size="xs" />} size={size} disabled={!hasAccess}>
  29. {t('Delete Bundle')}
  30. </Button>
  31. </Confirm>
  32. </Tooltip>
  33. )}
  34. </Access>
  35. );
  36. }