2019-05-18 19:31:33 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { WebView } from 'react-native-webview';
|
2019-10-02 12:18:08 +00:00
|
|
|
import { SafeAreaView } from 'react-navigation';
|
2019-05-18 19:31:33 +00:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
import I18n from '../../i18n';
|
|
|
|
import StatusBar from '../../containers/StatusBar';
|
|
|
|
import { DrawerButton } from '../../containers/HeaderButton';
|
|
|
|
import styles from '../Styles';
|
|
|
|
|
2019-08-07 13:51:34 +00:00
|
|
|
class AdminPanelView extends React.Component {
|
2019-05-18 19:31:33 +00:00
|
|
|
static navigationOptions = ({ navigation }) => ({
|
|
|
|
headerLeft: <DrawerButton navigation={navigation} />,
|
|
|
|
title: I18n.t('Admin_Panel')
|
|
|
|
})
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
baseUrl: PropTypes.string,
|
|
|
|
authToken: PropTypes.string
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { baseUrl, authToken } = this.props;
|
|
|
|
if (!baseUrl) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return (
|
|
|
|
<SafeAreaView style={styles.container} testID='terms-view'>
|
|
|
|
<StatusBar />
|
|
|
|
<WebView
|
|
|
|
source={{ uri: `${ baseUrl }/admin/info?layout=embedded` }}
|
|
|
|
injectedJavaScript={`Meteor.loginWithToken('${ authToken }', function() { })`}
|
|
|
|
/>
|
|
|
|
</SafeAreaView>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-08-07 13:51:34 +00:00
|
|
|
|
|
|
|
const mapStateToProps = state => ({
|
|
|
|
baseUrl: state.settings.Site_Url || state.server ? state.server.server : '',
|
|
|
|
authToken: state.login.user && state.login.user.token
|
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(AdminPanelView);
|