feedbackListPage.tsx 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import {browserHistory, RouteComponentProps} from 'react-router';
  2. import styled from '@emotion/styled';
  3. import DatePageFilter from 'sentry/components/datePageFilter';
  4. import EnvironmentPageFilter from 'sentry/components/environmentPageFilter';
  5. import FeedbackTable from 'sentry/components/feedback/table/feedbackTable';
  6. import useFeedbackListQueryParams from 'sentry/components/feedback/useFeedbackListQueryParams';
  7. import useFetchFeedbackList from 'sentry/components/feedback/useFetchFeedbackList';
  8. import * as Layout from 'sentry/components/layouts/thirds';
  9. import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
  10. import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
  11. import {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionTooltip';
  12. import Pagination from 'sentry/components/pagination';
  13. import ProjectPageFilter from 'sentry/components/projectPageFilter';
  14. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  15. import {t} from 'sentry/locale';
  16. import {space} from 'sentry/styles/space';
  17. import type {FeedbackListQueryParams} from 'sentry/utils/feedback/types';
  18. import useOrganization from 'sentry/utils/useOrganization';
  19. interface Props extends RouteComponentProps<{}, {}, FeedbackListQueryParams> {}
  20. export default function FeedbackListPage({location}: Props) {
  21. const organization = useOrganization();
  22. const query = useFeedbackListQueryParams({
  23. location,
  24. queryReferrer: 'feedback_list_page',
  25. });
  26. const {isLoading, isError, data, pageLinks} = useFetchFeedbackList({query}, {});
  27. return (
  28. <SentryDocumentTitle title={t(`Bug Reports`)} orgSlug={organization.slug}>
  29. <Layout.Header>
  30. <Layout.HeaderContent>
  31. <Layout.Title>
  32. {t('Bug Reports')}
  33. <PageHeadingQuestionTooltip
  34. title={t(
  35. 'Feedback submitted by users who experienced an error while using your application, including their name, email address, and any additional comments.'
  36. )}
  37. docsUrl="https://docs.sentry.io/product/user-feedback/"
  38. />
  39. </Layout.Title>
  40. </Layout.HeaderContent>
  41. </Layout.Header>
  42. <PageFiltersContainer>
  43. <Layout.Body>
  44. <Layout.Main fullWidth>
  45. <LayoutGap>
  46. <PageFilterBar condensed>
  47. <ProjectPageFilter resetParamsOnChange={['cursor']} />
  48. <EnvironmentPageFilter resetParamsOnChange={['cursor']} />
  49. <DatePageFilter alignDropdown="left" resetParamsOnChange={['cursor']} />
  50. </PageFilterBar>
  51. <FeedbackTable
  52. data={data ?? []}
  53. isError={isError}
  54. isLoading={isLoading}
  55. location={location}
  56. />
  57. </LayoutGap>
  58. <PaginationNoMargin
  59. pageLinks={pageLinks}
  60. onCursor={(cursor, path, searchQuery) => {
  61. browserHistory.push({
  62. pathname: path,
  63. query: {...searchQuery, cursor},
  64. });
  65. }}
  66. />
  67. </Layout.Main>
  68. </Layout.Body>
  69. </PageFiltersContainer>
  70. </SentryDocumentTitle>
  71. );
  72. }
  73. const LayoutGap = styled('div')`
  74. display: grid;
  75. gap: ${space(2)};
  76. `;
  77. const PaginationNoMargin = styled(Pagination)`
  78. margin: 0;
  79. `;