import React from 'react'; import { FormattedMessage } from 'react-intl'; import { getSubscribersCsv, getUnsubscribersCsv, getCombinedCsv } from 'soapbox/actions/email-list'; import { useAppDispatch, useOwnAccount, useFeatures, useInstance } from 'soapbox/hooks'; import sourceCode from 'soapbox/utils/code'; import { download } from 'soapbox/utils/download'; import { parseVersion } from 'soapbox/utils/features'; import { DashCounter, DashCounters } from '../components/dashcounter'; import RegistrationModePicker from '../components/registration-mode-picker'; const Dashboard: React.FC = () => { const dispatch = useAppDispatch(); const instance = useInstance(); const features = useFeatures(); const account = useOwnAccount(); const handleSubscribersClick: React.MouseEventHandler = e => { dispatch(getSubscribersCsv()).then((response) => { download(response, 'subscribers.csv'); }).catch(() => {}); e.preventDefault(); }; const handleUnsubscribersClick: React.MouseEventHandler = e => { dispatch(getUnsubscribersCsv()).then((response) => { download(response, 'unsubscribers.csv'); }).catch(() => {}); e.preventDefault(); }; const handleCombinedClick: React.MouseEventHandler = e => { dispatch(getCombinedCsv()).then((response) => { download(response, 'combined.csv'); }).catch(() => {}); e.preventDefault(); }; const v = parseVersion(instance.version); const userCount = instance.stats.get('user_count'); const statusCount = instance.stats.get('status_count'); const domainCount = instance.stats.get('domain_count'); const mau = instance.pleroma.getIn(['stats', 'mau']) as number | undefined; const retention = (userCount && mau) ? Math.round(mau / userCount * 100) : undefined; if (!account) return null; return ( <> } /> } /> } percent /> } /> } /> {account.admin && }

  • {sourceCode.displayName} {sourceCode.version}
  • {v.software + (v.build ? `+${v.build}` : '')} {v.version}
{features.emailList && account.admin && (

)}
); }; export default Dashboard;