pathnames.tsx 648 B

1234567891011121314151617181920
  1. import {prefersStackedNav} from 'sentry/components/nav/prefersStackedNav';
  2. import type {Organization} from 'sentry/types/organization';
  3. import normalizeUrl from 'sentry/utils/url/normalizeUrl';
  4. const LEGACY_DISCOVER_BASE_PATHNAME = 'discover';
  5. const DISCOVER_BASE_PATHNAME = 'explore/discover';
  6. export function makeDiscoverPathname({
  7. path,
  8. organization,
  9. }: {
  10. organization: Organization;
  11. path: '/' | `/${string}/`;
  12. }) {
  13. return normalizeUrl(
  14. prefersStackedNav()
  15. ? `/organizations/${organization.slug}/${DISCOVER_BASE_PATHNAME}${path}`
  16. : `/organizations/${organization.slug}/${LEGACY_DISCOVER_BASE_PATHNAME}${path}`
  17. );
  18. }