navigation.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import {Fragment} from 'react';
  2. import Feature from 'sentry/components/acl/feature';
  3. import {SecondaryNav} from 'sentry/components/nav/secondary';
  4. import {t} from 'sentry/locale';
  5. import useOrganization from 'sentry/utils/useOrganization';
  6. type Props = {
  7. children: React.ReactNode;
  8. };
  9. export default function ExploreNavigation({children}: Props) {
  10. const organization = useOrganization();
  11. const hasNavigationV2 = organization?.features.includes('navigation-sidebar-v2');
  12. if (!hasNavigationV2) {
  13. return children;
  14. }
  15. const baseUrl = `/organizations/${organization.slug}/explore`;
  16. // TODO(malwilley): Move other products under the /explore/ route
  17. return (
  18. <Fragment>
  19. <SecondaryNav>
  20. <SecondaryNav.Body>
  21. <SecondaryNav.Section>
  22. <Feature features="performance-trace-explorer">
  23. <SecondaryNav.Item to={`${baseUrl}/traces/`}>
  24. {t('Traces')}
  25. </SecondaryNav.Item>
  26. </Feature>
  27. <Feature features="ourlogs-enabled">
  28. <SecondaryNav.Item to={`${baseUrl}/logs/`}>{t('Logs')}</SecondaryNav.Item>
  29. </Feature>
  30. <Feature features="profiling">
  31. <SecondaryNav.Item to={`${baseUrl}/profiling/`}>
  32. {t('Profiles')}
  33. </SecondaryNav.Item>
  34. </Feature>
  35. <Feature features="session-replay-ui">
  36. <SecondaryNav.Item to={`${baseUrl}/replays/`}>
  37. {t('Replays')}
  38. </SecondaryNav.Item>
  39. </Feature>
  40. <Feature features="discover-basic">
  41. <SecondaryNav.Item to={`${baseUrl}/discover/`}>
  42. {t('Discover')}
  43. </SecondaryNav.Item>
  44. </Feature>
  45. <SecondaryNav.Item to={`${baseUrl}/releases/`}>
  46. {t('Releases')}
  47. </SecondaryNav.Item>
  48. </SecondaryNav.Section>
  49. </SecondaryNav.Body>
  50. </SecondaryNav>
  51. {children}
  52. </Fragment>
  53. );
  54. }