backendPageHeader.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import normalizeUrl from 'sentry/utils/url/normalizeUrl';
  2. import useOrganization from 'sentry/utils/useOrganization';
  3. import {
  4. BACKEND_LANDING_SUB_PATH,
  5. BACKEND_LANDING_TITLE,
  6. MODULES,
  7. } from 'sentry/views/insights/pages/backend/settings';
  8. import {
  9. DomainViewHeader,
  10. type Props as HeaderProps,
  11. } from 'sentry/views/insights/pages/domainViewHeader';
  12. import {DOMAIN_VIEW_BASE_URL} from 'sentry/views/insights/pages/settings';
  13. type Props = {
  14. headerTitle: HeaderProps['headerTitle'];
  15. breadcrumbs?: HeaderProps['additionalBreadCrumbs'];
  16. headerActions?: HeaderProps['additonalHeaderActions'];
  17. hideDefaultTabs?: HeaderProps['hideDefaultTabs'];
  18. module?: HeaderProps['selectedModule'];
  19. tabs?: HeaderProps['tabs'];
  20. };
  21. // TODO - add props to append to breadcrumbs and change title
  22. export function BackendHeader({
  23. module,
  24. headerActions,
  25. headerTitle,
  26. breadcrumbs,
  27. tabs,
  28. hideDefaultTabs,
  29. }: Props) {
  30. const {slug} = useOrganization();
  31. const backendBaseUrl = normalizeUrl(
  32. `/organizations/${slug}/${DOMAIN_VIEW_BASE_URL}/${BACKEND_LANDING_SUB_PATH}/`
  33. );
  34. return (
  35. <DomainViewHeader
  36. domainBaseUrl={backendBaseUrl}
  37. domainTitle={BACKEND_LANDING_TITLE}
  38. headerTitle={headerTitle}
  39. additonalHeaderActions={headerActions}
  40. modules={MODULES}
  41. selectedModule={module}
  42. additionalBreadCrumbs={breadcrumbs}
  43. tabs={tabs}
  44. hideDefaultTabs={hideDefaultTabs}
  45. />
  46. );
  47. }