frontendPageHeader.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import normalizeUrl from 'sentry/utils/url/normalizeUrl';
  2. import useOrganization from 'sentry/utils/useOrganization';
  3. import {
  4. DomainViewHeader,
  5. type Props as HeaderProps,
  6. } from 'sentry/views/insights/pages/domainViewHeader';
  7. import {
  8. FRONTEND_LANDING_SUB_PATH,
  9. FRONTEND_LANDING_TITLE,
  10. MODULES,
  11. } from 'sentry/views/insights/pages/frontend/settings';
  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 FrontendHeader({
  23. module,
  24. headerActions,
  25. headerTitle,
  26. breadcrumbs,
  27. tabs,
  28. hideDefaultTabs,
  29. }: Props) {
  30. const {slug} = useOrganization();
  31. const frontendBaseUrl = normalizeUrl(
  32. `/organizations/${slug}/${DOMAIN_VIEW_BASE_URL}/${FRONTEND_LANDING_SUB_PATH}/`
  33. );
  34. return (
  35. <DomainViewHeader
  36. domainBaseUrl={frontendBaseUrl}
  37. domainTitle={FRONTEND_LANDING_TITLE}
  38. modules={MODULES}
  39. selectedModule={module}
  40. additionalBreadCrumbs={breadcrumbs}
  41. additonalHeaderActions={headerActions}
  42. headerTitle={headerTitle}
  43. tabs={tabs}
  44. hideDefaultTabs={hideDefaultTabs}
  45. />
  46. );
  47. }