import React from 'react'; import { FormattedMessage } from 'react-intl'; import { Text, Button, Modal, Stack, HStack } from 'soapbox/components/ui'; import { useAppSelector, useSoapboxConfig } from 'soapbox/hooks'; import { usePendingPolicy, useAcceptPolicy } from 'soapbox/queries/policies'; interface IPolicyModal { onClose: (type: string) => void } const DirectMessageUpdates = () => { const soapboxConfig = useSoapboxConfig(); const { links } = soapboxConfig; return ( Direct Messaging Yes, direct messages are finally here! Bring one-on-one conversations from your Feed to your DMs with messages that automatically delete for your privacy. Privacy Policy Updates {links.get('privacyPolicy') ? ( View Privacy Policy ) : null} ); }; const supportedPolicyIds = ['1']; /** Modal to show privacy policy changes that need confirmation. */ const PolicyModal: React.FC = ({ onClose }) => { const acceptPolicy = useAcceptPolicy(); const instance = useAppSelector((state) => state.instance); const { data: pendingPolicy, isLoading } = usePendingPolicy(); const renderPolicyBody = () => { switch (pendingPolicy?.pending_policy_id) { case '1': return ; default: return null; } }; const handleAccept = () => { acceptPolicy.mutate({ policy_id: pendingPolicy?.pending_policy_id as string, }, { onSuccess() { onClose('POLICY'); }, }); }; if (isLoading || !pendingPolicy) { return null; } return ( {renderPolicyBody()} ); }; export { PolicyModal as default, supportedPolicyIds };