bigbuffet-rw/app/soapbox/features/admin/index.js

82 lines
3 KiB
JavaScript
Raw Normal View History

2020-12-29 10:34:23 -08:00
import React from 'react';
import { defineMessages, injectIntl, FormattedMessage, FormattedNumber } from 'react-intl';
import { connect } from 'react-redux';
import ImmutablePureComponent from 'react-immutable-pure-component';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Column from '../ui/components/column';
import RegistrationModePicker from './components/registration_mode_picker';
2020-12-29 10:34:23 -08:00
import { parseVersion } from 'soapbox/utils/features';
import sourceCode from 'soapbox/utils/code';
2020-12-29 10:34:23 -08:00
const messages = defineMessages({
heading: { id: 'column.admin.dashboard', defaultMessage: 'Dashboard' },
});
const mapStateToProps = (state, props) => ({
instance: state.get('instance'),
});
export default @connect(mapStateToProps)
@injectIntl
class Dashboard extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
instance: ImmutablePropTypes.map.isRequired,
};
render() {
const { intl, instance } = this.props;
const v = parseVersion(instance.get('version'));
return (
<Column icon='tachometer' heading={intl.formatMessage(messages.heading)} backBtnSlim>
<div className='dashcounters'>
<div className='dashcounter'>
<a href='/pleroma/admin/#/users/index' target='_blank'>
2020-12-29 10:34:23 -08:00
<div className='dashcounter__num'>
<FormattedNumber value={instance.getIn(['stats', 'user_count'])} />
</div>
<div className='dashcounter__label'>
<FormattedMessage id='admin.dashcounters.user_count_label' defaultMessage='users' />
</div>
</a>
</div>
<div className='dashcounter'>
<a href='/pleroma/admin/#/statuses/index' target='_blank'>
2020-12-29 10:34:23 -08:00
<div className='dashcounter__num'>
<FormattedNumber value={instance.getIn(['stats', 'status_count'])} />
</div>
<div className='dashcounter__label'>
<FormattedMessage id='admin.dashcounters.status_count_label' defaultMessage='posts' />
</div>
</a>
</div>
<div className='dashcounter'>
<div>
2020-12-29 10:34:23 -08:00
<div className='dashcounter__num'>
<FormattedNumber value={instance.getIn(['stats', 'domain_count'])} />
2020-12-29 10:34:23 -08:00
</div>
<div className='dashcounter__label'>
<FormattedMessage id='admin.dashcounters.domain_count_label' defaultMessage='peers' />
2020-12-29 10:34:23 -08:00
</div>
</div>
2020-12-29 10:34:23 -08:00
</div>
</div>
<RegistrationModePicker />
2020-12-29 10:34:23 -08:00
<div className='dashwidgets'>
2020-12-29 21:25:07 -08:00
<div className='dashwidget'>
2020-12-29 10:34:23 -08:00
<h4><FormattedMessage id='admin.dashwidgets.software_header' defaultMessage='Software' /></h4>
<ul>
<li>Soapbox FE <span className='pull-right'>{sourceCode.version}</span></li>
2020-12-29 21:25:07 -08:00
<li>{v.software} <span className='pull-right'>{v.version}</span></li>
2020-12-29 10:34:23 -08:00
</ul>
</div>
</div>
</Column>
);
}
}