import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useAppState } from "../../overmind";
import { Avatar, Col, Row } from "antd";
import { Link } from "react-router-dom";
import { ProgressBar } from "./Components/Icons";
import { useCachedDaoWhitelistProposal, useCachedUser } from "../../hooks/useCached";
import { useParams } from "react-router";
import { ContentImage } from "../../Components/Image";
import { WhitelistProposalRow } from "./Components/WhitelistProposalRow";
import { getLocalTimeData } from "./Utils/Helpers";
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);
    if (!(Number(proposal?.id) >= 0))
        return _jsx("div", { children: "Proposal was executed or does not exist." });
    return _jsxs(Col, { className: "view-proposal-wrapper", children: [_jsx(WhitelistProposalRow, { daoOwner: daoOwner, proposalId: proposalId, proposal: proposal, wrapperClass: "u-dao-row-wrapper", embedded: true }), _jsxs("p", { className: "paragraph-2b", children: ["YES votes: ", (proposal.vote_yes?.quantity)] }), _jsxs("p", { className: "paragraph-2b", children: ["NO votes: ", (proposal.vote_no?.quantity), " "] }), _jsx(ProgressBar, { width: "642px", proposal: proposal }), _jsxs("p", { className: "view-proposal-time-p", children: ["Ending: ", timeData.time_left_from_now, " "] }), _jsxs("p", { className: "view-proposal-summary-p", children: [" ", proposal.summary] }), _jsx("p", { className: "view-proposal-by-p", children: "Proposal by" }), _jsxs(Row, { className: "view-proposal-user-details-wrapper", children: [_jsxs(Link, { className: "proposal-list-proposal-avi-link", to: `/user/${proposal.proposer}`, children: [" ", _jsx(Avatar, { src: _jsx(ContentImage, { ...proposerObj }), className: "proposal-list-proposal-avi-cmpt" })] }), _jsxs(Row, { align: "middle", children: [_jsx("p", { className: "view-proposal-user-display-name-p", children: proposal.proposer }), _jsx("p", { className: "view-proposal-user-full-name-p", children: proposerObj.fullName })] })] })] });
};
export default ViewWhitelistProposal;
//# sourceMappingURL=ViewWhitelistProposal.js.map