index.tsx 839 B

123456789101112131415161718192021222324252627
  1. import {cloneElement, isValidElement} from 'react';
  2. import Feature from 'sentry/components/acl/feature';
  3. import NoProjectMessage from 'sentry/components/noProjectMessage';
  4. import {Organization} from 'sentry/types';
  5. import withOrganization from 'sentry/utils/withOrganization';
  6. type Props = {
  7. organization: Organization;
  8. children?: React.ReactNode;
  9. };
  10. function TeamInsightsContainer({children, organization}: Props) {
  11. return (
  12. <Feature organization={organization} features={['team-insights']}>
  13. <NoProjectMessage organization={organization}>
  14. {children && isValidElement(children)
  15. ? cloneElement<any>(children, {
  16. organization,
  17. })
  18. : (children as React.ReactChild)}
  19. </NoProjectMessage>
  20. </Feature>
  21. );
  22. }
  23. export default withOrganization(TeamInsightsContainer);