import noop from 'lodash/noop'; import React from 'react'; import Toggle from 'react-toggle'; import { toggleStatusReport } from 'soapbox/actions/reports'; import StatusContent from 'soapbox/components/status-content'; import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; import Bundle from '../../ui/components/bundle'; import { MediaGallery, Video, Audio } from '../../ui/util/async-components'; interface IStatusCheckBox { id: string disabled?: boolean } const StatusCheckBox: React.FC = ({ id, disabled }) => { const dispatch = useAppDispatch(); const status = useAppSelector((state) => state.statuses.get(id)); const checked = useAppSelector((state) => state.reports.new.status_ids.includes(id)); const onToggle: React.ChangeEventHandler = (e) => dispatch(toggleStatusReport(id, e.target.checked)); if (!status || status.reblog) { return null; } let media; if (status.media_attachments.size > 0) { if (status.media_attachments.some(item => item.type === 'unknown')) { // Do nothing } else if (status.media_attachments.get(0)?.type === 'video') { const video = status.media_attachments.get(0); if (video) { media = ( {(Component: any) => ( )} ); } } else if (status.media_attachments.get(0)?.type === 'audio') { const audio = status.media_attachments.get(0); if (audio) { media = ( {(Component: any) => ( )} ); } } else { media = ( {(Component: any) => } ); } } return (
{media}
); }; export default StatusCheckBox;