Enable SentryFeedbackForm, it works!
This commit is contained in:
parent
365cd70c9b
commit
c518d82359
2 changed files with 18 additions and 4 deletions
|
@ -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<ISentryFeedbackForm> = ({ eventId }) => {
|
||||
const { account } = useOwnAccount();
|
||||
|
||||
const [feedback, setFeedback] = useState<string>();
|
||||
const [isSubmitting, setIsSubmitting] = useState<boolean>(false);
|
||||
const [isSubmitted, setIsSubmitted] = useState<boolean>(false);
|
||||
|
||||
const handleFeedbackChange: React.ChangeEventHandler<HTMLTextAreaElement> = (e) => {
|
||||
setFeedback(e.target.value);
|
||||
|
@ -22,13 +26,22 @@ const SentryFeedbackForm: React.FC<ISentryFeedbackForm> = ({ eventId }) => {
|
|||
setIsSubmitting(true);
|
||||
|
||||
await captureSentryFeedback({
|
||||
name: account?.acct,
|
||||
event_id: eventId,
|
||||
comments: feedback,
|
||||
}).catch(console.error);
|
||||
|
||||
setFeedback('');
|
||||
setIsSubmitting(false);
|
||||
setIsSubmitted(true);
|
||||
};
|
||||
|
||||
if (isSubmitted) {
|
||||
return (
|
||||
<Text align='center'>
|
||||
<FormattedMessage id='alert.unexpected.thanks' defaultMessage='Thanks for your feedback!' />
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Form onSubmit={handleSubmitFeedback}>
|
||||
<FormGroup>
|
||||
|
|
|
@ -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<ISiteErrorBoundary> = ({ children }) => {
|
|||
<div className='mx-auto max-w-lg space-y-4 py-16'>
|
||||
{(isProduction) ? (
|
||||
(sentryEnabled && sentryEventId) && (
|
||||
<>{/* <SentryFeedbackForm eventId={sentryEventId} /> */}</>
|
||||
<SentryFeedbackForm eventId={sentryEventId} />
|
||||
)
|
||||
) : (
|
||||
<>
|
||||
|
|
Loading…
Reference in a new issue