index.tsx 586 B

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