deadRageClickList.tsx 3.5 KB

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