viewIssueLink.tsx 769 B

123456789101112131415161718192021222324
  1. import ShortId from 'sentry/components/shortId';
  2. import {BreadcrumbTypeDefault, Crumb} from 'sentry/types/breadcrumbs';
  3. import useOrganization from 'sentry/utils/useOrganization';
  4. import {breadcrumbHasIssue} from 'sentry/views/replays/detail/console/utils';
  5. type Props = {
  6. breadcrumb: Extract<Crumb, BreadcrumbTypeDefault>;
  7. };
  8. function ViewIssueLink({breadcrumb}: Props) {
  9. const organization = useOrganization();
  10. if (!breadcrumbHasIssue(breadcrumb)) {
  11. return null;
  12. }
  13. const {groupId, groupShortId, eventId} = breadcrumb.data || {};
  14. const to = {
  15. pathname: `/organizations/${organization.slug}/issues/${groupId}/events/${eventId}/?referrer=replay-console`,
  16. };
  17. return <ShortId to={to} shortId={groupShortId} />;
  18. }
  19. export default ViewIssueLink;