import React from 'react'; import { FormattedMessage } from 'react-intl'; import { Link } from 'react-router-dom'; import { useAppSelector, useCompose } from 'soapbox/hooks'; import Warning from '../components/warning'; const APPROX_HASHTAG_RE = /(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i; interface IWarningWrapper { composeId: string, } const WarningWrapper: React.FC = ({ composeId }) => { const compose = useCompose(composeId); const me = useAppSelector((state) => state.me); const needsLockWarning = useAppSelector((state) => compose.privacy === 'private' && !state.accounts.get(me)!.locked); const hashtagWarning = compose.privacy !== 'public' && APPROX_HASHTAG_RE.test(compose.text); const directMessageWarning = compose.privacy === 'direct'; if (needsLockWarning) { return }} />} />; } if (hashtagWarning) { return } />; } if (directMessageWarning) { const message = ( {/* */} ); return ; } return null; }; export default WarningWrapper;