import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage, injectIntl } from 'react-intl'; import { Link } from 'react-router-dom'; import { connect } from 'react-redux'; import { openModal } from '../../../actions/modal'; 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'; const mapStateToProps = state => { const me = state.get('me'); const account = state.getIn(['accounts', me]); const instance = state.get('instance'); const features = getFeatures(instance); return { account, federating: features.federating, showAliases: features.accountAliasesAPI, importAPI: features.importAPI, baseURL: getBaseURL(account), }; }; const mapDispatchToProps = (dispatch, { intl }) => ({ onOpenHotkeys() { dispatch(openModal('HOTKEYS')); }, onClickLogOut(e) { dispatch(logOut(intl)); e.preventDefault(); }, }); const LinkFooter = ({ onOpenHotkeys, account, federating, showAliases, importAPI, onClickLogOut, baseURL }) => (
); LinkFooter.propTypes = { account: ImmutablePropTypes.map, federating: PropTypes.bool, showAliases: PropTypes.bool, importAPI: PropTypes.bool, onOpenHotkeys: PropTypes.func.isRequired, onClickLogOut: PropTypes.func.isRequired, baseURL: PropTypes.string, }; export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(LinkFooter));