aiPageHeader.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import normalizeUrl from 'sentry/utils/url/normalizeUrl';
  2. import useOrganization from 'sentry/utils/useOrganization';
  3. import {
  4. AI_LANDING_SUB_PATH,
  5. AI_LANDING_TITLE,
  6. MODULES,
  7. } from 'sentry/views/insights/pages/ai/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. export function AiHeader({
  22. module,
  23. headerTitle,
  24. headerActions,
  25. breadcrumbs,
  26. tabs,
  27. hideDefaultTabs,
  28. }: Props) {
  29. const {slug} = useOrganization();
  30. const aiBaseUrl = normalizeUrl(
  31. `/organizations/${slug}/${DOMAIN_VIEW_BASE_URL}/${AI_LANDING_SUB_PATH}/`
  32. );
  33. return (
  34. <DomainViewHeader
  35. domainBaseUrl={aiBaseUrl}
  36. headerTitle={headerTitle}
  37. domainTitle={AI_LANDING_TITLE}
  38. modules={MODULES}
  39. selectedModule={module}
  40. additonalHeaderActions={headerActions}
  41. additionalBreadCrumbs={breadcrumbs}
  42. tabs={tabs}
  43. hideDefaultTabs={hideDefaultTabs}
  44. />
  45. );
  46. }