builderBreadCrumbs.tsx 1.1 KB

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