import React, { CSSProperties } from "react"; import { Token } from "@uniswap/sdk-core"; import { AutoRow, RowFixed } from "../Row"; import { AutoColumn } from "../Column"; import CurrencyLogo from "../CurrencyLogo"; import { TYPE } from "../../theme"; import ListLogo from "../ListLogo"; import useTheme from "../../hooks/useTheme"; import { ButtonPrimary } from "../Button"; import styled from "styled-components/macro"; import { useIsUserAddedToken, useIsTokenActive } from "../../hooks/Tokens"; import { CheckCircle } from "react-feather"; import { WrappedTokenInfo } from "../../state/glists/wrappedTokenInfo"; const TokenSection = styled.div<{ dim?: boolean }>` padding: 4px 20px; height: 56px; display: grid; grid-template-columns: auto minmax(auto, 1fr) auto; grid-gap: 16px; align-items: center; opacity: ${({ dim }) => (dim ? "0.4" : "1")}; `; const CheckIcon = styled(CheckCircle)` height: 16px; width: 16px; margin-right: 6px; stroke: ${({ theme }) => theme.green1}; `; const NameOverflow = styled.div` white-space: nowrap; text-overflow: ellipsis; overflow: hidden; text-overflow: ellipsis; max-width: 140px; font-size: 12px; `; export default function ImportRow({ token, style, dim, showImportView, setImportToken, }: { token: Token; style?: CSSProperties; dim?: boolean; showImportView: () => void; setImportToken: (token: Token) => void; }) { const theme = useTheme(); // check if already active on list or local storage tokens const isAdded = useIsUserAddedToken(token); const isActive = useIsTokenActive(token); const list = token instanceof WrappedTokenInfo ? token.list : undefined; return ( {token.symbol} {token.name} {list && list.logoURI && ( via {list.name} )} {!isActive && !isAdded ? ( { setImportToken && setImportToken(token); showImportView(); }} > Import ) : ( Active )} ); }