feedbackListPage.tsx 4.6 KB

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