deadRageClickList.tsx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import {browserHistory} from 'react-router';
  2. import styled from '@emotion/styled';
  3. import Alert from 'sentry/components/alert';
  4. import * as Layout from 'sentry/components/layouts/thirds';
  5. import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
  6. import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
  7. import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
  8. import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
  9. import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
  10. import {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionTooltip';
  11. import Pagination from 'sentry/components/pagination';
  12. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  13. import {t} from 'sentry/locale';
  14. import {space} from 'sentry/styles/space';
  15. import useDeadRageSelectors from 'sentry/utils/replays/hooks/useDeadRageSelectors';
  16. import {useLocation} from 'sentry/utils/useLocation';
  17. import useOrganization from 'sentry/utils/useOrganization';
  18. import SelectorTable from 'sentry/views/replays/deadRageClick/selectorTable';
  19. import ReplayTabs from 'sentry/views/replays/tabs';
  20. export default function DeadRageClickList() {
  21. const organization = useOrganization();
  22. const location = useLocation();
  23. const hasDeadClickFeature = organization.features.includes(
  24. 'session-replay-rage-dead-selectors'
  25. );
  26. const {isLoading, isError, data, pageLinks} = useDeadRageSelectors({
  27. per_page: 50,
  28. sort: '-count_dead_clicks',
  29. cursor: location.query.cursor,
  30. prefix: '',
  31. isWidgetData: false,
  32. });
  33. if (!hasDeadClickFeature) {
  34. return (
  35. <Layout.Page withPadding>
  36. <Alert type="warning">{t("You don't have access to this feature")}</Alert>
  37. </Layout.Page>
  38. );
  39. }
  40. return (
  41. <SentryDocumentTitle
  42. title={t('Top Selectors with Dead Clicks')}
  43. orgSlug={organization.slug}
  44. >
  45. <Layout.Header>
  46. <Layout.HeaderContent>
  47. <Layout.Title>
  48. {t('Top Selectors with Dead and Rage Clicks')}
  49. <PageHeadingQuestionTooltip
  50. title={t('See the top selectors your users have dead and rage clicked on.')}
  51. docsUrl="https://docs.sentry.io/product/session-replay/replay-page-and-filters/"
  52. />
  53. </Layout.Title>
  54. </Layout.HeaderContent>
  55. <div /> {/* wraps the tabs below the page title */}
  56. <ReplayTabs selected="selectors" />
  57. </Layout.Header>
  58. <PageFiltersContainer>
  59. <Layout.Body>
  60. <Layout.Main fullWidth>
  61. <PageFilterBar condensed>
  62. <ProjectPageFilter resetParamsOnChange={['cursor']} />
  63. <EnvironmentPageFilter resetParamsOnChange={['cursor']} />
  64. <DatePageFilter resetParamsOnChange={['cursor']} />
  65. </PageFilterBar>
  66. <LayoutGap>
  67. <SelectorTable
  68. data={data}
  69. isError={isError}
  70. isLoading={isLoading}
  71. location={location}
  72. clickCountColumns={[
  73. {key: 'count_dead_clicks', name: 'dead clicks'},
  74. {key: 'count_rage_clicks', name: 'rage clicks'},
  75. ]}
  76. clickCountSortable
  77. />
  78. </LayoutGap>
  79. <PaginationNoMargin
  80. pageLinks={pageLinks}
  81. onCursor={(cursor, path, searchQuery) => {
  82. browserHistory.push({
  83. pathname: path,
  84. query: {...searchQuery, cursor},
  85. });
  86. }}
  87. />
  88. </Layout.Main>
  89. </Layout.Body>
  90. </PageFiltersContainer>
  91. </SentryDocumentTitle>
  92. );
  93. }
  94. const LayoutGap = styled('div')`
  95. margin-top: ${space(2)};
  96. `;
  97. const PaginationNoMargin = styled(Pagination)`
  98. margin: 0;
  99. `;