import React from 'react'; import { FormattedMessage } from 'react-intl'; import { Link } from 'react-router-dom'; import { useAppSelector } 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 me = useAppSelector((state) => state.me); const needsLockWarning = useAppSelector(state => state.compose.get(composeId)!.privacy === 'private' && !state.accounts.get(me)!.locked); const hashtagWarning = useAppSelector(state => state.compose.get(composeId)!.privacy !== 'public' && APPROX_HASHTAG_RE.test(state.compose.get(composeId)!.text)); const directMessageWarning = useAppSelector(state => state.compose.get(composeId)!.privacy === 'direct'); if (needsLockWarning) { return }} />} />; } if (hashtagWarning) { return } />; } if (directMessageWarning) { const message = ( {/* */} ); return ; } return null; }; export default WarningWrapper;