rageClickList.tsx 3.5 KB

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