added warning for low FLO balance to user

This commit is contained in:
sairaj mote 2022-05-27 00:14:39 +05:30
parent c4686f6446
commit b8647ffa03
6 changed files with 24 additions and 2 deletions

View File

@ -72,6 +72,14 @@ strong:not(:last-of-type) {
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
} }
.warning {
line-height: normal;
padding: 1rem;
background-color: khaki;
border-radius: 1rem;
color: rgba(0, 0, 0, 0.8);
}
a { a {
text-decoration: none; text-decoration: none;
color: var(--accent-color); color: var(--accent-color);

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -68,6 +68,13 @@ strong {
margin-bottom: 1.5rem; margin-bottom: 1.5rem;
} }
} }
.warning {
line-height: normal;
padding: 1rem;
background-color: khaki;
border-radius: 1rem;
color: rgba(0, 0, 0, 0.8);
}
a { a {
text-decoration: none; text-decoration: none;
color: var(--accent-color); color: var(--accent-color);

View File

@ -813,6 +813,7 @@
</g> </g>
</svg> </svg>
</sm-input> </sm-input>
<strong id="low_user_flo_warning" class="warning"></strong>
<button class="button button--primary cta" onclick="continueWalletTopup()" <button class="button button--primary cta" onclick="continueWalletTopup()"
type="submit">Continue</button> type="submit">Continue</button>
</sm-form> </sm-form>

View File

@ -647,7 +647,7 @@ customElements.define('sm-input',
} }
else if (name === 'type') { else if (name === 'type') {
if (this.hasAttribute('type') && this.getAttribute('type') === 'number') { if (this.hasAttribute('type') && this.getAttribute('type') === 'number') {
this.input.setAttribute('inputmode', 'numeric'); this.input.setAttribute('inputmode', 'decimal');
} }
} }
else if (name === 'helper-text') { else if (name === 'helper-text') {

View File

@ -680,6 +680,12 @@ function refreshBalance(button) {
floBlockchainAPI.getBalance(myFloID).then(balance => { floBlockchainAPI.getBalance(myFloID).then(balance => {
const [beforeDecimal, afterDecimal = '00'] = String(balance).split('.') const [beforeDecimal, afterDecimal = '00'] = String(balance).split('.')
getRef('flo_balance').innerHTML = `<span><b>${beforeDecimal}</b></span>.<span>${afterDecimal}</span>` getRef('flo_balance').innerHTML = `<span><b>${beforeDecimal}</b></span>.<span>${afterDecimal}</span>`
if (balance < floGlobals.settings.user_flo_threshold) {
getRef('low_user_flo_warning').textContent = `Your FLO balance is low. You will receive ${floGlobals.settings.send_user_flo} FLO by deducting equivalent rupee tokens.`;
getRef('low_user_flo_warning').classList.remove('hide');
} else {
getRef('low_user_flo_warning').classList.add('hide');
}
if (button) if (button)
buttonLoader(button, false) buttonLoader(button, false)
}) })