builderBreadCrumbs.tsx 951 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import type {Crumb, CrumbDropdown} from 'sentry/components/breadcrumbs';
  2. import Breadcrumbs from 'sentry/components/breadcrumbs';
  3. import {t} from 'sentry/locale';
  4. import type {Organization} from 'sentry/types';
  5. interface Props {
  6. organization: Organization;
  7. projectSlug: string;
  8. title: string;
  9. alertName?: string;
  10. }
  11. function BuilderBreadCrumbs({title, alertName, projectSlug, organization}: Props) {
  12. const crumbs: (Crumb | CrumbDropdown)[] = [
  13. {
  14. to: `/organizations/${organization.slug}/alerts/rules/`,
  15. label: t('Alerts'),
  16. preservePageFilters: true,
  17. },
  18. {
  19. label: title,
  20. ...(alertName
  21. ? {
  22. to: `/organizations/${organization.slug}/alerts/${projectSlug}/wizard`,
  23. preservePageFilters: true,
  24. }
  25. : {}),
  26. },
  27. ];
  28. if (alertName) {
  29. crumbs.push({label: alertName});
  30. }
  31. return <Breadcrumbs crumbs={crumbs} />;
  32. }
  33. export default BuilderBreadCrumbs;