feedbackDetailsPage.tsx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import {RouteComponentProps} from 'react-router';
  2. import {Alert} from 'sentry/components/alert';
  3. import useFetchFeedbackItem from 'sentry/components/feedback/useFetchFeedbackItem';
  4. import * as Layout from 'sentry/components/layouts/thirds';
  5. import PageFiltersContainer from 'sentry/components/organizations/pageFilters/container';
  6. import {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionTooltip';
  7. import Placeholder from 'sentry/components/placeholder';
  8. import SentryDocumentTitle from 'sentry/components/sentryDocumentTitle';
  9. import {t} from 'sentry/locale';
  10. import useOrganization from 'sentry/utils/useOrganization';
  11. import useProjectFromSlug from 'sentry/utils/useProjectFromSlug';
  12. interface RouteParams {
  13. feedbackSlug: string;
  14. }
  15. interface Props extends RouteComponentProps<RouteParams, {}, any, {}> {}
  16. export default function FeedbackDetailsPage({params: {feedbackSlug}}: Props) {
  17. const organization = useOrganization();
  18. const [projectSlug, feedbackId] = feedbackSlug.split(':');
  19. const project = useProjectFromSlug({organization, projectSlug});
  20. const {isLoading, isError, data} = useFetchFeedbackItem(
  21. {feedbackId, organization, project: project!},
  22. {enabled: Boolean(project)}
  23. );
  24. return (
  25. <SentryDocumentTitle
  26. title={t(`Feedback v2`)}
  27. orgSlug={organization.slug}
  28. projectSlug={projectSlug}
  29. >
  30. <Layout.Header>
  31. <Layout.HeaderContent>
  32. <Layout.Title>
  33. {t('Feedback v2')}
  34. <PageHeadingQuestionTooltip
  35. title={t(
  36. 'Feedback submitted by users who experienced an error while using your application, including their name, email address, and any additional comments.'
  37. )}
  38. docsUrl="https://docs.sentry.io/product/user-feedback/"
  39. />
  40. </Layout.Title>
  41. </Layout.HeaderContent>
  42. </Layout.Header>
  43. <PageFiltersContainer>
  44. <Layout.Body>
  45. <Layout.Main fullWidth>
  46. {isLoading ? (
  47. <Placeholder />
  48. ) : isError ? (
  49. <Alert type="error" showIcon>
  50. {t('An error occurred')}
  51. </Alert>
  52. ) : (
  53. <pre>{JSON.stringify(data, null, '\t')}</pre>
  54. )}
  55. </Layout.Main>
  56. </Layout.Body>
  57. </PageFiltersContainer>
  58. </SentryDocumentTitle>
  59. );
  60. }