listContent.tsx 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import {Fragment} from 'react';
  2. import styled from '@emotion/styled';
  3. import ReplayRageClickSdkVersionBanner from 'sentry/components/replays/replayRageClickSdkVersionBanner';
  4. import {space} from 'sentry/styles/space';
  5. import {useHaveSelectedProjectsSentAnyReplayEvents} from 'sentry/utils/replays/hooks/useReplayOnboarding';
  6. import {MIN_DEAD_RAGE_CLICK_SDK} from 'sentry/utils/replays/sdkVersions';
  7. import useRouteAnalyticsParams from 'sentry/utils/routeAnalytics/useRouteAnalyticsParams';
  8. import useOrganization from 'sentry/utils/useOrganization';
  9. import usePageFilters from 'sentry/utils/usePageFilters';
  10. import useProjectSdkNeedsUpdate from 'sentry/utils/useProjectSdkNeedsUpdate';
  11. import DeadRageSelectorCards from 'sentry/views/replays/deadRageClick/deadRageSelectorCards';
  12. import ReplaysFilters from 'sentry/views/replays/list/filters';
  13. import ReplayOnboardingPanel from 'sentry/views/replays/list/replayOnboardingPanel';
  14. import ReplaysErroneousDeadRageCards from 'sentry/views/replays/list/replaysErroneousDeadRageCards';
  15. import ReplaysList from 'sentry/views/replays/list/replaysList';
  16. import ReplaysSearch from 'sentry/views/replays/list/search';
  17. export default function ListContent() {
  18. const organization = useOrganization();
  19. const hasSessionReplay = organization.features.includes('session-replay');
  20. const hasSentReplays = useHaveSelectedProjectsSentAnyReplayEvents();
  21. const hasdeadRageClickFeature = organization.features.includes(
  22. 'session-replay-rage-dead-selectors'
  23. );
  24. const {
  25. selection: {projects},
  26. } = usePageFilters();
  27. const rageClicksSdkVersion = useProjectSdkNeedsUpdate({
  28. minVersion: MIN_DEAD_RAGE_CLICK_SDK.minVersion,
  29. organization,
  30. projectId: projects.map(String),
  31. });
  32. useRouteAnalyticsParams({
  33. hasSessionReplay,
  34. hasSentReplays: hasSentReplays.hasSentOneReplay,
  35. hasRageClickMinSDK: !rageClicksSdkVersion.needsUpdate,
  36. });
  37. if (hasSentReplays.fetching || rageClicksSdkVersion.isFetching) {
  38. return null;
  39. }
  40. if (!hasSessionReplay || !hasSentReplays.hasSentOneReplay) {
  41. return (
  42. <Fragment>
  43. <FiltersContainer>
  44. <ReplaysFilters />
  45. <ReplaysSearch />
  46. </FiltersContainer>
  47. <ReplayOnboardingPanel />
  48. </Fragment>
  49. );
  50. }
  51. if (rageClicksSdkVersion.needsUpdate) {
  52. return (
  53. <Fragment>
  54. <FiltersContainer>
  55. <ReplaysFilters />
  56. <ReplaysSearch />
  57. </FiltersContainer>
  58. <ReplayRageClickSdkVersionBanner />
  59. <ReplaysList />
  60. </Fragment>
  61. );
  62. }
  63. return (
  64. <Fragment>
  65. <FiltersContainer>
  66. <ReplaysFilters />
  67. <ReplaysSearch />
  68. </FiltersContainer>
  69. {hasdeadRageClickFeature ? (
  70. <DeadRageSelectorCards />
  71. ) : (
  72. <ReplaysErroneousDeadRageCards />
  73. )}
  74. <ReplaysList />
  75. </Fragment>
  76. );
  77. }
  78. const FiltersContainer = styled('div')`
  79. display: flex;
  80. flex-direction: row;
  81. gap: ${space(2)};
  82. `;