diff --git a/web/package.json b/web/package.json index 674a83f91..663d950b7 100644 --- a/web/package.json +++ b/web/package.json @@ -8,8 +8,10 @@ "license": "MIT", "alias": { "src": "./src", + "utils": "./src/utils", "assets": "./src/assets", "components": "./src/components", + "connectors": "./src/connectors", "context": "./src/context", "layout": "./src/layout", "consts": "./src/consts", @@ -57,16 +59,20 @@ "@graphql-codegen/typescript-operations": "^2.5.3", "@kleros/kleros-v2-contracts": "workspace:^", "@kleros/ui-components-library": "^1.7.0", + "@web3-react/core": "^6.1.9", + "@web3-react/injected-connector": "^6.0.7", + "@web3-react/types": "^6.0.7", "chart.js": "^3.9.1", "chartjs-adapter-moment": "^1.0.0", "core-js": "^3.21.1", - "ethers": "^5.6.5", + "ethers": "^5.7.0", "graphql": "^16.4.0", "graphql-request": "^4.2.0", "moment": "^2.29.4", "react": "^18.2.0", "react-chartjs-2": "^4.3.1", "react-dom": "^18.2.0", + "react-error-boundary": "^3.1.4", "react-is": "^18.2.0", "react-router-dom": "6", "styled-components": "^5.3.5", diff --git a/web/src/app.tsx b/web/src/app.tsx index 574781e8a..e03e75d9e 100644 --- a/web/src/app.tsx +++ b/web/src/app.tsx @@ -1,8 +1,10 @@ import React from "react"; -import StyledComponentsProvider from "context/StyledComponentsProvider"; import { SWRConfig } from "swr"; import { request } from "graphql-request"; import { Routes, Route } from "react-router-dom"; +import Web3Provider from "context/Web3Provider"; +import StyledComponentsProvider from "context/StyledComponentsProvider"; +import WrongChainBoundary from "components/WrongChainBoundary"; import Layout from "layout/index"; import Home from "./pages/Home"; import Cases from "./pages/Cases"; @@ -25,18 +27,22 @@ const App: React.FC = () => { ), }} > - - }> - } /> - } /> - Courts} /> - } /> - Justice not found here ¯\_( ͡° ͜ʖ ͡°)_/¯} - /> - - + + + + }> + } /> + } /> + Courts} /> + } /> + Justice not found here ¯\_( ͡° ͜ʖ ͡°)_/¯} + /> + + + + ); diff --git a/web/src/components/CasesDisplay/Stats.tsx b/web/src/components/CasesDisplay/Stats.tsx index ef2185590..3d8e0b2aa 100644 --- a/web/src/components/CasesDisplay/Stats.tsx +++ b/web/src/components/CasesDisplay/Stats.tsx @@ -32,10 +32,10 @@ const fields = [ const Stats: React.FC = () => (
{fields.map(({ label, value }, i) => ( - <> - + + {i + 1 < fields.length ? : null} - + ))}
); diff --git a/web/src/components/ConnectButton.tsx b/web/src/components/ConnectButton.tsx index cae2ffb7a..8f539c856 100644 --- a/web/src/components/ConnectButton.tsx +++ b/web/src/components/ConnectButton.tsx @@ -1,6 +1,52 @@ import React from "react"; +import styled from "styled-components"; +import { shortenAddress } from "utils/shortenAddress"; import { Button } from "@kleros/ui-components-library"; +import { useWeb3 } from "hooks/useWeb3"; +import { useConnect } from "hooks/useConnect"; +import { SUPPORTED_CHAINS } from "consts/supportedChains"; -const ConnectButton: React.FC = () =>