fixed ui issues

This commit is contained in:
Abhishek Sinha 2020-04-17 18:53:03 +05:30
parent 1c1e3dcd7e
commit 1e6dcd1904

View File

@ -1349,7 +1349,7 @@
</svg>
<div>
<h5 class="light-text">FLO ID</h5>
<h4 class="breakable">FFS5hFXG7DBtdgzrLwixZLpenAmsCKRddm</h4>
<h4 class="breakable" id="localbitcoinuserdiv"></h4>
<button onclick="signOut()" class="top-margin">Sign Out</button>
</div>
</div>
@ -1383,7 +1383,7 @@
<h4 class="expand">Bitcoin</h4>
<h5>BTC</h5>
</span>
<h3 id="btc_market_price">₹480,600</h3>
<h3 id="btc_market_price"></h3>
</span>
<span class="crypto-price grid">
<svg class="icon flo" viewBox="0 0 45.6 47.07">
@ -1402,7 +1402,7 @@
<h4 class="expand">FLO</h4>
<h5>FLO</h5>
</span>
<h3 id="flo_market_price">₹1.30</h3>
<h3 id="flo_market_price"></h3>
</span>
</div>
<div id="balance_panel" class="top-padding card">
@ -1411,9 +1411,7 @@
</h3>
<div class="balance-display">
<h5 class="light-text">Cash</h5>
<h2 id="user_cash_bal">
₹50000
</h2>
<h2 id="user_cash_bal"> </h2>
<div id="refresh_cash_bal" class="action refresh">
<button type="submit">
refresh
@ -1426,9 +1424,7 @@
<div class="grid grid-2 top-margin">
<div class="balance-display">
<h5 class="light-text">Bitcoin</h5>
<h2 id="user_btc_bal">
600
</h2>
<h2 id="user_btc_bal"> </h2>
<div id="refresh_btc_bal" class="action refresh">
<button type="submit">
refresh
@ -1440,9 +1436,7 @@
</div>
<div class="balance-display">
<h5 class="light-text">FLO</h5>
<h2 id="user_flo_bal">
1200
</h2>
<h2 id="user_flo_bal"> </h2>
<div id="refresh_flo_bal" class="action refresh">
<button type="submit">
refresh
@ -1562,7 +1556,7 @@
<polyline points="29.83,1.41 2.83,28.41 29.83,55.41 "/>
</svg>
<h3>Deposit Crypto</h3>
<div class="action" id="depositAssetButton">
<div class="action" id="depositCryptoButton">
<button class="btn" type="submit" disabled>
Deposit
</button>
@ -1593,7 +1587,7 @@
<polyline points="29.83,1.41 2.83,28.41 29.83,55.41 "/>
</svg>
<h3>Withdraw Crypto</h3>
<div class="action" id="withdrawAssetButton">
<div class="action" id="withdrawCryptoButton">
<button class="btn" type="submit" disabled>
withdraw
</button>
@ -1623,7 +1617,7 @@
<polyline points="29.83,1.41 2.83,28.41 29.83,55.41 "/>
</svg>
<h3>Deposit Cash</h3>
<div class="action" id="depositAssetButton">
<div class="action" id="depositCashButton">
<button class="btn" type="submit" disabled>
Deposit
</button>
@ -1651,7 +1645,7 @@
<polyline points="29.83,1.41 2.83,28.41 29.83,55.41 "/>
</svg>
<h3>Withdraw Cash</h3>
<div class="action" id="withdrawAssetButton">
<div class="action" id="withdrawCashButton">
<button class="btn" type="submit" disabled>
withdraw
</button>
@ -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} &nbsp`;
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} &nbsp`;
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 = `<p><strong>Please pay the amount to following address:</strong></p>
<p>${resp.msg}</p>`;
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 = '<h4>No trade orders yet.</h4>'
}
@ -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 += `<span>${code}:${helper_functions.truncateDecimals(value)}</span> &nbsp;`;
});
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 @@
<script>
const depositWithdrawAsset = function(userFLOaddress="") {
let parentPopup = this.closest('.popup')
const RM_TRADE = new localbitcoinplusplus.trade();
const RM_RPC = new localbitcoinplusplus.rpc();
let deposit_crypto_div = document.getElementById("deposit_crypto_div");
let withdraw_crypto_div = document.getElementById("withdraw_crypto_div");
let depositAssetButton = document.getElementById("depositAssetButton");
let withdrawAssetButton = document.getElementById("withdrawAssetButton");
let depositCryptoButton = document.getElementById("depositCryptoButton");
let withdrawCryptoButton = document.getElementById("withdrawCryptoButton");
let err_msg = "";
get_crypto_svg_selection_html('deposit_assets_type', deposit_crypto_div);
get_crypto_svg_selection_html('withdraw_assets_type', withdraw_crypto_div);
depositAssetButton.addEventListener("click", function() {
depositCryptoButton.addEventListener("click", function() {
let parentPopup = this.closest('.popup')
let asset_type = document.querySelector("input[name='crypto']:checked").value;
tradeAmountSelect = document.getElementById('trade_amount_select');
let tradeAmount = helper_functions.truncateDecimals(tradeAmountSelect.value);
@ -30776,7 +30773,7 @@
}
});
withdrawAssetButton.addEventListener("click", function(params) {
withdrawCryptoButton.addEventListener("click", function(params) {
let parentPopup = this.closest('.popup');
let asset_type = document.querySelector("input[name='crypto']:checked").value;
let receivinAddress = document.getElementById('withdraw_recving_addr')
@ -30842,10 +30839,11 @@
const RM_TRADE = new localbitcoinplusplus.trade();
const RM_RPC = new localbitcoinplusplus.rpc();
const depositAssetButton = document.getElementById('depositAssetButton')
const depositCashButton = document.getElementById('depositCashButton')
const withdrawCashButton = document.getElementById('withdrawCashButton')
let user_deposited_cash = 0; // false
depositAssetButton.addEventListener("click", function() {
depositCashButton.addEventListener("click", function() {
user_deposited_cash === 0 ? user_deposited_cash = 1: user_deposited_cash = 0;
if(user_deposited_cash == 1){
this.firstElementChild.textContent = 'done';
@ -30897,7 +30895,7 @@
});
// Withdraw Cash function
withdrawAssetButton.addEventListener("click", function(params) {
withdrawCashButton.addEventListener("click", function(params) {
let parentPopup = this.closest('.popup')
let receivinAddress = parentPopup.querySelector("input[name='upiAddr']").value;
if (receivinAddress == null || receivinAddress.trim == "") {
@ -30966,8 +30964,8 @@
localbitcoinplusplus.master_configurations.tradableAsset1
)
);
let selectCryptoHtml = ``;
for (var i = 0; i < sendCryptoArray.length; i++) {
let selectCryptoHtml = ``;
selectCryptoHtml += `<label class="select-crypto">`;
selectCryptoHtml += `<input name="crypto" value="${sendCryptoArray[i]}"
type="radio" id="${radio_id}_${sendCryptoArray[i]}">`;
@ -31009,8 +31007,8 @@
}
function get_fiat_svg_selection_html(radio_id='', parenthtml='') {
let selectFiatHtml = ``;
for (const currency of localbitcoinplusplus.master_configurations.tradableAsset2) {
let selectFiatHtml = ``;
selectFiatHtml += `<label class="select-crypto">`;
selectFiatHtml += `<input name="currency" value="${currency}" type="radio">`;
if(currency=="INR") {
@ -31036,11 +31034,11 @@
}
function get_trading_amount_html(radio_id='', parenthtml='') {
let selectTradingAmountHtml = ``;
for (const amount of localbitcoinplusplus.master_configurations.validTradingAmount) {
let selectTradingAmountHtml = ``;
selectTradingAmountHtml += `<label class="select-crypto">`;
selectTradingAmountHtml += `<input name="trading_amount" value="${amount}" type="radio">`;
selectTradingAmountHtml += `<h4>${amount}</h4>`;
selectTradingAmountHtml += `<h2>${amount}</h2>`;
selectTradingAmountHtml += `<svg class="selected" viewBox="0 0 73 73">
<circle cx="36.5" cy="36.5" r="36"/>
<polyline points="18.23,37.39 29.73,48.9 54.77,25.21 "/>
@ -31050,7 +31048,6 @@
}
}
</script>
<!-- Broadcast Tx UI -->