+ + + + RanchiMall + + + + RanchiMall Bank + + + + + Sign in + + + + Decentralized banking made simple + *Interest rates are re-calculated with each new transaction done on network + + + + +
@@ -244,7 +269,7 @@ Closed - + + - - + + - @@ -960,8 +985,12 @@ let searchParams let params if (targetPage === '') { - pageId = 'home' - subPageId = floGlobals.adminID === myFloID ? 'admin' : 'dashboard' + if (typeof myFloID === "undefined") { + pageId = 'landing' + } else { + pageId = 'home' + subPageId = floGlobals.adminID === myFloID ? 'admin' : 'dashboard' + } } else { if (targetPage.includes('/')) { if (targetPage.includes('?')) { @@ -979,7 +1008,7 @@ pageId = targetPage } } - if (typeof myFloID === "undefined" && !(['sign_up', 'sign_in', 'loading'].includes(pageId))) return + if (typeof myFloID === "undefined" && !(['sign_up', 'sign_in', 'loading', 'landing'].includes(pageId))) return if (searchParams) { const urlSearchParams = new URLSearchParams('?' + searchParams); params = Object.fromEntries(urlSearchParams.entries()); @@ -1358,7 +1387,7 @@ card.setAttribute('href', `#/account?index=${index}`) card.querySelector('.activity-card__icon').innerHTML = icon card.querySelector('.activity-card__type').textContent = type - card.querySelector('.activity-card__time').textContent = getFormattedTime(parseInt(status === 'active' ? openTime : closeTime), true) + card.querySelector('.activity-card__interest').innerHTML = `Interest ${type === 'deposit' ? 'earned' : 'accrued'} ${utils.formatAmount(netAmt - amount)}` card.querySelector('.activity-card__amount').textContent = utils.formatAmount(netAmt) return card }, @@ -1385,7 +1414,7 @@ if (window.location.hash.includes('sign_in') || window.location.hash.includes('sign_up')) { showPage(window.location.hash) } else { - window.location.hash = '#/sign_in' + showPage('landing') } getRef('sign_in_button').onclick = () => { resolve(getRef('private_key_field').value.trim()) @@ -1766,9 +1795,10 @@ }) }) - getRef('get_deposit_amount').addEventListener('input', e => { + getRef('get_deposit_amount').addEventListener('input', handleDepositAmountInput) + function handleDepositAmountInput(e) { let message = '' - if (getRef(`deposit_button_wrapper`).children[0].tagName === 'SM-BUTTON') { + if (getRef(`deposit_button_wrapper`).children[0]?.tagName === 'SM-BUTTON') { message = `Deposit` } else { message = `Slide to deposit` @@ -1776,10 +1806,12 @@ if (e.target.value.trim() !== '') { getRef(`deposit_button_wrapper`).children[0].textContent = `${message} ${utils.formatAmount(parseFloat(e.target.value))}` } else { - getRef(`deposit_button_wrapper`).children[0].textContent = message + if (getRef(`deposit_button_wrapper`).firstElementChild) + getRef(`deposit_button_wrapper`).firstElementChild.textContent = message } - }) - getRef('get_loan_amount').addEventListener('input', e => { + } + getRef('get_loan_amount').addEventListener('input', handleDepositAmountInput) + function handleLoanAmountInput(e) { let message = '' if (e.target.value.trim() !== '') { if (getRef(`loan_button_wrapper`).children[0].tagName === 'SM-BUTTON') { @@ -1789,14 +1821,14 @@ } getRef(`loan_button_wrapper`).children[0].textContent = `${message} ${utils.formatAmount(parseFloat(e.target.value))}` } else { - if (getRef(`loan_button_wrapper`).children[0].tagName === 'SM-BUTTON') { + if (getRef(`loan_button_wrapper`).children[0]?.tagName === 'SM-BUTTON') { message = `Request loan` } else { message = `Slide to request loan` } getRef(`loan_button_wrapper`).children[0].textContent = message } - }) + } function showActionResult(details = {}) { const { type, amount, status, reason = '' } = details