import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { ApproveModal } from "../../../Modals/ApproveModal";
import { Button, Row } from "antd";
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 { useCachedDaoProposal } from "../../../../../../hooks/useCached";
import { useGetAuthorizedActions } from "../../../../Utils/Helpers";
export const ViewProposalRow = (props) => {
    const state = useAppState();
    const currUser = state.api.auth.user?.username || "";
    const daoOwner = props.daoOwner;
    const proposalId = props.proposal.id;
    const proposal = useCachedDaoProposal({
        daoOwner,
        proposalId: props?.proposal?.id,
    });
    const proposal_type = "standart";
    let { status_tag, action_type, vote } = useGetAuthorizedActions({
        daoOwner,
        proposalId,
        currUser,
        proposal_type,
        proposal,
    });
    return (_jsxs(Row, { className: props.wrapperClass || "view-proposal-row-wrapper", align: "middle", children: [_jsx("p", { className: "view-proposal-row-title-p", children: proposal.title }), _jsxs(Row, { align: "middle", children: [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: "standart", dao_owner: daoOwner, proposal_id: proposal.id }), _jsx(VoteModal, { proposal_type: "standart", 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: "standart", 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=ViewProposalRow.js.map