import { Card } from 'react-bootstrap' import styles from '@/styles/wallet.module.css' import Plug from '@/svgs/plug.svg' import Gear from '@/svgs/settings-5-fill.svg' import Link from 'next/link' import { Status, isConfigured } from '@/wallets/common' import DraggableIcon from '@/svgs/draggable.svg' import RecvIcon from '@/svgs/arrow-left-down-line.svg' import SendIcon from '@/svgs/arrow-right-up-line.svg' import useDarkMode from './dark-mode' import { useEffect, useState } from 'react' const statusToClass = status => { switch (status) { case Status.Enabled: return styles.success case Status.Disabled: return styles.disabled case Status.Error: return styles.error case Status.Warning: return styles.warning } } export default function WalletCard ({ wallet, draggable, onDragStart, onDragEnter, onDragEnd, onTouchStart, sourceIndex, targetIndex, index }) { const [dark] = useDarkMode() const { card: { title, image } } = wallet.def const [imgSrc, setImgSrc] = useState(image?.src) useEffect(() => { if (!imgSrc) return // wallet.png <-> wallet-dark.png setImgSrc(dark ? image?.src.replace(/\.([a-z]{3})$/, '-dark.$1') : image?.src) }, [dark]) return (
{wallet.status.any !== Status.Disabled && } {wallet.support.recv && } {wallet.support.send && }
{image ? {title} : {title}}
{isConfigured(wallet) ? <>configure : <>attach}
) }