navigation.tsx 2.3 KB

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