resourcesAndPossibleSolutions.tsx 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import {css} from '@emotion/react';
  2. import styled from '@emotion/styled';
  3. import {Resources} from 'sentry/components/events/interfaces/performance/resources';
  4. import {t} from 'sentry/locale';
  5. import ConfigStore from 'sentry/stores/configStore';
  6. import {space} from 'sentry/styles/space';
  7. import type {Event} from 'sentry/types/event';
  8. import type {Group} from 'sentry/types/group';
  9. import type {Project} from 'sentry/types/project';
  10. import {getConfigForIssueType} from 'sentry/utils/issueTypeConfig';
  11. import {SectionKey} from 'sentry/views/issueDetails/streamline/context';
  12. import {InterimSection} from 'sentry/views/issueDetails/streamline/interimSection';
  13. import {useHasStreamlinedUI} from 'sentry/views/issueDetails/utils';
  14. type Props = {
  15. event: Event;
  16. group: Group;
  17. project: Project;
  18. };
  19. // This section provides users with resources and possible solutions on how to resolve an issue
  20. export function ResourcesAndPossibleSolutions({event, project, group}: Props) {
  21. const config = getConfigForIssueType(group, project);
  22. const isSelfHostedErrorsOnly = ConfigStore.get('isSelfHostedErrorsOnly');
  23. const hasStreamlinedUI = useHasStreamlinedUI();
  24. if (isSelfHostedErrorsOnly || !config.resources || hasStreamlinedUI) {
  25. return null;
  26. }
  27. return (
  28. <Wrapper
  29. title={t('Resources and Possible Solutions')}
  30. configResources={!!config.resources}
  31. type={SectionKey.RESOURCES}
  32. >
  33. <Content>
  34. <Resources
  35. eventPlatform={event.platform}
  36. groupId={group.id}
  37. configResources={config.resources}
  38. />
  39. </Content>
  40. </Wrapper>
  41. );
  42. }
  43. const Content = styled('div')`
  44. display: flex;
  45. flex-direction: column;
  46. gap: ${space(2)};
  47. `;
  48. const Wrapper = styled(InterimSection)<{configResources: boolean}>`
  49. @media (min-width: ${p => p.theme.breakpoints.xlarge}) {
  50. ${p =>
  51. !p.configResources &&
  52. css`
  53. && {
  54. padding-top: ${space(3)};
  55. }
  56. `}
  57. }
  58. `;