2020-03-27 13:59:38 -07:00
|
|
|
|
import React from 'react';
|
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
import { FormattedMessage, injectIntl } from 'react-intl';
|
|
|
|
|
import { Link } from 'react-router-dom';
|
2020-04-01 19:20:47 -07:00
|
|
|
|
import { invitesEnabled, version, repository, source_url } from 'gabsocial/initial_state';
|
2020-03-27 13:59:38 -07:00
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
import { openModal } from '../../../actions/modal';
|
2020-04-11 12:41:13 -07:00
|
|
|
|
import { logOut } from 'gabsocial/actions/auth';
|
2020-03-27 13:59:38 -07:00
|
|
|
|
|
2020-04-01 19:20:47 -07:00
|
|
|
|
const mapStateToProps = state => {
|
|
|
|
|
const me = state.get('me');
|
|
|
|
|
return {
|
|
|
|
|
account: state.getIn(['accounts', me]),
|
|
|
|
|
siteTitle: state.getIn(['instance', 'title']),
|
|
|
|
|
}
|
|
|
|
|
};
|
2020-03-27 13:59:38 -07:00
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
|
|
|
onOpenHotkeys() {
|
|
|
|
|
dispatch(openModal('HOTKEYS'));
|
|
|
|
|
},
|
2020-04-11 12:41:13 -07:00
|
|
|
|
onClickLogOut(e) {
|
|
|
|
|
dispatch(logOut());
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
},
|
2020-03-27 13:59:38 -07:00
|
|
|
|
});
|
|
|
|
|
|
2020-04-11 12:41:13 -07:00
|
|
|
|
const LinkFooter = ({ onOpenHotkeys, account, siteTitle, onClickLogOut }) => (
|
2020-03-27 13:59:38 -07:00
|
|
|
|
<div className='getting-started__footer'>
|
|
|
|
|
<ul>
|
|
|
|
|
{(invitesEnabled && account) && <li><a href='/invites'><FormattedMessage id='getting_started.invite' defaultMessage='Invite people' /></a> · </li>}
|
|
|
|
|
{account && <li><a href='#' onClick={onOpenHotkeys}><FormattedMessage id='navigation_bar.keyboard_shortcuts' defaultMessage='Hotkeys' /></a> · </li>}
|
|
|
|
|
{account && <li><a href='/auth/edit'><FormattedMessage id='getting_started.security' defaultMessage='Security' /></a> · </li>}
|
|
|
|
|
<li><a href='/about'><FormattedMessage id='navigation_bar.info' defaultMessage='About this server' /></a> · </li>
|
|
|
|
|
<li><a href='/settings/applications'><FormattedMessage id='getting_started.developers' defaultMessage='Developers' /></a> · </li>
|
|
|
|
|
<li><a href='/about/tos'><FormattedMessage id='getting_started.terms' defaultMessage='Terms of Service' /></a> · </li>
|
|
|
|
|
<li><a href='/about/dmca'><FormattedMessage id='getting_started.dmca' defaultMessage='DMCA' /></a> · </li>
|
|
|
|
|
<li><a href='/about/privacy'><FormattedMessage id='getting_started.privacy' defaultMessage='Privacy Policy' /></a></li>
|
2020-04-11 12:41:13 -07:00
|
|
|
|
{account && <li> · <Link to='/auth/sign_out' onClick={onClickLogOut}><FormattedMessage id='navigation_bar.logout' defaultMessage='Logout' /></Link></li>}
|
2020-03-27 13:59:38 -07:00
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
<FormattedMessage
|
|
|
|
|
id='getting_started.open_source_notice'
|
|
|
|
|
defaultMessage='{site_title} is open source software. You can contribute or report issues on GitLab at {gitlab}.'
|
|
|
|
|
values={{site_title: siteTitle, gitlab: <span><a href={source_url} rel='noopener' target='_blank'>{repository}</a> (v{version})</span> }}
|
|
|
|
|
/>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
LinkFooter.propTypes = {
|
|
|
|
|
withHotkeys: PropTypes.bool,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(LinkFooter));
|