import { CashIcon } from "@src/assets";
import { IconWithTooltip, MaxBalance } from "@src/components";
import { usePrivySmartWallet, useSwapContext } from "@src/contexts";
interface Props {
  onMaxClick?: (balance: string) => void;
  type: "source" | "destination";
}

export const YourCash = ({ onMaxClick, type }: Props) => {
  const { cashToken, isFetchingBalances } = useSwapContext();
  const { smartWalletAddress } = usePrivySmartWallet();
  return (
    <div className="flex flex-col items-end">
      <div className="flex gap-1 items-center">
        <CashIcon className="w-6 h-6" />
        <span className="text-2xl font-medium">Cash</span>

        <IconWithTooltip
          tooltipText="Cash balances are held in USDC, a fully collateralized stablecoin"
          id="cash-tooltip"
        />
      </div>
      {type === "source" && onMaxClick && (
        <MaxBalance
          token={cashToken}
          onMaxClick={onMaxClick}
          isFetchingBalances={isFetchingBalances}
          smartWalletAddress={smartWalletAddress}
        />
      )}
    </div>
  );
};
