2022-01-07 17:27:18 -08:00
|
|
|
import PropTypes from 'prop-types';
|
2022-01-10 14:17:52 -08:00
|
|
|
import React from 'react';
|
2022-01-07 17:27:18 -08:00
|
|
|
import { FormattedMessage, injectIntl, defineMessages } from 'react-intl';
|
2022-01-10 14:17:52 -08:00
|
|
|
import { connect } from 'react-redux';
|
2022-01-07 17:27:18 -08:00
|
|
|
import { Link } from 'react-router-dom';
|
2022-01-10 14:25:06 -08:00
|
|
|
|
2022-01-10 19:25:30 -08:00
|
|
|
import { changeSettingImmediate } from 'soapbox/actions/settings';
|
2022-01-07 17:48:14 -08:00
|
|
|
import snackbar from 'soapbox/actions/snackbar';
|
2022-01-10 14:17:52 -08:00
|
|
|
import Icon from 'soapbox/components/icon';
|
2022-01-10 14:25:06 -08:00
|
|
|
|
2022-01-10 14:01:24 -08:00
|
|
|
import Column from '../ui/components/column';
|
2022-01-07 17:27:18 -08:00
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
heading: { id: 'column.developers', defaultMessage: 'Developers' },
|
2022-01-07 17:48:14 -08:00
|
|
|
leave: { id: 'developers.leave', defaultMessage: 'You have left developers' },
|
2022-01-07 17:27:18 -08:00
|
|
|
});
|
|
|
|
|
2022-01-07 17:48:14 -08:00
|
|
|
export default @connect()
|
|
|
|
@injectIntl
|
2022-01-07 17:27:18 -08:00
|
|
|
class DevelopersMenu extends React.Component {
|
|
|
|
|
2022-01-07 17:48:14 -08:00
|
|
|
static contextTypes = {
|
|
|
|
router: PropTypes.object,
|
|
|
|
};
|
|
|
|
|
2022-01-07 17:27:18 -08:00
|
|
|
static propTypes = {
|
|
|
|
intl: PropTypes.object.isRequired,
|
2022-01-07 17:48:14 -08:00
|
|
|
dispatch: PropTypes.func.isRequired,
|
|
|
|
}
|
|
|
|
|
|
|
|
leaveDevelopers = e => {
|
|
|
|
const { intl, dispatch } = this.props;
|
|
|
|
|
2022-01-10 19:25:30 -08:00
|
|
|
dispatch(changeSettingImmediate(['isDeveloper'], false));
|
2022-01-07 17:48:14 -08:00
|
|
|
dispatch(snackbar.success(intl.formatMessage(messages.leave)));
|
|
|
|
|
|
|
|
this.context.router.history.push('/');
|
|
|
|
e.preventDefault();
|
2022-01-07 17:27:18 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { intl } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Column heading={intl.formatMessage(messages.heading)}>
|
|
|
|
<div className='dashcounters'>
|
|
|
|
<div className='dashcounter'>
|
|
|
|
<Link to='/developers/apps/create'>
|
|
|
|
<div className='dashcounter__icon'>
|
|
|
|
<Icon src={require('@tabler/icons/icons/apps.svg')} />
|
|
|
|
</div>
|
|
|
|
<div className='dashcounter__label'>
|
|
|
|
<FormattedMessage id='developers.navigation.app_create_label' defaultMessage='Create an app' />
|
|
|
|
</div>
|
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
<div className='dashcounter'>
|
|
|
|
<Link to='/developers/settings_store'>
|
|
|
|
<div className='dashcounter__icon'>
|
|
|
|
<Icon src={require('@tabler/icons/icons/code-plus.svg')} />
|
|
|
|
</div>
|
|
|
|
<div className='dashcounter__label'>
|
|
|
|
<FormattedMessage id='developers.navigation.settings_store_label' defaultMessage='Settings store' />
|
|
|
|
</div>
|
|
|
|
</Link>
|
|
|
|
</div>
|
|
|
|
<div className='dashcounter'>
|
|
|
|
<Link to='/error'>
|
|
|
|
<div className='dashcounter__icon'>
|
|
|
|
<Icon src={require('@tabler/icons/icons/mood-sad.svg')} />
|
|
|
|
</div>
|
|
|
|
<div className='dashcounter__label'>
|
|
|
|
<FormattedMessage id='developers.navigation.intentional_error_label' defaultMessage='Trigger an error' />
|
|
|
|
</div>
|
|
|
|
</Link>
|
|
|
|
</div>
|
2022-01-07 17:48:14 -08:00
|
|
|
<div className='dashcounter'>
|
|
|
|
<a href='#' onClick={this.leaveDevelopers}>
|
|
|
|
<div className='dashcounter__icon'>
|
|
|
|
<Icon src={require('@tabler/icons/icons/logout.svg')} />
|
|
|
|
</div>
|
|
|
|
<div className='dashcounter__label'>
|
|
|
|
<FormattedMessage id='developers.navigation.leave_developers_label' defaultMessage='Leave developers' />
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
</div>
|
2022-01-07 17:27:18 -08:00
|
|
|
</div>
|
|
|
|
</Column>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|