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-12-04 16:39:53 +00:00
|
|
|
import { themedHeader } from '../../utils/navigation';
|
|
|
|
import { withTheme } from '../../theme';
|
|
|
|
import { themes } from '../../constants/colors';
|
2019-05-18 19:31:33 +00:00
|
|
|
|
2019-08-07 13:51:34 +00:00
|
|
|
class AdminPanelView extends React.Component {
|
2019-12-04 16:39:53 +00:00
|
|
|
static navigationOptions = ({ navigation, screenProps }) => ({
|
|
|
|
...themedHeader(screenProps.theme),
|
2019-05-18 19:31:33 +00:00
|
|
|
headerLeft: <DrawerButton navigation={navigation} />,
|
|
|
|
title: I18n.t('Admin_Panel')
|
|
|
|
})
|
|
|
|
|
|
|
|
static propTypes = {
|
|
|
|
baseUrl: PropTypes.string,
|
2019-12-04 16:39:53 +00:00
|
|
|
authToken: PropTypes.string,
|
|
|
|
theme: PropTypes.string
|
2019-05-18 19:31:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2019-12-04 16:39:53 +00:00
|
|
|
const { baseUrl, authToken, theme } = this.props;
|
2019-05-18 19:31:33 +00:00
|
|
|
if (!baseUrl) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return (
|
2019-12-04 16:39:53 +00:00
|
|
|
<SafeAreaView style={[styles.container, { backgroundColor: themes[theme].backgroundColor }]} testID='terms-view'>
|
|
|
|
<StatusBar theme={theme} />
|
2019-05-18 19:31:33 +00:00
|
|
|
<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
|
|
|
|
});
|
|
|
|
|
2019-12-04 16:39:53 +00:00
|
|
|
export default connect(mapStateToProps)(withTheme(AdminPanelView));
|