import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Avatar, Row } from "antd";
import { ContentImage } from "../../../../../../Components/Image";
import { Link } from "react-router-dom";
import { VerifiedIcon } from "../../../../../../Components/Icons/VerifiedIcon";
import { useAppState } from "../../../../../../overmind";
import { useCachedDaoWhitelist, useCachedUser } from "../../../../../../hooks/useCached";
import { useVerified } from "../../../../../../hooks/useVerified";
import map from "lodash/map";
const MemberRow = ({ user, daoId, ticker }) => {
    const state = useAppState();
    const userObj = useCachedUser({ username: user });
    let votes = state.newcoin.cache.votes[user]?.rows;
    let amtLocked;
    if (votes?.length) {
        let quantities = votes && votes?.filter((row) => row.dao_id == daoId).map((vote) => vote.quantity?.quantity);
        if (quantities?.length) {
            let amtsLocked = quantities && quantities?.map((qt) => Number(qt?.split(" ")[0]));
            if (amtsLocked?.length) {
                amtLocked = amtsLocked?.reduce((a, b) => a + b);
            }
        }
    }
    const { verifiedUsers } = useVerified(map(useCachedDaoWhitelist().rows, "user"));
    const isUserVerified = verifiedUsers && user && verifiedUsers.includes(user);
    return (_jsx(Link, { className: "", to: `/user/${user}`, children: _jsxs(Row, { align: "middle", className: "member-row-wrapper", children: [_jsxs(Row, { children: [_jsx(Link, { to: `/user/${user}`, children: _jsx(Avatar, { src: _jsx(ContentImage, { ...userObj }), className: "member-row-avi" }) }), _jsxs(Row, { align: "middle", className: "member-row-user-ctn", children: [_jsx("p", { className: "member-row-p", children: user || "Creator.io" }), isUserVerified && _jsx(VerifiedIcon, {})] })] }), _jsx(Row, { align: "middle", children: _jsxs("p", { className: "member-row-p", children: [amtLocked || 0, " $", ticker] }) })] }) }));
};
export default MemberRow;
//# sourceMappingURL=MemberRow.js.map