Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Migrate AdminPanelView to Typescript #3377

Merged
merged 4 commits into from
Sep 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { WebView } from 'react-native-webview';
import { connect } from 'react-redux';
import { DrawerScreenProps } from '@react-navigation/drawer';

import I18n from '../../i18n';
import StatusBar from '../../containers/StatusBar';
Expand All @@ -10,17 +10,22 @@ import { withTheme } from '../../theme';
import { getUserSelector } from '../../selectors/login';
import SafeAreaView from '../../containers/SafeAreaView';

class AdminPanelView extends React.Component {
static navigationOptions = ({ navigation, isMasterDetail }) => ({
interface IAdminPanelViewProps {
baseUrl: string;
token: string;
}

interface INavigationOptions {
navigation: DrawerScreenProps<any>;
isMasterDetail: boolean;
}

class AdminPanelView extends React.Component<IAdminPanelViewProps, any> {
static navigationOptions = ({ navigation, isMasterDetail }: INavigationOptions) => ({
headerLeft: isMasterDetail ? undefined : () => <HeaderButton.Drawer navigation={navigation} />,
title: I18n.t('Admin_Panel')
});

static propTypes = {
baseUrl: PropTypes.string,
token: PropTypes.string
};

render() {
const { baseUrl, token } = this.props;
if (!baseUrl) {
Expand All @@ -40,7 +45,7 @@ class AdminPanelView extends React.Component {
}
}

const mapStateToProps = state => ({
const mapStateToProps = (state: any) => ({
baseUrl: state.server.server,
token: getUserSelector(state).token
});
Expand Down