index.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import {RouteComponentProps} from 'react-router';
  2. import Feature from 'sentry/components/acl/feature';
  3. import {Alert} from 'sentry/components/alert';
  4. import HookOrDefault from 'sentry/components/hookOrDefault';
  5. import * as Layout from 'sentry/components/layouts/thirds';
  6. import NoProjectMessage from 'sentry/components/noProjectMessage';
  7. import {t} from 'sentry/locale';
  8. import {Organization} from 'sentry/types';
  9. import withOrganization from 'sentry/utils/withOrganization';
  10. type Props = RouteComponentProps<{}, {}> & {
  11. children: React.ReactChildren;
  12. organization: Organization;
  13. };
  14. function renderNoAccess() {
  15. return (
  16. <Layout.Page withPadding>
  17. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  18. </Layout.Page>
  19. );
  20. }
  21. const BetaGracePeriodAlertHook = HookOrDefault({
  22. hookName: 'component:replay-beta-grace-period-alert',
  23. });
  24. function ReplaysContainer({organization, children}: Props) {
  25. return (
  26. <Feature
  27. features={['session-replay-ui']}
  28. organization={organization}
  29. renderDisabled={renderNoAccess}
  30. >
  31. <NoProjectMessage organization={organization}>
  32. <Feature
  33. features={['session-replay-beta-grace']}
  34. organization={organization}
  35. renderDisabled={false}
  36. >
  37. <BetaGracePeriodAlertHook organization={organization} />
  38. </Feature>
  39. {children}
  40. </NoProjectMessage>
  41. </Feature>
  42. );
  43. }
  44. export default withOrganization(ReplaysContainer);