import React, { useCallback, useState } from "react";
import { HStack, Link, Pressable, Spinner, Text, useBreakpointValue, VStack } from "native-base";
import { SupportedChains, useFVLink } from "@gooddollar/web3sdk-v2";
import Clipboard from "@react-native-clipboard/clipboard";
import { useGoodId } from "../../../hooks/useGoodId";
import { GoodIdCard } from "../components";
import { Image } from "../../../core/images";
import { Title, TransText } from "../../../core/layout";
import { Web3ActionButton } from "../../../advanced";
import { truncateMiddle } from "../../../utils";
import { withTheme } from "../../../theme/hoc/withTheme";
import FaceIcon from "../../../assets/images/face.png";
import CopyIcon from "../../../assets/images/copy.png";
import WalletIcon from "../../../assets/images/wallet.png";
const ActionButtonRound = ({ ...props }) => (
);
const FaceId = ({ ...props }) => {
const { getFvSig } = useFVLink();
const [fvId, setFvId] = useState(undefined);
const truncFaceId = truncateMiddle(fvId, 11);
const retreiveFaceId = useCallback(async () => {
const sig = await getFvSig();
setFvId(sig.slice(0, 42));
}, [getFvSig]);
const margin = useBreakpointValue({
base: "1",
lg: "0"
});
const copyFvId = useCallback(() => {
if (!fvId) return;
Clipboard.setString(fvId);
}, [fvId]);
return (
{truncFaceId ? {truncFaceId} : null}
{!truncFaceId ? (
) : (
)}
);
};
export const GoodIdDetails = withTheme({ name: "GoodIdDetails" })(
({
account,
withHeader = false,
isVerified = false,
...props
}: {
account: string;
isVerified?: boolean;
withHeader?: boolean;
container?: any;
header?: any;
innerContainer?: any;
section?: any;
}) => {
const { container, header, innerContainer, section } = props;
const { certificateSubjects, expiryFormatted, isWhitelisted } = useGoodId(account);
const truncAccount = truncateMiddle(account, 11);
const copyAddress = useCallback(() => {
if (!account) return;
Clipboard.setString(account);
}, [account]);
if (!account || (!isVerified && isWhitelisted === undefined)) return ;
return (
{withHeader ? (
{`GoodID`}
) : null}
{truncAccount}
{`this guide`}
),
helperLink: (
{`this helper app`}
)
}}
/>
);
}
);