import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { AviLinkRegular } from "../../Components/AviLink";
import { BlockExplorerIcon } from "../../Components/Icons";
import { Button, Col, Row } from "antd";
import { UserStake } from "../../../../Components/UserWidget";
import { ViewWhitelistProposalPageRow } from "../../Components/Previews/Whitelist/ViewWhitelistProposalPageRow/ViewWhitelistProposalPageRow";
import { VoteBarFull } from "../../Components/VoteBar";
import { getLocalTimeData, useGetAuthorizedActions } from "../../Utils/Helpers";
import { useAppState } from "../../../../overmind";
import { useCachedDaoWhitelistProposal, useCachedPool, useCachedUser } from "../../../../hooks/useCached";
import { useParams } from "react-router";
export const ViewWhitelistProposalPage = () => {
    const { daoOwner, id, proposal } = useParams();
    return _jsx(ViewWhitelistProposal, { proposal: proposal, daoOwner: daoOwner, proposalId: id });
};
const ViewWhitelistProposal = (props) => {
    const state = useAppState();
    const daoOwner = props.daoOwner || state.config.settings.newcoin.daoDomain;
    const proposalId = props.proposalId;
    const proposal = useCachedDaoWhitelistProposal({ daoOwner, proposalId });
    const proposerObj = useCachedUser({ username: proposal.proposer });
    const timeData = getLocalTimeData(proposal);
    const daoOwnerObj = useCachedUser({ username: daoOwner });
    const pool = useCachedPool({ owner: daoOwner });
    if (!(Number(proposal?.id) >= 0))
        return _jsx("div", { children: "Proposal was executed or does not exist." });
    const proposal_type = "standart";
    const currUser = state.api.auth.user?.username || "";
    let { status_tag, action_type, vote } = useGetAuthorizedActions({
        daoOwner,
        proposalId,
        currUser,
        proposal_type,
        proposal,
    });
    return (_jsxs(Col, { className: "view-proposal-wrapper u-margin-top-mega", children: [_jsx(ViewWhitelistProposalPageRow, { daoOwner: daoOwner, proposalId: proposalId, proposal: proposal, wrapperClass: "u-margin-bottom-large u-dao-row-wrapper", embedded: true, buttonType: false }), _jsx("p", { className: "view-proposal-type-p", children: " #new member" }), _jsx(Row, { align: "middle", justify: "space-between", children: _jsxs("p", { className: " u-margin-bottom-30 view-proposal-row-dao-details", children: ["Posted by", _jsx(AviLinkRegular, { username: proposal.proposer, userObj: proposerObj, showVerified: false, wrapperClass: "avi" }), "in the", _jsx(AviLinkRegular, { username: daoOwner, userObj: daoOwnerObj, showVerified: false, wrapperClass: "avi" }), "DAO", _jsx("a", { href: "#", target: "rel_no_opener", children: _jsx(BlockExplorerIcon, {}) }), _jsx(Button, { className: `u-dao-proposal-${status_tag}-tag-status-btn`, children: _jsx("span", { children: status_tag }) }), _jsx(UserStake, { buttonText: `Get $${pool.code}`, user: { username: daoOwner }, hideButton: false })] }) }), _jsx(VoteBarFull, { proposal: proposal, timeData: timeData })] }));
};
export default ViewWhitelistProposal;
//# sourceMappingURL=ViewWhitelistProposal.js.map