subscribeAction.tsx 843 B

12345678910111213141516171819202122232425262728293031
  1. import ActionButton from 'sentry/components/actions/button';
  2. import {IconBell} from 'sentry/icons';
  3. import {t} from 'sentry/locale';
  4. import {Group} from 'sentry/types';
  5. import {getSubscriptionReason} from '../utils';
  6. type Props = {
  7. group: Group;
  8. onClick: (event: React.MouseEvent) => void;
  9. disabled?: boolean;
  10. };
  11. function SubscribeAction({disabled, group, onClick}: Props) {
  12. const disabledNotifications = group.subscriptionDetails?.disabled ?? false;
  13. return (
  14. <ActionButton
  15. disabled={disabled || disabledNotifications}
  16. title={getSubscriptionReason(group, true)}
  17. tooltipProps={{delay: 300}}
  18. priority={group.isSubscribed ? 'primary' : 'default'}
  19. size="xs"
  20. aria-label={t('Subscribe')}
  21. onClick={onClick}
  22. icon={<IconBell size="xs" />}
  23. />
  24. );
  25. }
  26. export default SubscribeAction;