import React from 'react';
import { Link } from 'react-router-dom';
import { connect } from 'dva';
import { PageProps } from '@/utils/types/interface';
import { GameModalController } from '@/utils/logic_tools/GameModal/game_modal';
import styles from './index.less';

class Main extends React.Component<PageProps> {
  state = {}

  componentDidMount() {
    const { dispatch } = this.props;
    dispatch({
      type: 'global/add'
    })
  }

  getDerivedStateFromProps(props: PageProps, state: any) {

  }

  render() {
    const { global } = this.props;
    return (
      <div className={styles.normal}>
        <Link to="/rank">
          main{global.count}
        </Link>
        <div
          onClick={() => {
            GameModalController.showPauseModal({
              content: '123',
              okText: 'ok',
            });
          }}
        >
          Modal
        </div>
      </div>
    );
  }
}

export default connect(({ global }: any) => ({ global }))(Main);
