2020-03-27 13:59:38 -07:00
|
|
|
import PropTypes from 'prop-types';
|
2022-01-10 14:17:52 -08:00
|
|
|
import React from 'react';
|
2020-04-14 14:37:17 -07:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
2020-03-27 13:59:38 -07:00
|
|
|
import { FormattedMessage, injectIntl } from 'react-intl';
|
|
|
|
import { connect } from 'react-redux';
|
2022-01-10 14:17:52 -08:00
|
|
|
import { Link } from 'react-router-dom';
|
2022-01-10 14:25:06 -08:00
|
|
|
|
2020-05-28 15:52:07 -07:00
|
|
|
import { logOut } from 'soapbox/actions/auth';
|
2022-03-22 15:43:42 -07:00
|
|
|
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
2022-03-21 11:09:01 -07:00
|
|
|
import { Text } from 'soapbox/components/ui';
|
|
|
|
import emojify from 'soapbox/features/emoji/emoji';
|
|
|
|
import { getBaseURL } from 'soapbox/utils/accounts';
|
2022-03-22 15:43:42 -07:00
|
|
|
import sourceCode from 'soapbox/utils/code';
|
2021-08-23 12:14:47 -07:00
|
|
|
import { getFeatures } from 'soapbox/utils/features';
|
2022-01-10 14:25:06 -08:00
|
|
|
|
2022-02-02 05:33:12 -08:00
|
|
|
import { openModal } from '../../../actions/modals';
|
2020-04-11 13:36:54 -07:00
|
|
|
|
2020-04-01 19:20:47 -07:00
|
|
|
const mapStateToProps = state => {
|
|
|
|
const me = state.get('me');
|
2021-10-31 14:07:41 -07:00
|
|
|
const account = state.getIn(['accounts', me]);
|
2021-08-23 12:14:47 -07:00
|
|
|
const instance = state.get('instance');
|
2022-03-21 11:09:01 -07:00
|
|
|
const features = getFeatures(instance);
|
2022-03-22 15:43:42 -07:00
|
|
|
const soapboxConfig = getSoapboxConfig(state);
|
2021-08-23 12:14:47 -07:00
|
|
|
|
2020-04-01 19:20:47 -07:00
|
|
|
return {
|
2021-10-31 14:07:41 -07:00
|
|
|
account,
|
2022-03-22 15:43:42 -07:00
|
|
|
soapboxConfig,
|
2022-03-21 11:09:01 -07:00
|
|
|
profileDirectory: features.profileDirectory,
|
|
|
|
federating: features.federating,
|
|
|
|
showAliases: features.accountAliasesAPI,
|
|
|
|
importAPI: features.importAPI,
|
2021-10-31 14:07:41 -07:00
|
|
|
baseURL: getBaseURL(account),
|
2020-04-14 11:44:40 -07:00
|
|
|
};
|
2020-04-01 19:20:47 -07:00
|
|
|
};
|
2020-03-27 13:59:38 -07:00
|
|
|
|
2021-06-26 15:04:27 -07:00
|
|
|
const mapDispatchToProps = (dispatch, { intl }) => ({
|
2022-01-09 07:56:11 -08:00
|
|
|
onOpenHotkeys(e) {
|
2020-03-27 13:59:38 -07:00
|
|
|
dispatch(openModal('HOTKEYS'));
|
2022-01-09 07:56:11 -08:00
|
|
|
e.preventDefault();
|
2020-03-27 13:59:38 -07:00
|
|
|
},
|
2020-04-11 12:41:13 -07:00
|
|
|
onClickLogOut(e) {
|
2021-06-26 15:04:27 -07:00
|
|
|
dispatch(logOut(intl));
|
2020-04-11 12:41:13 -07:00
|
|
|
e.preventDefault();
|
|
|
|
},
|
2020-03-27 13:59:38 -07:00
|
|
|
});
|
|
|
|
|
2022-03-22 15:43:42 -07:00
|
|
|
const LinkFooter = ({ onOpenHotkeys, account, profileDirectory, federating, showAliases, importAPI, onClickLogOut, baseURL, soapboxConfig }) => (
|
2022-03-21 11:09:01 -07:00
|
|
|
<div className='space-y-2'>
|
|
|
|
<ul className='flex flex-wrap items-center divide-x-dot'>
|
2021-03-25 16:56:07 -07:00
|
|
|
{account && <>
|
2022-03-21 11:09:01 -07:00
|
|
|
{profileDirectory && <li><Link to='/directory' className='text-gray-400 hover:text-gray-500 hover:underline'><FormattedMessage id='navigation_bar.profile_directory' defaultMessage='Profile directory' /></Link></li>}
|
|
|
|
<li><Link to='/blocks' className='text-gray-400 hover:text-gray-500 hover:underline'><FormattedMessage id='navigation_bar.blocks' defaultMessage='Blocks' /></Link></li>
|
|
|
|
<li><Link to='/mutes' className='text-gray-400 hover:text-gray-500 hover:underline'><FormattedMessage id='navigation_bar.mutes' defaultMessage='Mutes' /></Link></li>
|
|
|
|
{/* <li><Link to='/filters' className='text-gray-400 hover:text-gray-500 hover:underline'><FormattedMessage id='navigation_bar.filters' defaultMessage='Filters' /></Link></li> */}
|
|
|
|
{federating && <li><Link to='/domain_blocks' className='text-gray-400 hover:text-gray-500 hover:underline'><FormattedMessage id='navigation_bar.domain_blocks' defaultMessage='Domain blocks' /></Link></li>}
|
|
|
|
{/* <li><Link to='/follow_requests'><FormattedMessage id='navigation_bar.follow_requests' defaultMessage='Follow requests' /></Link></li> */}
|
|
|
|
{/* isAdmin(account) && <li><a href='/pleroma/admin' className='text-gray-400 hover:text-gray-500 hover:underline'><FormattedMessage id='navigation_bar.admin_settings' defaultMessage='AdminFE' /></a></li> */}
|
|
|
|
{/* isAdmin(account) && <li><Link to='/soapbox/config' className='text-gray-400 hover:text-gray-500 hover:underline'><FormattedMessage id='navigation_bar.soapbox_config' defaultMessage='Soapbox config' /></Link></li> */}
|
|
|
|
{/* <li><Link to='/settings/export'><FormattedMessage id='navigation_bar.export_data' defaultMessage='Export data' /></Link></li> */}
|
|
|
|
{/* <li>{importAPI ? (
|
2021-10-31 14:07:41 -07:00
|
|
|
<Link to='/settings/import'><FormattedMessage id='navigation_bar.import_data' defaultMessage='Import data' /></Link>
|
|
|
|
) : (
|
|
|
|
<a href={`${baseURL}/settings/import`}><FormattedMessage id='navigation_bar.import_data' defaultMessage='Import data' /></a>
|
2022-03-21 11:09:01 -07:00
|
|
|
)}</li> */}
|
|
|
|
{(federating && showAliases) && <li><Link to='/settings/aliases' className='text-gray-400 hover:text-gray-500 hover:underline'><FormattedMessage id='navigation_bar.account_aliases' defaultMessage='Account aliases' /></Link></li>}
|
|
|
|
{/* <li><a href='#' onClick={onOpenHotkeys}><FormattedMessage id='navigation_bar.keyboard_shortcuts' defaultMessage='Hotkeys' /></a></li> */}
|
2021-03-25 16:56:07 -07:00
|
|
|
</>}
|
2022-03-21 11:09:01 -07:00
|
|
|
<li><a target='_blank' href='https://help.truthsocial.com/legal' className='text-gray-400 hover:text-gray-500 hover:underline'><FormattedMessage id='navigation_bar.legal' defaultMessage='Legal' /></a></li>
|
|
|
|
{/* <li><Link to='/about'><FormattedMessage id='navigation_bar.info' defaultMessage='About this server' /></Link></li> */}
|
|
|
|
{account && <li><Link to='/auth/sign_out' onClick={onClickLogOut} className='text-gray-400 hover:text-gray-500 hover:underline'><FormattedMessage id='navigation_bar.logout' defaultMessage='Logout' /></Link></li>}
|
2020-03-27 13:59:38 -07:00
|
|
|
</ul>
|
|
|
|
|
2022-03-21 11:09:01 -07:00
|
|
|
<Text theme='muted' size='sm'>
|
2022-03-22 15:43:42 -07:00
|
|
|
{soapboxConfig.get('linkFooterMessage') ? (
|
|
|
|
<span
|
|
|
|
className='inline-block align-middle'
|
|
|
|
dangerouslySetInnerHTML={{ __html: emojify(soapboxConfig.get('linkFooterMessage')) }}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<FormattedMessage
|
|
|
|
id='getting_started.open_source_notice'
|
|
|
|
defaultMessage='{code_name} is open source software. You can contribute or report issues at {code_link} (v{code_version}).'
|
|
|
|
values={{
|
|
|
|
code_name: sourceCode.displayName,
|
|
|
|
code_link: <a href={sourceCode.url} rel='noopener' target='_blank'>{sourceCode.repository}</a>,
|
|
|
|
code_version: sourceCode.version,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)}
|
2022-03-21 11:09:01 -07:00
|
|
|
</Text>
|
2020-03-27 13:59:38 -07:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
LinkFooter.propTypes = {
|
2020-04-14 14:37:17 -07:00
|
|
|
account: ImmutablePropTypes.map,
|
2022-03-22 15:43:42 -07:00
|
|
|
soapboxConfig: ImmutablePropTypes.map,
|
2022-03-21 11:09:01 -07:00
|
|
|
profileDirectory: PropTypes.bool,
|
|
|
|
federating: PropTypes.bool,
|
|
|
|
showAliases: PropTypes.bool,
|
|
|
|
importAPI: PropTypes.bool,
|
2020-04-14 14:37:17 -07:00
|
|
|
onOpenHotkeys: PropTypes.func.isRequired,
|
|
|
|
onClickLogOut: PropTypes.func.isRequired,
|
2021-10-31 14:07:41 -07:00
|
|
|
baseURL: PropTypes.string,
|
2020-03-27 13:59:38 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(LinkFooter));
|