From 1e6dcd19046bf3dd7e0d59525955b0cf2c0935fa Mon Sep 17 00:00:00 2001 From: Abhishek Sinha Date: Fri, 17 Apr 2020 18:53:03 +0530 Subject: [PATCH] fixed ui issues --- index.html | 193 ++++++++++++++++++++++++++--------------------------- 1 file changed, 95 insertions(+), 98 deletions(-) diff --git a/index.html b/index.html index d239388..7ebaf17 100644 --- a/index.html +++ b/index.html @@ -1349,7 +1349,7 @@
FLO ID
-

FFS5hFXG7DBtdgzrLwixZLpenAmsCKRddm

+

@@ -1383,7 +1383,7 @@

Bitcoin

BTC
-

₹480,600

+

@@ -1402,7 +1402,7 @@

FLO

FLO
-

₹1.30

+

@@ -1411,9 +1411,7 @@
Cash
-

- ₹50000 -

+

FLO
-

- 1200 -

+

@@ -1593,7 +1587,7 @@

Withdraw Crypto

-
+
@@ -1623,7 +1617,7 @@

Deposit Cash

-
+
@@ -1651,7 +1645,7 @@

Withdraw Cash

-
+
@@ -1696,12 +1690,12 @@ //Checks for internet connection status if(!navigator.onLine) - notify('error', 'There seems to be a problem connecting to the internet.', 'fixed') + notify('There seems to be a problem connecting to the internet.','error', 'fixed') window.addEventListener('offline', () =>{ - notify('error', 'There seems to be a problem connecting to the internet.', 'fixed') + notify('There seems to be a problem connecting to the internet.','error', 'fixed') }) window.addEventListener('online', () =>{ - notify('', 'We are back online.') + notify('We are back online.') }) // function required for popups or modals to appear function showPopup(popup, permission){ @@ -1758,7 +1752,7 @@ } //Function for displaying toast notifications. pass in error for mode param if you want to show an error. - function notify(mode, message, behavior){ + function notify(message, mode, behavior){ let banner = document.getElementById('show_message'), back; if(mode === 'error'){ @@ -1849,7 +1843,7 @@ if(radio.checked) counter++; }) - if(counter == allRadios.length/2) + if(counter === 1) radioStatus = true; if(inputStatus && radioStatus) return true @@ -2012,7 +2006,7 @@ setTimeout(() => { btnLoading(btn, 'stop') hidePopup(parentPopup) - notify('', 'Crypto sent') + notify('Crypto sent') }, 1000) } @@ -2024,7 +2018,7 @@ setTimeout(() => { btnLoading(btn, 'stop') hidePopup(parentPopup) - notify('', 'Signed In') + notify('Signed In') document.querySelector('main').classList.remove('hide-completely') }, 1000) //} @@ -2040,7 +2034,7 @@ btnLoading(btn, 'stop') newBalance = 600000; document.getElementById('user_cash_bal').textContent = '₹'+newBalance; - notify('', 'Cash balance updated') + notify('Cash balance updated') },1000) break; case 'cryptoBtc': @@ -2050,7 +2044,7 @@ btnLoading(btn, 'stop') newBalance = 700; document.getElementById('user_btc_bal').textContent = newBalance; - notify('', 'Bitcoin balance updated') + notify('Bitcoin balance updated') },1000) break; case 'cryptoFlo': @@ -2060,7 +2054,7 @@ btnLoading(btn, 'stop') newBalance = 1500; document.getElementById('user_flo_bal').textContent = newBalance; - notify('', 'FLO balance updated') + notify('FLO balance updated') },1000) break; } @@ -2069,7 +2063,7 @@ function signOut(){ askConfirmation('Do you want to sign out?').then((result) => { if(result){ - notify('', 'Signed out') + notify('Signed out') document.querySelector('main').classList.add('hide-completely') showPopup('sign_in_popup') } @@ -13609,14 +13603,19 @@ #!#validTradingAmount=10,50,100,#!#btcTradeMargin=5000 #!#MaxBackups=1 #!#miners_fee={"btc":0.0003, "flo":0.0003} - #!#supernodesPubKeys=026FCC6CFF6EB3A39E54BEB6E13FC2F02C3A93F4767AA80E49E7E876443F95AE5F, - 0315C3A20FE7096CC2E0F81A80D5F1A687B8F9EFA65242A0B0881E1BA3EE7D7D53, + #!#supernodesPubKeys=0315C3A20FE7096CC2E0F81A80D5F1A687B8F9EFA65242A0B0881E1BA3EE7D7D53, + 03F7493F11B8E44B9798CD434D20FBE7FA34B9779D144984889D11A17C56A18742,039B4AA00DBFC0A6631DE6DA83526611A0E6B857D3579DF840BBDEAE8B6898E3B6, + 03C8E3836C9A77E2AF03D4265D034BA85732738919708EAF6A16382195AE796EDF,0349B08AA1ABDCFFB6D78CD7C949665AD2FF065EA02B3C6C47A5E9592C9A1C6BCB, + 026FCC6CFF6EB3A39E54BEB6E13FC2F02C3A93F4767AA80E49E7E876443F95AE5F, + #!#externalFiles={"d3js":"58f54395efa8346e8e94d12609770f66b916897e7f4e05f6c98780cffa5c70a3"} #!#cashiers={"032871A74D2DDA9D0DE7135F58B5BD2D7F679D2CCA20EA7909466D1A6912DF4022":"johnDoe@upi", "03DB4A12EB543B293DDBB0CE314C46C36D6761294AFBB7264A6D78F710FFD97CF0":"janeDoe@upi"} - #!#ShamirsMaxShares=8#!#supernodeSeeds={ - "ranchimall1":{"ip":"127.0.0.1:9111","kbucketId":"oZxHcbSf1JC8t5GjutopWYXs7C6Fe9p7ps"}, - "ranchimall6":{"ip":"127.0.0.1:9116","kbucketId":"oV1wCeWca3VawbBTfUGKA7Vd368PATnKAx"} - }`; + #!#ShamirsMaxShares=8#!#supernodeSeeds={"ranchimall1":{"ip":"127.0.0.1:9111","kbucketId":"oZxHcbSf1JC8t5GjutopWYXs7C6Fe9p7ps"}, + "ranchimall2":{"ip":"127.0.0.1:9112","kbucketId":"oTWjPupy3Z7uMdPcu5uXd521HBkcsLuSuM"}, + "ranchimall3":{"ip":"127.0.0.1:9113","kbucketId":"odYA6KagmbokSh9GY7yAfeTUZRtZLwecY1"}, + "ranchimall4":{"ip":"127.0.0.1:9114","kbucketId":"oJosrve9dBv2Hj2bfncxv2oEpTysg3Wejv"}, + "ranchimall5":{"ip":"127.0.0.1:9115","kbucketId":"oMhv5sAzqg77sYHxmUGZWKRrVo4P4JQduS"}, + "ranchimall6":{"ip":"127.0.0.1:9116","kbucketId":"oV1wCeWca3VawbBTfUGKA7Vd368PATnKAx"}}`; return callback(text); let master_data = ''; @@ -23718,16 +23717,9 @@ typeof user == "object" && user.myLocalFLOAddress == resp.data.trader_flo_address ) { - let counterTraderAccountAddress = `Please pay the amount to following address: - ${resp.msg}`; + let counterTraderAccountAddress = resp.msg; showMessage(counterTraderAccountAddress); - const withdrawCashButton = document.getElementById('withdrawAssetButton') - let messageShow = withdrawCashButton.querySelector('#upiToAddress') - messageShow.textContent = counterTraderAccountAddress; - messageShow.classList.remove('hide-completely') - withdrawCashButton.querySelectorAll('.input').forEach((input) => { - input.classList.add('hide-completely') - }) + notify(counterTraderAccountAddress); } }); } @@ -23762,14 +23754,8 @@ ) { let counterTraderAccountAddress = `Please pay ${resp.data.currency} ${resp.data.depositing_amount} to following UPI ID: ${resp.msg}`; - //showMessage(counterTraderAccountAddress); - const depositAssetButton = document.getElementById('depositAssetButton') - let messageShow = depositAssetButton.querySelector('#upiToAddress') - messageShow.textContent = counterTraderAccountAddress; - messageShow.classList.remove('hide-completely') - depositAssetButton.querySelectorAll('.input').forEach((input) => { - input.classList.add('hide-completely') - }) + showMessage(counterTraderAccountAddress); + notify(counterTraderAccountAddress); } }); } @@ -24861,9 +24847,9 @@ console.log(server_live_trading_prices); for(commodity of Object.values(server_live_trading_prices.live_trading_prices)) { if(commodity.crypto_code==="BTC") { - document.getElementById('btc_market_price').innerText = `${commodity.currency_code} ${commodity.rate}  `; + document.getElementById('btc_market_price').innerText = `${commodity.currency_code} ${commodity.rate}`; } else if(commodity.crypto_code==="FLO") { - document.getElementById('flo_market_price').innerText = `${commodity.currency_code} ${commodity.rate}  `; + document.getElementById('flo_market_price').innerText = `${commodity.currency_code} ${commodity.rate}`; } } } @@ -25320,16 +25306,9 @@ typeof user == "object" && user.myLocalFLOAddress == resp.data.trader_flo_address ) { - let counterTraderAccountAddress = `

Please pay the amount to following address:

-

${resp.msg}

`; + let counterTraderAccountAddress = resp.msg; showMessage(counterTraderAccountAddress); - const withdrawCashButton = document.getElementById('withdrawAssetButton') - let messageShow = withdrawCashButton.querySelector('#upiToAddress') - messageShow.textContent = counterTraderAccountAddress; - messageShow.classList.remove('hide-completely') - withdrawCashButton.querySelectorAll('.input').forEach((input) => { - input.classList.add('hide-completely') - }) + notify(counterTraderAccountAddress); } }); } @@ -25366,13 +25345,8 @@ ) { let counterTraderAccountAddress = `Please pay ${resp.data.currency} ${resp.data.depositing_amount} to following UPI ID: ${resp.msg}`; - const depositAssetButton = document.getElementById('depositAssetButton'); - let messageShow = depositAssetButton.querySelector('#upiToAddress'); - messageShow.textContent = counterTraderAccountAddress; - messageShow.classList.remove('hide-completely') - depositAssetButton.querySelectorAll('.input').forEach((input) => { - input.classList.add('hide-completely') - }); + showMessage(counterTraderAccountAddress); + notify(counterTraderAccountAddress); } }); @@ -25509,10 +25483,10 @@ ); Promise.all([pr1,pr2,pr3,pr4]).then(()=>{ - // Update balances - displayBalances( - localbitcoinplusplus.wallets.my_local_flo_address - ); + // Update balances + displayBalances( + localbitcoinplusplus.wallets.my_local_flo_address + ); }) .catch(e => {throw new Error(e)}); @@ -30282,9 +30256,7 @@ : `No FLO Id found`; showMessage(`Your FLO Id: ${my_flo_id}`); - const localbitcoinuserdiv = document.getElementById( - "localbitcoinuserdiv" - ); + const localbitcoinuserdiv = document.getElementById("localbitcoinuserdiv"); localbitcoinuserdiv.innerHTML = `${my_flo_id}`; // showMessage ->updating your balances @@ -30594,7 +30566,7 @@ let tradeId = e.target.closest('.cancel-order').id; e.target.closest('.order').remove(); - notify('', `Order id: ${tradeId} cancelled.`) + notify(`Order id: ${tradeId} cancelled.`) if(container.children.length === 0) container.innerHTML = '

No trade orders yet.

' } @@ -30612,7 +30584,6 @@ const displayBalances = flo_id => { if (typeof flo_id !== "string") return; showMessage(`Loading your balances.`); - const balances_div = document.getElementById("balances_div"); const user_crypto_balances = readDBbyIndex( "crypto_balances", "trader_flo_address", @@ -30632,13 +30603,40 @@ asset from DEPOSIT dection below.`); } - all_balances.map(user_balance_data => { - let code = - user_balance_data.crypto_currency || user_balance_data.currency; - let value = user_balance_data.crypto_balance || user_balance_data.cash_balance; - t += `${code}:${helper_functions.truncateDecimals(value)}  `; - }); - balances_div.innerHTML = t; + for (const user_balance_data of all_balances) { + let code = user_balance_data.crypto_currency || user_balance_data.currency; + let value = user_balance_data.crypto_balance || user_balance_data.cash_balance; + + switch (code) { + case "BTC": + document.getElementById('user_btc_bal').innerText = helper_functions.truncateDecimals(value); + break; + + case "BTC_TEST": + document.getElementById('user_btc_bal').innerText = helper_functions.truncateDecimals(value); + break; + + case "FLO": + document.getElementById('user_flo_bal').innerText = helper_functions.truncateDecimals(value); + break; + + case "FLO_TEST": + document.getElementById('user_flo_bal').innerText = helper_functions.truncateDecimals(value); + break; + + case "INR": + document.getElementById('user_cash_bal').innerText = 'INR '+helper_functions.truncateDecimals(value,2); + break; + + case "USD": + document.getElementById('user_cash_bal').innerText = 'USD ' +helper_functions.truncateDecimals(value,2); + break; + + default: + break; + } + } + } ); showMessage(t); @@ -30727,21 +30725,20 @@