import Popup from "@components/Popup";
import styles from "./styles.module.scss";
import {formatCash, stringFormat} from "@utils/helpers";
import {useSelector} from "react-redux";
import {getWithdrawBaseInfo, getWithdrawTax} from "@features/paySlice";
const i18n=global.i18n;
const WWithdrawRules = ({open,onClose}) => {
    const info=useSelector(getWithdrawBaseInfo);
    const tax=useSelector(getWithdrawTax);
    const renderContent=()=>{
        let OrderLimit="";
        let MinExchange="";
        let MaxExchange="";
        if (info){
            OrderLimit=info.OrderLimit;
            MinExchange=info.MinExchange;
            MaxExchange=info.MaxExchange;
        }
        let min=formatCash(MinExchange,0);
        let max=formatCash(MaxExchange,0);
        return (
            <div className={styles.rule_content}>
                <div>{stringFormat(i18n.t("withdraw.help.rule_1"), [min, max])}</div>
                <div>{i18n.t("withdraw.help.rule_2")}</div>
                <div>{stringFormat(i18n.t("withdraw.help.rule_3"), [OrderLimit])}</div>
                <div>{i18n.t("withdraw.help.rule_4")}</div>
                <div>{i18n.t("withdraw.help.rule_5")}</div>
                <div>{i18n.t("withdraw.help.rule_6")}</div>
                <div className={styles.tips}>{stringFormat(i18n.t("withdraw.help.rule_tips"), [tax])}</div>
            </div>
        )
    }
    return (
        <Popup onClose={onClose} open={open}>
            <div className={styles.content}>
                <div className={styles.title}>
                {i18n.t("withdraw.help.title")}
                </div>
                {renderContent()}
            </div>
        </Popup>
    )
}
export default WWithdrawRules;