import { useState, useEffect } from 'react'
import {BrowserRouter, Routes, Route} from 'react-router-dom';
import reactLogo from './assets/react.svg'
import './App.css'
import Tasse from "./components/Tasse.jsx"
import Banner from "./components/Banner.jsx"
import New from "./components/New.jsx"
import Beneficiary from "./components/Beneficiary.jsx"
import Testator from "./components/Testator.jsx"
import eth from "./eth/eth.js"

function App() {

  useEffect(() => {
    if(window.ethereum.selectedAddress) {
      eth.init()
    }      
  },[])

  return (
    <>
      <BrowserRouter>
        <Banner/>
        <Routes>
          <Route path="/*" element={<New/>} />
          <Route path="/new" element={<New/>} />
          <Route path="/beneficiary" element={<Beneficiary/>} />
          <Route path="/Testator" element={<Testator/>} />
        </Routes>
      </BrowserRouter>
    </>
  )
}

export default App
