import React from "react";
import { noop } from "lodash";
import { Box, Center, HStack, Text, VStack } from "native-base";
import { SupportedChains } from "@gooddollar/web3sdk-v2";
import moment from "moment";
import { Image } from "../../images";
import BasicStyledModal from "./BasicStyledModal";
import { truncateMiddle } from "../../../utils/string";
import { isReceiveTransaction } from "../../../apps/ubi/utils/transactionType";
import { Transaction } from "../../../apps/ubi/types";
import BillyReceive from "../../../assets/images/billy-receive.png";
import { GoodButton } from "../../buttons";
import { GdAmount } from "../../layout";
import { ExplorerLink } from "../..";
import UnknownAvatarIcon from "../../../assets/images/goodid/unknown-avatar.png";
import { getTxIcons } from "../../../utils/icons";
import { Platform } from "react-native";
const TxDetailsContent = ({ tx, color, network }: { tx: Transaction; color: string; network: number }) => {
const { account, contractAddress, contractName, date, isPool, tokenValue, type } = tx;
const { txIcon, networkIcon, contractIcon } = getTxIcons(tx);
const txDate = date ? moment(date).local().format?.("MM.DD.YYYY HH:mm") : "";
const trunContractAddr = truncateMiddle(contractAddress, 11);
const trunAccountAddr = truncateMiddle(account, 11);
return (
{txDate}
{tokenValue ? (
) : null}
from:
{contractName}
{/* Todo: should link to gc or explorer */}
{type !== "claim-start" ? (
{/* */}
To:{" "}
{/* todo: me or first-name (wallet) */}
Me
) : null}
);
};
const TxDetailsFooter = ({
txHash,
type,
onClose,
network
}: {
txHash: any;
type: string;
onClose?: () => void;
network: SupportedChains;
}) => {
const trunTxHash = truncateMiddle(txHash, 11);
return (
{type !== "claim-start" ? (
TX Details
) : null}
OK
{/*todo: see if worth to implement/find native-base equivalent
*/}
);
};
export const TxDetailsModal = ({
open,
onClose = noop,
tx,
...props
}: {
open: boolean;
onClose?: () => void;
tx: any;
}) => {
const { transactionHash: txHash, type } = tx;
const isClaimStart = type === "claim-start";
const isReceive = isReceiveTransaction(tx);
const color = isClaimStart ? "#5A5A5A" : isReceive ? "#00C3AE" : "#F87171";
const network = SupportedChains[tx.network as keyof typeof SupportedChains];
return (
}
footer={}
withOverlay="dark"
withCloseButton
/>
);
};