index.tsx 646 B

12345678910111213141516171819202122232425
  1. import {cloneElement, Fragment, isValidElement} from 'react';
  2. import {Organization} from 'sentry/types';
  3. import withOrganization from 'sentry/utils/withOrganization';
  4. type Props = {
  5. organization: Organization;
  6. children: React.ReactNode;
  7. };
  8. function AlertsContainer({organization, children}: Props) {
  9. const hasMetricAlerts = organization.features.includes('incidents');
  10. const content =
  11. children && isValidElement(children)
  12. ? cloneElement(children, {
  13. organization,
  14. hasMetricAlerts,
  15. })
  16. : children;
  17. return <Fragment>{content}</Fragment>;
  18. }
  19. export default withOrganization(AlertsContainer);