feedbackListPage.tsx 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. import {RouteComponentProps} from 'react-router';
  2. import styled from '@emotion/styled';
  3. import ErrorBoundary from 'sentry/components/errorBoundary';
  4. import FeedbackEmptyDetails from 'sentry/components/feedback/details/feedbackEmptyDetails';
  5. import {FeedbackDataContext} from 'sentry/components/feedback/feedbackDataContext';
  6. import FeedbackFilters from 'sentry/components/feedback/feedbackFilters';
  7. import FeedbackItemLoader from 'sentry/components/feedback/feedbackItem/feedbackItemLoader';
  8. import FeedbackSearch from 'sentry/components/feedback/feedbackSearch';
  9. import FeedbackList from 'sentry/components/feedback/list/feedbackList';
  10. import FullViewport from 'sentry/components/layouts/fullViewport';
  11. import * as Layout from 'sentry/components/layouts/thirds';
  12. import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
  13. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  14. import {t} from 'sentry/locale';
  15. import {space} from 'sentry/styles/space';
  16. import {decodeList, decodeScalar} from 'sentry/utils/queryString';
  17. import useLocationQuery from 'sentry/utils/url/useLocationQuery';
  18. import useOrganization from 'sentry/utils/useOrganization';
  19. import FluidHeight from 'sentry/views/replays/detail/layout/fluidHeight';
  20. interface Props extends RouteComponentProps<{}, {}, {}> {}
  21. export default function FeedbackListPage({}: Props) {
  22. const organization = useOrganization();
  23. const queryView = useLocationQuery({
  24. fields: {
  25. collapse: ['inbox'],
  26. expand: [
  27. 'owners', // Gives us assignment
  28. 'stats', // Gives us `firstSeen`
  29. ],
  30. limit: 25,
  31. queryReferrer: 'feedback_list_page',
  32. shortIdLookup: 0,
  33. end: decodeScalar,
  34. environment: decodeList,
  35. field: decodeList,
  36. project: decodeList,
  37. query: decodeScalar,
  38. start: decodeScalar,
  39. statsPeriod: decodeScalar,
  40. utc: decodeScalar,
  41. },
  42. });
  43. const {feedbackSlug} = useLocationQuery({
  44. fields: {
  45. feedbackSlug: decodeScalar,
  46. },
  47. });
  48. return (
  49. <SentryDocumentTitle title={t('User Feedback')} orgSlug={organization.slug}>
  50. <FullViewport>
  51. <Layout.Header>
  52. <Layout.HeaderContent>
  53. <Layout.Title>{t('User Feedback')}</Layout.Title>
  54. </Layout.HeaderContent>
  55. </Layout.Header>
  56. <PageFiltersContainer>
  57. <ErrorBoundary>
  58. <FeedbackDataContext queryView={queryView}>
  59. <LayoutGrid>
  60. <FeedbackFilters style={{gridArea: 'filters'}} />
  61. <FeedbackSearch style={{gridArea: 'search'}} />
  62. <Container style={{gridArea: 'list'}}>
  63. <FeedbackList />
  64. </Container>
  65. <Container style={{gridArea: 'details'}}>
  66. {feedbackSlug ? (
  67. <FeedbackItemLoader feedbackSlug={feedbackSlug} />
  68. ) : (
  69. <FeedbackEmptyDetails />
  70. )}
  71. </Container>
  72. </LayoutGrid>
  73. </FeedbackDataContext>
  74. </ErrorBoundary>
  75. </PageFiltersContainer>
  76. </FullViewport>
  77. </SentryDocumentTitle>
  78. );
  79. }
  80. const LayoutGrid = styled('div')`
  81. background: ${p => p.theme.background};
  82. height: 100%;
  83. width: 100%;
  84. padding: ${space(2)} ${space(4)};
  85. overflow: hidden;
  86. display: grid;
  87. grid-template-columns: minmax(390px, 1fr) 2fr;
  88. grid-template-rows: max-content 1fr;
  89. grid-template-areas:
  90. 'filters search'
  91. 'list details';
  92. gap: ${space(2)};
  93. place-items: stretch;
  94. `;
  95. const Container = styled(FluidHeight)`
  96. border: 1px solid ${p => p.theme.border};
  97. border-radius: ${p => p.theme.borderRadius};
  98. `;