'use client'; import { Draggable } from '@/internal/components/Draggable/Draggable'; import { useIsMounted } from '@/internal/hooks/useIsMounted'; import { cn } from '@/styles/theme'; import { useRef } from 'react'; import { getWalletDraggableProps } from '../utils/getWalletDraggableProps'; import { ConnectWallet } from './ConnectWallet'; import { WalletDropdown } from './WalletDropdown'; import { WalletProvider, useWalletContext } from './WalletProvider'; import { Button } from '@/ui/Button'; export type WalletProps = { children?: React.ReactNode; /** Whether to sponsor transactions for Send feature of advanced wallet implementation */ isSponsored?: boolean; className?: string; } & ( | { draggable?: true; draggableStartingPosition?: { x: number; y: number } } | { draggable?: false; draggableStartingPosition?: never } ); function WalletContent({ children, className, draggable, draggableStartingPosition, }: WalletProps) { const { isSubComponentOpen, isConnectModalOpen, connectRef, breakpoint } = useWalletContext(); const walletContainerRef = useRef(null); if (draggable) { return (
{children}
); } return (
{children}
); } export function Wallet({ children = ( <> ), className, draggable, draggableStartingPosition, isSponsored, }: WalletProps) { const isMounted = useIsMounted(); // prevents SSR hydration issue if (!isMounted) { return ; } return ( {children} ); }