index.tsx 810 B

1234567891011121314151617181920212223242526272829
  1. import {cloneElement, isValidElement} from 'react';
  2. import NoProjectMessage from 'sentry/components/noProjectMessage';
  3. import useOrganization from 'sentry/utils/useOrganization';
  4. type Props = {
  5. children: React.ReactNode;
  6. };
  7. function AlertsContainer({children}: Props) {
  8. const organization = useOrganization();
  9. const hasMetricAlerts = organization.features.includes('incidents');
  10. // Uptime alerts are not behind a feature flag at the moment
  11. const hasUptimeAlerts = true;
  12. const content =
  13. children && isValidElement(children)
  14. ? cloneElement<any>(children, {
  15. organization,
  16. hasMetricAlerts,
  17. hasUptimeAlerts,
  18. })
  19. : children;
  20. return <NoProjectMessage organization={organization}>{content}</NoProjectMessage>;
  21. }
  22. export default AlertsContainer;