import React from "react";
import { connect } from "react-redux";
import CopyRight from "../components/CopyRight";
import {SHOW_COPY_MODAL, CLOSE_COPY_MODAL,SHOW_DISCLAIMER_MODAL,CLOSE_DISCLAIMER_MODAL, GET_VERSION} from '../store/types/copyRight';
import {getMessage, getDisMessage} from '../store/async-actions/copyRight';
import { storageLocal } from "@utils/tools"

function mapStateToProps({copyRight}) {
  return {copyRight};
}

function mapDispatchToProps(dispatch) {
  return {
    showCopyModal: () => {
      dispatch({type: SHOW_COPY_MODAL})
    },
    closeCopyModal: () => {
      dispatch({type: CLOSE_COPY_MODAL})
    },
    showDisclatmerModal: () => {
      dispatch({type: SHOW_DISCLAIMER_MODAL})
    },
    closeDisclatmerModal: () => {
      dispatch({type: CLOSE_DISCLAIMER_MODAL})
    },
    getMessage: () => {
      dispatch(getMessage)
    },
    getDisMessage: () => {
      dispatch(getDisMessage)
    },
    closeVersionTip: () => {
      dispatch({
        type: GET_VERSION,
        hasNewVersion: false
      })
      storageLocal.set('hasNewVersion','false');
    }
  };
}

const CopyRightContainer = connect(
  mapStateToProps,
  mapDispatchToProps
)(CopyRight);

export default CopyRightContainer;