diff --git a/client/src/core/client/stream/tabs/Comments/Comment/ReportFlow/ReportCommentForm.tsx b/client/src/core/client/stream/tabs/Comments/Comment/ReportFlow/ReportCommentForm.tsx index ab205a5617..ad744e842d 100644 --- a/client/src/core/client/stream/tabs/Comments/Comment/ReportFlow/ReportCommentForm.tsx +++ b/client/src/core/client/stream/tabs/Comments/Comment/ReportFlow/ReportCommentForm.tsx @@ -1,15 +1,17 @@ import { Localized } from "@fluent/react/compat"; import cn from "classnames"; import { get } from "lodash"; -import React, { FunctionComponent } from "react"; +import React, { FunctionComponent, useEffect } from "react"; import { Field, FieldProps, Form } from "react-final-form"; +import { useViewerEvent } from "coral-framework/lib/events"; import { OnSubmit } from "coral-framework/lib/form"; import { customMessage, validateMaxLength, } from "coral-framework/lib/validation"; import CLASSES from "coral-stream/classes"; +import { ShowReportPopoverEvent } from "coral-stream/events"; import { Flex, RadioButton } from "coral-ui/components/v2"; import { Button, ValidationMessage } from "coral-ui/components/v3"; @@ -51,215 +53,222 @@ export interface FormProps { additionalDetails?: string; } -class ReportCommentForm extends React.Component { - public render() { - const { onCancel, onSubmit, id } = this.props; - return ( -
-
- {({ - handleSubmit, - submitting, - hasValidationErrors, - form, - submitError, - }) => ( - -
- -
Report This Comment
-
- -
- Why are you reporting this comment? -
-
-
    -
  • - - - This comment is offensive - - -
  • -
  • - - - This commenter is being abusive - - -
  • -
  • - - - I disagree with this comment - - -
  • -
  • - - - This looks like an ad or marketing - - -
  • - {this.props.biosEnabled && ( -
  • - - - This commenter's bio is offensive or abusive - - -
  • - )} +const ReportCommentForm: FunctionComponent = ({ + onCancel, + onSubmit, + id, + biosEnabled, +}) => { + const emitReportEvent = useViewerEvent(ShowReportPopoverEvent); + + // Run once. + useEffect(() => { + emitReportEvent({ commentID: id }); + }, []); + + return ( +
    + + {({ + handleSubmit, + submitting, + hasValidationErrors, + form, + submitError, + }) => ( + +
    + +
    Report This Comment
    +
    + +
    + Why are you reporting this comment? +
    +
    +
      +
    • + + + This comment is offensive + + +
    • +
    • + + + This commenter is being abusive + + +
    • +
    • + + + I disagree with this comment + + +
    • +
    • + + + This looks like an ad or marketing + + +
    • + {biosEnabled && (
    • - + - Other + This commenter's bio is offensive or abusive
    • -
    - }} - > - - - -
    - Please leave any additional information that may be helpful - to our moderators. -
    -
    -
    - - - Please restrict your report to 500 characters - - - )} - > - {({ input, meta }) => ( -
    -