crashReportSection.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import styled from '@emotion/styled';
  2. import Alert from 'sentry/components/alert';
  3. import EventOrGroupExtraDetails from 'sentry/components/eventOrGroupExtraDetails';
  4. import EventOrGroupHeader from 'sentry/components/eventOrGroupHeader';
  5. import useFetchCrashReport from 'sentry/components/feedback/feedbackItem/useFetchCrashReport';
  6. import Placeholder from 'sentry/components/placeholder';
  7. import {tct} from 'sentry/locale';
  8. import {space} from 'sentry/styles/space';
  9. import type {Organization} from 'sentry/types/organization';
  10. interface Props {
  11. crashReportId: string;
  12. organization: Organization;
  13. projectSlug: string;
  14. }
  15. export default function CrashReportSection({
  16. crashReportId,
  17. organization,
  18. projectSlug,
  19. }: Props) {
  20. const {isFetching, groupData} = useFetchCrashReport({
  21. crashReportId,
  22. organization,
  23. projectSlug,
  24. });
  25. if (isFetching) {
  26. return <Placeholder height="92px" />;
  27. }
  28. if (!groupData) {
  29. return (
  30. <AlertNoMargin type="error" showIcon>
  31. {tct('Unable to find error [id]', {id: crashReportId})}
  32. </AlertNoMargin>
  33. );
  34. }
  35. return (
  36. <IssueDetailsContainer>
  37. <EventOrGroupHeader
  38. eventId={crashReportId}
  39. organization={organization}
  40. data={groupData}
  41. />
  42. <EventOrGroupExtraDetails data={groupData} />
  43. </IssueDetailsContainer>
  44. );
  45. }
  46. const AlertNoMargin = styled(Alert)`
  47. margin: 0;
  48. `;
  49. const IssueDetailsContainer = styled('div')`
  50. border: 1px solid ${p => p.theme.border};
  51. border-radius: ${p => p.theme.borderRadius};
  52. position: relative;
  53. padding: ${space(1.5)} ${space(1.5)} ${space(1.5)} ${space(2)};
  54. overflow: auto;
  55. `;