Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion public/css/responsive.css
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,7 @@
.single-team-member:after {
width: 80%;
}
}
}
.dropdown:hover .dropdown-menu {
display: block;
}
12 changes: 8 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ 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;

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);
Expand Down Expand Up @@ -52,7 +52,6 @@ function App() {
if (window.celo) {
try {
await window.celo.enable();
// notificationOff()
const web3 = new Web3(window.celo);
let kit = newKitFromWeb3(web3);

Expand All @@ -75,13 +74,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);
Expand Down Expand Up @@ -222,7 +222,11 @@ function App() {

return (
<Router>
<Navbar isAdmin={isAdmin} usdBalance={usdBalance} />
<Navbar isAdmin={isAdmin}
usdBalance={usdBalance}
celoBalance={celoBalance}
address={address}
connectWallet={connectWallet}/>
<Switch>
<Route exact path="/">
<Body submitForm={submitForm} />
Expand Down
10 changes: 10 additions & 0 deletions src/components/Loan/MyLoanItem.js
Original file line number Diff line number Diff line change
@@ -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);
};
Expand Down Expand Up @@ -28,6 +37,7 @@ const MyLoanItem = (props) => {
<div className="service-content">
<h6 className=" bold">{props.loan.name}</h6>
<p>Amount: {props.loan.amount}cUSD + 10% interest</p>
<p>Date loan: {dateLoan}</p>
{object}
</div>
</div>
Expand Down
16 changes: 15 additions & 1 deletion src/components/UI/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,21 @@ const Navbar= props => {
<li className="nav-item">
{props.isAdmin && <Link className="nav-link" to="/admin">Admin</Link>}
</li>
<li className="lh-55px"><a href="#" className="btn login-btn ml-50">Balance: {props.usdBalance}cUSD</a></li>
<li className="lh-55px">
{props.address == undefined ?
<button class="btn login-btn ml-50" type="button" onClick={props.connectWallet} id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Connect wallet
</button>
:<div class="dropdown">
<button class="btn login-btn ml-50 dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
cUSD Balance: {props.usdBalance} $
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item">Address: 0x...{props.address.substr(-12)} </a>
<a class="dropdown-item">celo Balance: {props.celoBalance} $</a>
</div>
</div>}
</li>
</ul>
</div>
</div>
Expand Down