listContent.tsx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 ReplaysFilters from 'sentry/views/replays/list/filters';
  12. import ReplayOnboardingPanel from 'sentry/views/replays/list/replayOnboardingPanel';
  13. import ReplaysErroneousDeadRageCards from 'sentry/views/replays/list/replaysErroneousDeadRageCards';
  14. import ReplaysList from 'sentry/views/replays/list/replaysList';
  15. import ReplaysSearch from 'sentry/views/replays/list/search';
  16. export default function ListContent() {
  17. const organization = useOrganization();
  18. const hasSessionReplay = organization.features.includes('session-replay');
  19. const hasSentReplays = useHaveSelectedProjectsSentAnyReplayEvents();
  20. const {
  21. selection: {projects},
  22. } = usePageFilters();
  23. const rageClicksSdkVersion = useProjectSdkNeedsUpdate({
  24. minVersion: MIN_DEAD_RAGE_CLICK_SDK.minVersion,
  25. organization,
  26. projectId: projects.map(String),
  27. });
  28. useRouteAnalyticsParams({
  29. hasSessionReplay,
  30. hasSentReplays: hasSentReplays.hasSentOneReplay,
  31. hasRageClickMinSDK: !rageClicksSdkVersion.needsUpdate,
  32. });
  33. if (hasSentReplays.fetching || rageClicksSdkVersion.isFetching) {
  34. return null;
  35. }
  36. if (!hasSessionReplay || !hasSentReplays.hasSentOneReplay) {
  37. return (
  38. <Fragment>
  39. <FiltersContainer>
  40. <ReplaysFilters />
  41. <ReplaysSearch />
  42. </FiltersContainer>
  43. <ReplayOnboardingPanel />
  44. </Fragment>
  45. );
  46. }
  47. if (rageClicksSdkVersion.needsUpdate) {
  48. return (
  49. <Fragment>
  50. <FiltersContainer>
  51. <ReplaysFilters />
  52. <ReplaysSearch />
  53. </FiltersContainer>
  54. <ReplayRageClickSdkVersionBanner />
  55. <ReplaysList />
  56. </Fragment>
  57. );
  58. }
  59. return (
  60. <Fragment>
  61. <FiltersContainer>
  62. <ReplaysFilters />
  63. </FiltersContainer>
  64. <ReplaysErroneousDeadRageCards />
  65. <FiltersContainer>
  66. <ReplaysSearch />
  67. </FiltersContainer>
  68. <ReplaysList />
  69. </Fragment>
  70. );
  71. }
  72. const FiltersContainer = styled('div')`
  73. display: flex;
  74. flex-direction: row;
  75. gap: ${space(2)};
  76. `;