import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage, injectIntl } from 'react-intl'; import { connect } from 'react-redux'; import { Link } from 'react-router-dom'; import { logOut } from 'soapbox/actions/auth'; import { getBaseURL, isAdmin } from 'soapbox/utils/accounts'; import sourceCode from 'soapbox/utils/code'; import { getFeatures } from 'soapbox/utils/features'; import { openModal } from '../../../actions/modals'; const mapStateToProps = state => { const me = state.get('me'); const account = state.getIn(['accounts', me]); const instance = state.get('instance'); return { account, features: getFeatures(instance), baseURL: getBaseURL(account), }; }; const mapDispatchToProps = (dispatch, { intl }) => ({ onOpenHotkeys(e) { dispatch(openModal('HOTKEYS')); e.preventDefault(); }, onClickLogOut(e) { dispatch(logOut(intl)); e.preventDefault(); }, }); const LinkFooter = ({ onOpenHotkeys, account, features, onClickLogOut, baseURL }) => (
); LinkFooter.propTypes = { account: ImmutablePropTypes.map, features: PropTypes.object.isRequired, onOpenHotkeys: PropTypes.func.isRequired, onClickLogOut: PropTypes.func.isRequired, baseURL: PropTypes.string, }; export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(LinkFooter));