import { useConnection, useWallet } from '@solana/wallet-adapter-react'
import { useSolana } from './solana-provider'

export function AppFeature() {
  const { connection } = useConnection()
  const { network } = useSolana()
  const wallet = useWallet()

  if (wallet.connecting) {
    return <div>Connecting wallet...</div>
  }

  if (!wallet.connected || !wallet?.publicKey) {
    return <div>Connect your wallet to continue</div>
  }

  return (
    <div>
      <div>Endpoint {`${connection.rpcEndpoint}`}</div>
      <div>Network {`${network}`}</div>
      <div>Public Key {`${wallet.publicKey}`}</div>
    </div>
  )
}
