From 0044cb41f763d4e25757c4ea4ee22ad651b96535 Mon Sep 17 00:00:00 2001 From: anhnt18 Date: Sat, 25 Sep 2021 12:24:19 +0700 Subject: [PATCH 1/3] up navbar wallet --- public/css/responsive.css | 5 ++++- src/App.js | 6 ++++-- src/components/UI/Navbar.js | 16 +++++++++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/public/css/responsive.css b/public/css/responsive.css index 7dc6940..794a507 100644 --- a/public/css/responsive.css +++ b/public/css/responsive.css @@ -202,4 +202,7 @@ .single-team-member:after { width: 80%; } -} \ No newline at end of file +} +.dropdown:hover .dropdown-menu { + display: block; + } \ No newline at end of file diff --git a/src/App.js b/src/App.js index 0948b97..1a01564 100644 --- a/src/App.js +++ b/src/App.js @@ -21,6 +21,7 @@ const monyaraContractAddress = "0xb68dF09062c055ff163645c428dcfc05b46812Cb"; const cUSDContractAddress = "0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1"; function App() { + const [celoBalance, setCeloBalance] = useState(0); const [usdBalance, setUsdBalance] = useState(0); const [contract, setcontract] = useState(null); const [address, setAddress] = useState(null); @@ -75,13 +76,14 @@ function App() { const getUSDBalance = async () => { try { const balance = await kit.getTotalBalance(address); + const celoBalance = balance.CELO.shiftedBy(-ERC20_DECIMALS).toFixed(2); const USDBalance = balance.cUSD.shiftedBy(-ERC20_DECIMALS).toFixed(2); - console.log(USDBalance); const contract = new kit.web3.eth.Contract( monyaraAbi, monyaraContractAddress ); setcontract(contract); + setCeloBalance(celoBalance) setUsdBalance(USDBalance); } catch (error) { console.log(error); @@ -222,7 +224,7 @@ function App() { return ( - + diff --git a/src/components/UI/Navbar.js b/src/components/UI/Navbar.js index f2316ab..cdcc1fb 100644 --- a/src/components/UI/Navbar.js +++ b/src/components/UI/Navbar.js @@ -20,7 +20,21 @@ const Navbar= props => {
  • {props.isAdmin && Admin}
  • -
  • Balance: {props.usdBalance}cUSD
  • +
  • + {props.address == undefined ? + + :} +
  • From 9911eea95ace4f263891ba7c7472439bdc1591fd Mon Sep 17 00:00:00 2001 From: anhnt18 Date: Sat, 25 Sep 2021 16:14:56 +0700 Subject: [PATCH 2/3] add date loan to review --- src/App.js | 2 -- src/components/Loan/MyLoanItem.js | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/App.js b/src/App.js index 1a01564..6391d1b 100644 --- a/src/App.js +++ b/src/App.js @@ -13,7 +13,6 @@ import BigNumber from "bignumber.js"; import monyaraAbi from "./contracts/monyara.abi.json"; import IERC20 from "./contracts/IERC.abi.json"; -import { captureRejections } from "events"; const ERC20_DECIMALS = 18; @@ -53,7 +52,6 @@ function App() { if (window.celo) { try { await window.celo.enable(); - // notificationOff() const web3 = new Web3(window.celo); let kit = newKitFromWeb3(web3); diff --git a/src/components/Loan/MyLoanItem.js b/src/components/Loan/MyLoanItem.js index eed6efa..ed29bdd 100644 --- a/src/components/Loan/MyLoanItem.js +++ b/src/components/Loan/MyLoanItem.js @@ -1,4 +1,13 @@ const MyLoanItem = (props) => { + var date = new Date(props.loan.timestamp * 1000); + + var dateLoan = date.getDate()+ + "/"+(date.getMonth()+1)+ + "/"+date.getFullYear()+ + " "+date.getHours()+ + ":"+date.getMinutes()+ + ":"+date.getSeconds(); + console.log(date) const redeemLoan = () => { props.redeemLoan(props.loan); }; @@ -28,6 +37,7 @@ const MyLoanItem = (props) => {
    {props.loan.name}

    Amount: {props.loan.amount}cUSD + 10% interest

    +

    Date loan: {dateLoan}

    {object}
    From ebfa817e9d3ef89c64e00f3e6a7d893194424142 Mon Sep 17 00:00:00 2001 From: anhnt18 Date: Sat, 25 Sep 2021 16:41:00 +0700 Subject: [PATCH 3/3] add function connect wallet --- src/App.js | 6 +++++- src/components/UI/Navbar.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/App.js b/src/App.js index 6391d1b..9ca2a1c 100644 --- a/src/App.js +++ b/src/App.js @@ -222,7 +222,11 @@ function App() { return ( - + diff --git a/src/components/UI/Navbar.js b/src/components/UI/Navbar.js index cdcc1fb..b18eb23 100644 --- a/src/components/UI/Navbar.js +++ b/src/components/UI/Navbar.js @@ -22,7 +22,7 @@ const Navbar= props => {
  • {props.address == undefined ? - :