viewIssueLink.tsx 857 B

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