projectScoreCards.tsx 2.5 KB

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