diff --git a/src/components/sentry-feedback-form.tsx b/src/components/sentry-feedback-form.tsx index 0ef74bbae..1f8ba2a88 100644 --- a/src/components/sentry-feedback-form.tsx +++ b/src/components/sentry-feedback-form.tsx @@ -1,7 +1,8 @@ import React, { useState } from 'react'; import { FormattedMessage } from 'react-intl'; -import { Textarea, Form, Button, FormGroup, FormActions } from 'soapbox/components/ui'; +import { Textarea, Form, Button, FormGroup, FormActions, Text } from 'soapbox/components/ui'; +import { useOwnAccount } from 'soapbox/hooks'; import { captureSentryFeedback } from 'soapbox/sentry'; interface ISentryFeedbackForm { @@ -10,8 +11,11 @@ interface ISentryFeedbackForm { /** Accept feedback for the given Sentry event. */ const SentryFeedbackForm: React.FC = ({ eventId }) => { + const { account } = useOwnAccount(); + const [feedback, setFeedback] = useState(); const [isSubmitting, setIsSubmitting] = useState(false); + const [isSubmitted, setIsSubmitted] = useState(false); const handleFeedbackChange: React.ChangeEventHandler = (e) => { setFeedback(e.target.value); @@ -22,13 +26,22 @@ const SentryFeedbackForm: React.FC = ({ eventId }) => { setIsSubmitting(true); await captureSentryFeedback({ + name: account?.acct, event_id: eventId, comments: feedback, }).catch(console.error); - setFeedback(''); - setIsSubmitting(false); + setIsSubmitted(true); }; + + if (isSubmitted) { + return ( + + + + ); + } + return (
diff --git a/src/components/site-error-boundary.tsx b/src/components/site-error-boundary.tsx index 0be507e23..3f39efc25 100644 --- a/src/components/site-error-boundary.tsx +++ b/src/components/site-error-boundary.tsx @@ -10,6 +10,7 @@ import KVStore from 'soapbox/storage/kv-store'; import sourceCode from 'soapbox/utils/code'; import { unregisterSW } from 'soapbox/utils/sw'; +import SentryFeedbackForm from './sentry-feedback-form'; import SiteLogo from './site-logo'; interface ISiteErrorBoundary { @@ -121,7 +122,7 @@ const SiteErrorBoundary: React.FC = ({ children }) => {
{(isProduction) ? ( (sentryEnabled && sentryEventId) && ( - <>{/* */} + ) ) : ( <>