index.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import Feature from 'sentry/components/acl/feature';
  2. import FeatureDisabled from 'sentry/components/acl/featureDisabled';
  3. import {t} from 'sentry/locale';
  4. import useOrganization from 'sentry/utils/useOrganization';
  5. import Trace, {NewTraceView} from 'sentry/views/replays/detail/trace/trace';
  6. import type {ReplayRecord} from '../../types';
  7. const features = ['organizations:performance-view'];
  8. function PerfDisabled() {
  9. return (
  10. <FeatureDisabled
  11. featureName={t('Performance Monitoring')}
  12. features={features}
  13. hideHelpToggle
  14. message={t('Requires performance monitoring.')}
  15. />
  16. );
  17. }
  18. function TraceFeature({replayRecord}: {replayRecord: ReplayRecord | undefined}) {
  19. const organization = useOrganization();
  20. return (
  21. <Feature
  22. features={features}
  23. hookName={undefined}
  24. organization={organization}
  25. renderDisabled={PerfDisabled}
  26. >
  27. {organization.features.includes('replay-trace-view-v1') ? (
  28. <NewTraceView replayRecord={replayRecord} />
  29. ) : (
  30. <Trace replayRecord={replayRecord} />
  31. )}
  32. </Feature>
  33. );
  34. }
  35. export default TraceFeature;