index.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import {Fragment, ReactChild} from 'react';
  2. import ProjectsStore from 'sentry/stores/projectsStore';
  3. import {IssueCategory} from 'sentry/types';
  4. import {StackTracePreview} from './stackTracePreview';
  5. type GroupPreviewTooltipProps = {
  6. children: ReactChild;
  7. groupId: string;
  8. issueCategory: IssueCategory;
  9. // we need eventId only when hovering over Event, not Group
  10. // (different API call is made to get the stack trace then)
  11. eventId?: string;
  12. groupingCurrentLevel?: number;
  13. projectId?: string;
  14. };
  15. const GroupPreviewTooltip = ({
  16. children,
  17. eventId,
  18. groupId,
  19. groupingCurrentLevel,
  20. issueCategory,
  21. projectId,
  22. }: GroupPreviewTooltipProps) => {
  23. switch (issueCategory) {
  24. case IssueCategory.ERROR:
  25. return (
  26. <StackTracePreview
  27. issueId={groupId}
  28. groupingCurrentLevel={groupingCurrentLevel}
  29. eventId={eventId}
  30. projectSlug={eventId ? ProjectsStore.getById(projectId)?.slug : undefined}
  31. >
  32. {children}
  33. </StackTracePreview>
  34. );
  35. default:
  36. return <Fragment>{children}</Fragment>;
  37. }
  38. };
  39. export default GroupPreviewTooltip;