import { Col, Dropdown, Row, Tabs } from "antd"; import { CrossCircle } from "./Icons/CrossCircle"; import { IOView } from "../types"; import { NCOLogo } from "./Icons/NCOLogo"; import { RefObject, useEffect, useRef, useState } from "react"; import { UserNewcoinPoolsParticipation } from "./UserWidget"; import { VerifiedIcon } from "./Icons/VerifiedIcon"; import { VerifiedIconLight } from "./Icons/VerifiedIconLight"; import { useActions, useAppState } from "../overmind"; import { useVerified } from "../hooks/useVerified"; import OutsideClickHandler from "react-outside-click-handler"; const roundCurrency = (vals: string[]) => { const val = vals?.length ? vals[0] : " "; const [n, c] = val.split(/ /); return n.replace(/\.?0+$/, "") + " " + c; }; export const Wallet: IOView<{ walletShown: boolean; }> = ({ walletShown }) => { const state = useAppState(); const actions = useActions(); const user = state.api.auth.user; const ncoBalance = state.newcoin.account; const gncoBalance = state.newcoin.mainPool; const { verifiedUsers } = useVerified([user.username || ""]); const isUserVerified = verifiedUsers && user.username && verifiedUsers.includes(user.username); if (!user) return <>; const rowGutter = !(ncoBalance.length === 0 && gncoBalance.length === 0) ? 0 : 24; // const walletShown = !!state.flows.userJourney.flags.walletShown; const setVisible = (value: boolean) => actions.flows.userJourney.setFlag({ flag: "walletShown", value: value ? "true" : "", }); return (
setVisible(!walletShown)} style={{ cursor: "pointer", padding: "30px 10px 0px 20px" }}>

{user.username} {isUserVerified ? ( ) : ( false )}

{roundCurrency(ncoBalance.acc_balances)} {roundCurrency(gncoBalance.acc_balances)}
{/* */}

); }; export const WalletWidget: IOView = () => { const state = useAppState(); const actions = useActions(); const walletShown = !!state.flows.userJourney.flags.walletShown; const setVisible = (value: boolean) => actions.flows.userJourney.setFlag({ flag: "walletShown", value: value ? "true" : "", }); useEffect(() => { setVisible(false); }, []); return (
setVisible(val)} overlayStyle={{}} overlay={} >
setVisible(!walletShown)}>
); };