import { useFetcher } from 'react-router-dom' import { CheckboxFieldUncontrolled } from 'components/Inputs' import { useEffect } from 'react' type ReportPopupProps = { handleClose: () => void } const BLOG_REPORT_REASONS = [ { label: 'Actually CP', key: 'actuallyCP' }, { label: 'Spam', key: 'spam' }, { label: 'Scam', key: 'scam' }, { label: 'Malware', key: 'malware' }, { label: `Wasn't tagged NSFW`, key: 'wasntTaggedNSFW' }, { label: 'Other', key: 'otherReason' } ] export const ReportPopup = ({ handleClose }: ReportPopupProps) => { const fetcher = useFetcher() // Close automatically if action succeeds useEffect(() => { if (fetcher.data) { const { isSent } = fetcher.data if (isSent) { handleClose() } } }, [fetcher, handleClose]) return ( <>