import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Button, Col, Modal, Row } from "antd";
import { ImageComponent } from "../../Components/MediaComponents/ImageMediaComponent";
import { VerifiedIcon } from "../Icons/VerifiedIcon";
import { showPopUp } from "../../utils/popup";
import { useAppState } from "../../overmind";
import { useCachedPool } from "../../hooks/useCached";
import { usePowerup } from "../../hooks/usePowerup";
import { useVerified } from "../../hooks/useVerified";
import EightTimesIcon from "../Icons/EightTimesIcon";
import InfinityIcon from "../Icons/InfinityIcon";
import { useState } from "react";
import isEmpty from "lodash/isEmpty";
const Powerup = ({ user }) => {
    const { powerup } = usePowerup(user);
    const [open, setOpen] = useState(false);
    const poolInfo = useCachedPool({ owner: user?.username });
    const state = useAppState();
    const { verifiedUsers } = useVerified([user.username || ""]);
    const isUserVerified = verifiedUsers && user.username && verifiedUsers.includes(user.username);
    const showModal = () => {
        setOpen(true);
        // if (!isEmpty(user.newcoinTicker || !isEmpty(poolInfo?.code)))
        powerup(1);
    };
    const powerup8x = () => {
        powerup(8);
        setOpen(false);
    };
    const handleCancel = () => {
        setOpen(false);
    };
    return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: showModal, className: "power-up-btn", children: _jsx("p", { className: "paragraph-2b power-up-btn-label", children: "Power up" }) }), _jsx(Modal, { className: "nl-powerup-dialog", visible: open, maskClosable: true, footer: false, closable: false, maskStyle: {
                    backgroundColor: "rgba(255, 255, 255, 0.56)",
                    backdropFilter: "blur(13.5px)",
                }, onCancel: handleCancel, modalRender: () => {
                    return (_jsxs("div", { className: "nl-powerup-dialog-container", children: [_jsx(Row, { justify: "center", children: _jsx("div", { className: "nl-powerup-dialog-title", children: "AMPLIFY YOUR POWER-UP" }) }), _jsxs(Row, { className: "nl-powerup-dialog-profileContainer", align: "middle", justify: "center", children: [_jsx(Col, { children: _jsx(ImageComponent, { ...user, size: "small", className: "nl-powerup-dialog-profilePicture" }) }), _jsx(Col, { children: _jsx("div", { className: "nl-powerup-dialog-username", children: user.username }) }), _jsx(Col, { children: isUserVerified ? _jsx(VerifiedIcon, { fillColor: "#000" }) : false }), !isEmpty(user.newcoinTicker || poolInfo?.code) && (_jsxs(Col, { className: "nl-powerup-dialog-ticker", xs: 24, sm: 5, children: ["$", user.newcoinTicker || poolInfo?.code] }))] }), isEmpty(user.newcoinTicker || poolInfo?.code) ? (_jsx(Row, { justify: "center", className: "nl-powerup-dialog-noDaoMsg", children: "has not created their DAO yet. Please check this profile later." })) : (_jsxs(_Fragment, { children: [_jsxs(Row, { className: "nl-powerup-dialog-btn", align: "middle", onClick: powerup8x, children: [_jsx(Col, { className: "nl-powerup-dialog-btn-text", xs: 14, children: "Go premium and amplify all your Power-ups, up to 100 per day." }), _jsx(Col, { className: "nl-powerup-dialog-btn-icon", children: _jsx(EightTimesIcon, { width: "60", height: "30" }) })] }), _jsxs(Row, { className: "nl-powerup-dialog-btn", align: "middle", onClick: () => {
                                            showPopUp(`https://auth${state.config.env.env == "dev" ? "-dev" : ""}.newsafe.org/swap/GNCO/${user?.newcoinTicker?.toUpperCase()}`, "__NEWSAFE__");
                                        }, children: [_jsx(Col, { className: "nl-powerup-dialog-btn-text", xs: 14, children: "Swap $GNCO and power as much as you can." }), _jsx(Col, { className: "nl-powerup-dialog-btn-icon", children: _jsx(InfinityIcon, { width: "60", height: "30" }) })] })] }))] }));
                } })] }));
};
export default Powerup;
//# sourceMappingURL=index.js.map