feedbackListPage.tsx 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import {Fragment} from 'react';
  2. import {RouteComponentProps} from 'react-router';
  3. import styled from '@emotion/styled';
  4. import {Button} from 'sentry/components/button';
  5. import ErrorBoundary from 'sentry/components/errorBoundary';
  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 FeedbackSetupPanel from 'sentry/components/feedback/feedbackSetupPanel';
  10. import FeedbackList from 'sentry/components/feedback/list/feedbackList';
  11. import {
  12. useFeedbackHasSlug,
  13. useHaveSelectedProjectsSetupFeedback,
  14. } from 'sentry/components/feedback/useFeedbackOnboarding';
  15. import {FeedbackQueryKeys} from 'sentry/components/feedback/useFeedbackQueryKeys';
  16. import FullViewport from 'sentry/components/layouts/fullViewport';
  17. import * as Layout from 'sentry/components/layouts/thirds';
  18. import ExternalLink from 'sentry/components/links/externalLink';
  19. import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
  20. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  21. import {Tooltip} from 'sentry/components/tooltip';
  22. import {t, tct} from 'sentry/locale';
  23. import {space} from 'sentry/styles/space';
  24. import {trackAnalytics} from 'sentry/utils/analytics';
  25. import {useLocation} from 'sentry/utils/useLocation';
  26. import useOrganization from 'sentry/utils/useOrganization';
  27. import {normalizeUrl} from 'sentry/utils/withDomainRequired';
  28. import FluidHeight from 'sentry/views/replays/detail/layout/fluidHeight';
  29. interface Props extends RouteComponentProps<{}, {}, {}> {}
  30. export default function FeedbackListPage({}: Props) {
  31. const organization = useOrganization();
  32. const {hasSetupOneFeedback} = useHaveSelectedProjectsSetupFeedback();
  33. const {hasSlug} = useFeedbackHasSlug();
  34. const location = useLocation();
  35. return (
  36. <SentryDocumentTitle title={t('User Feedback')} orgSlug={organization.slug}>
  37. <FullViewport>
  38. <FeedbackQueryKeys organization={organization}>
  39. <Layout.Header>
  40. <Layout.HeaderContent>
  41. <Layout.Title>{t('User Feedback')}</Layout.Title>
  42. </Layout.HeaderContent>
  43. <Layout.HeaderActions>
  44. <Tooltip
  45. title={tct('View [link:error-associated feedback reports].', {
  46. link: (
  47. <ExternalLink href="https://docs.sentry.io/product/user-feedback/" />
  48. ),
  49. })}
  50. position="left"
  51. isHoverable
  52. >
  53. <Button
  54. size="sm"
  55. priority="default"
  56. to={{
  57. pathname: normalizeUrl(
  58. `/organizations/${organization.slug}/user-feedback/`
  59. ),
  60. query: {
  61. ...location.query,
  62. query: undefined,
  63. cursor: undefined,
  64. },
  65. }}
  66. onClick={() => {
  67. trackAnalytics('feedback.index-old-ui-clicked', {
  68. organization,
  69. });
  70. }}
  71. >
  72. {t('Go to Old User Feedback')}
  73. </Button>
  74. </Tooltip>
  75. </Layout.HeaderActions>
  76. </Layout.Header>
  77. <PageFiltersContainer>
  78. <ErrorBoundary>
  79. <LayoutGrid>
  80. <FeedbackFilters style={{gridArea: 'filters'}} />
  81. {hasSetupOneFeedback || hasSlug ? (
  82. <Fragment>
  83. <Container style={{gridArea: 'list'}}>
  84. <FeedbackList />
  85. </Container>
  86. <FeedbackSearch style={{gridArea: 'search'}} />
  87. <Container style={{gridArea: 'details'}}>
  88. <FeedbackItemLoader />
  89. </Container>
  90. </Fragment>
  91. ) : (
  92. <SetupContainer>
  93. <FeedbackSetupPanel />
  94. </SetupContainer>
  95. )}
  96. </LayoutGrid>
  97. </ErrorBoundary>
  98. </PageFiltersContainer>
  99. </FeedbackQueryKeys>
  100. </FullViewport>
  101. </SentryDocumentTitle>
  102. );
  103. }
  104. const LayoutGrid = styled('div')`
  105. background: ${p => p.theme.background};
  106. height: 100%;
  107. width: 100%;
  108. padding: ${space(2)} ${space(4)} ${space(2)} ${space(4)};
  109. overflow: hidden;
  110. display: grid;
  111. grid-template-columns: minmax(390px, 1fr) 2fr;
  112. grid-template-rows: max-content 1fr;
  113. grid-template-areas:
  114. 'filters search'
  115. 'list details';
  116. gap: ${space(2)};
  117. place-items: stretch;
  118. `;
  119. const Container = styled(FluidHeight)`
  120. border: 1px solid ${p => p.theme.border};
  121. border-radius: ${p => p.theme.borderRadius};
  122. `;
  123. const SetupContainer = styled('div')`
  124. grid-column: 1 / 3;
  125. `;