import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { ApproveModal } from "../../../Modals/ApproveModal";
import { Avatar, Button, Row } from "antd";
import { ContentImage } from "../../../../../../Components/Image";
import { ExecuteModal } from "../../../Modals/ExecuteModal";
import { GetWhitelistedModal } from "../../../Modals/GetWhitelistedModal";
import { Link } from "react-router-dom";
import { StakeModal } from "../../../Modals/StakeModal";
import { VoteModal } from "../../../Modals/VoteModal";
import { WithdrawForm } from "../../../Modals/WithdrawModal";
import { useAppState } from "../../../../../../overmind";
import { useCachedDaoWhitelistProposal, useCachedUser } from "../../../../../../hooks/useCached";
import { useGetAuthorizedActions } from "../../../../Utils/Helpers";
export const ViewWhitelistProposalPageRow = (props) => {
    const state = useAppState();
    const currUser = state.api.auth.user?.username || "";
    const daoOwner = props.daoOwner || state.config.settings.newcoin.daoDomain;
    const proposalId = props.proposal.id;
    const proposal = useCachedDaoWhitelistProposal({
        daoOwner,
        proposalId: props?.proposal?.id,
    });
    const newMember = useCachedUser({ username: proposal.user });
    const proposal_type = "whitelist";
    let { status_tag, action_type, vote, timeData } = useGetAuthorizedActions({
        daoOwner,
        proposalId,
        proposal,
        currUser,
        proposal_type,
    });
    return (_jsxs(Row, { justify: "space-between", children: [_jsxs(Link, { to: `/user/${proposal.user}`, className: "wlst-member-details", children: [_jsx(Avatar, { src: _jsx(ContentImage, { ...newMember }), className: "wlst-member-avi" }), _jsxs("p", { className: "wlst-member-username", children: [" ", proposal.user] })] }), _jsxs(Row, { align: "top", className: "u-margin-bottom-30", children: [_jsx(Button, { className: `u-dao-proposal-${status_tag}-tag-status-btn u-margin-right-medium`, children: _jsx("span", { children: status_tag }) }), action_type == "GetWhitelisted" && _jsx(GetWhitelistedModal, { daoOwner: daoOwner }), action_type == "GetWhitelisted" && (_jsx(Link, { to: `/dao/${daoOwner}/proposals`, children: _jsx(Button, { className: "u-dao-view-btn", children: "Get Whitelisted" }) })), _jsx(StakeModal, { visible: action_type == "Stake", daoOwner: daoOwner }), action_type == "Approve" && _jsx(ApproveModal, { proposal_type: "whitelist", dao_owner: daoOwner, proposal_id: proposal.id }), _jsx(VoteModal, { proposal_type: "whitelist", daoOwner: daoOwner, proposal: proposal, proposalId: proposal.id, visible: action_type == "Vote" }), ["Withdraw", "Execute"].includes(action_type) && vote?.id && (_jsx(WithdrawForm, { vote_id: vote?.id, quantity: vote?.quantity?.quantity })), action_type == "Execute" && (_jsx(ExecuteModal, { dao_owner: daoOwner, proposal_type: "whitelist", dao_id: proposal.id, proposal_id: proposal.id, proposal_author: proposal.proposer })), action_type == "Voted" && (_jsx(Button, { className: "u-dao-view-btn", children: _jsxs("small", { children: ["Voted ", vote?.quantity?.quantity] }) }))] })] }));
};
//# sourceMappingURL=ViewWhitelistProposalPageRow.js.map