navigation.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import {Fragment} from 'react';
  2. import {SecondaryNav} from 'sentry/components/nav/secondary';
  3. import {t} from 'sentry/locale';
  4. import type {RouteComponentProps} from 'sentry/types/legacyReactRouter';
  5. import useOrganization from 'sentry/utils/useOrganization';
  6. interface IssuesWrapperProps extends RouteComponentProps<{}, {}> {
  7. children: React.ReactNode;
  8. }
  9. export function IssueNavigation({children}: IssuesWrapperProps) {
  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}/issues`;
  16. return (
  17. <Fragment>
  18. <SecondaryNav>
  19. <SecondaryNav.Body>
  20. <SecondaryNav.Section>
  21. <SecondaryNav.Item to={baseUrl}>{t('All')}</SecondaryNav.Item>
  22. <SecondaryNav.Item to={`${baseUrl}/feedback/`}>
  23. {t('Feedback')}
  24. </SecondaryNav.Item>
  25. </SecondaryNav.Section>
  26. </SecondaryNav.Body>
  27. <SecondaryNav.Footer>
  28. <SecondaryNav.Item to={`${baseUrl}/alerts/`}>{t('Alerts')}</SecondaryNav.Item>
  29. </SecondaryNav.Footer>
  30. </SecondaryNav>
  31. {children}
  32. </Fragment>
  33. );
  34. }