projectScoreCards.tsx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import styled from '@emotion/styled';
  2. import type {Location} from 'history';
  3. import {space} from 'sentry/styles/space';
  4. import type {Organization, PageFilters, Project} from 'sentry/types';
  5. import {SessionFieldWithOperation} from 'sentry/types';
  6. import {isPlatformANRCompatible} from 'sentry/views/projectDetail/utils';
  7. import {ProjectAnrScoreCard} from './projectAnrScoreCard';
  8. import ProjectApdexScoreCard from './projectApdexScoreCard';
  9. import ProjectStabilityScoreCard from './projectStabilityScoreCard';
  10. import ProjectVelocityScoreCard from './projectVelocityScoreCard';
  11. type Props = {
  12. hasSessions: boolean | null;
  13. isProjectStabilized: boolean;
  14. location: Location;
  15. organization: Organization;
  16. selection: PageFilters;
  17. hasTransactions?: boolean;
  18. project?: Project;
  19. query?: string;
  20. };
  21. function ProjectScoreCards({
  22. organization,
  23. selection,
  24. isProjectStabilized,
  25. hasSessions,
  26. hasTransactions,
  27. query,
  28. location,
  29. project,
  30. }: Props) {
  31. return (
  32. <CardWrapper>
  33. <ProjectStabilityScoreCard
  34. selection={selection}
  35. isProjectStabilized={isProjectStabilized}
  36. hasSessions={hasSessions}
  37. query={query}
  38. field={SessionFieldWithOperation.CRASH_FREE_RATE_SESSIONS}
  39. />
  40. <ProjectStabilityScoreCard
  41. selection={selection}
  42. isProjectStabilized={isProjectStabilized}
  43. hasSessions={hasSessions}
  44. query={query}
  45. field={SessionFieldWithOperation.CRASH_FREE_RATE_USERS}
  46. />
  47. <ProjectVelocityScoreCard
  48. organization={organization}
  49. selection={selection}
  50. isProjectStabilized={isProjectStabilized}
  51. query={query}
  52. />
  53. {isPlatformANRCompatible(project?.platform) ? (
  54. <ProjectAnrScoreCard
  55. organization={organization}
  56. selection={selection}
  57. isProjectStabilized={isProjectStabilized}
  58. query={query}
  59. location={location}
  60. />
  61. ) : (
  62. <ProjectApdexScoreCard
  63. organization={organization}
  64. selection={selection}
  65. isProjectStabilized={isProjectStabilized}
  66. hasTransactions={hasTransactions}
  67. query={query}
  68. />
  69. )}
  70. </CardWrapper>
  71. );
  72. }
  73. const CardWrapper = styled('div')`
  74. @media (min-width: ${p => p.theme.breakpoints.medium}) {
  75. display: grid;
  76. grid-column-gap: ${space(2)};
  77. grid-template-columns: repeat(2, minmax(0, 1fr));
  78. }
  79. @media (min-width: 1600px) {
  80. grid-template-columns: repeat(4, minmax(0, 1fr));
  81. }
  82. `;
  83. export default ProjectScoreCards;