Feature and UI upadate

-- added option to directly deposit rupee to RanchiMall exchange
-- moved saved FLO IDs from home page to new separate contacts page
-- Layout changes
This commit is contained in:
sairaj mote 2022-05-14 00:51:07 +05:30
parent 79a387fb7c
commit e0d955e1c1
8 changed files with 1670 additions and 215 deletions

View File

@ -375,7 +375,7 @@ ul {
justify-self: end;
}
.direction-column {
.flex-direction-column {
flex-direction: column;
}
@ -722,18 +722,16 @@ ul {
#home {
display: flex;
flex-direction: column;
padding: 0;
position: relative;
}
#home .scrolling-wrapper > * {
margin: 0 1.5rem;
#home > * {
margin-bottom: 2rem;
}
#user,
#cashier {
position: relative;
padding-bottom: 4rem;
padding-bottom: 1rem;
align-content: flex-start;
}
@ -790,27 +788,43 @@ ul {
font-size: 1rem;
}
#wallet_actions_wrapper {
.actions-wrapper {
display: grid;
gap: 0.5rem;
grid-template-columns: repeat(auto-fill, minmax(4rem, 1fr));
}
.wallet-action .icon:first-of-type,
.integrated-action-button .icon:first-of-type {
height: 2.5rem;
width: 2.5rem;
padding: 0.6rem;
fill: rgba(var(--foreground-color), 1);
background-color: var(--accent-color);
border-radius: 2rem;
}
.wallet-action {
flex-direction: column;
text-align: center;
align-items: center;
font-weight: 500;
font-size: 0.8rem;
white-space: initial;
}
.wallet-action .icon {
height: 2.5rem;
width: 2.5rem;
padding: 0.6rem;
margin-bottom: 0.8rem;
fill: rgba(var(--foreground-color), 1);
background-color: var(--accent-color);
border-radius: 2rem;
}
.integrated-action-button {
padding: 0.8rem 0;
justify-content: initial;
}
.integrated-action-button .icon:first-of-type {
margin-right: 1rem;
}
.integrated-action-button .icon:last-of-type {
margin-left: 0.5rem;
}
.cashier-status {
@ -848,10 +862,18 @@ ul {
fill: rgba(0, 0, 0, 0.8);
}
#contacts {
position: relative;
padding: 0;
}
#contacts .scrolling-wrapper {
padding: 0 1.5rem;
}
#saved_ids_list {
display: grid;
grid-template-columns: minmax(0, 1fr);
margin-top: 1rem;
padding-bottom: 5rem;
}
.saved-id {
@ -1367,6 +1389,10 @@ ul {
left: 0;
right: 0;
}
.integrated-action-button .icon:last-of-type {
margin-left: auto;
}
}
@media screen and (min-width: 40rem) {
sm-popup {

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -342,7 +342,7 @@ ul {
justify-self: end;
}
.direction-column {
.flex-direction-column {
flex-direction: column;
}
@ -677,19 +677,15 @@ ul {
#home {
display: flex;
flex-direction: column;
padding: 0;
position: relative;
.scrolling-wrapper {
& > * {
margin: 0 1.5rem;
margin-bottom: 2rem;
}
& > * {
margin-bottom: 2rem;
}
}
#user,
#cashier {
position: relative;
padding-bottom: 4rem;
padding-bottom: 1rem;
align-content: flex-start;
}
#wallet_cards_wrapper {
@ -742,25 +738,41 @@ ul {
font-size: 1rem;
}
}
#wallet_actions_wrapper {
.actions-wrapper {
display: grid;
gap: 0.5rem;
grid-template-columns: repeat(auto-fill, minmax(4rem, 1fr));
}
.wallet-action,
.integrated-action-button {
.icon:first-of-type {
height: 2.5rem;
width: 2.5rem;
padding: 0.6rem;
fill: rgba(var(--foreground-color), 1);
background-color: var(--accent-color);
border-radius: 2rem;
}
}
.wallet-action {
flex-direction: column;
text-align: center;
align-items: center;
font-weight: 500;
font-size: 0.8rem;
white-space: initial;
.icon {
height: 2.5rem;
width: 2.5rem;
padding: 0.6rem;
margin-bottom: 0.8rem;
fill: rgba(var(--foreground-color), 1);
background-color: var(--accent-color);
border-radius: 2rem;
}
}
.integrated-action-button {
padding: 0.8rem 0;
justify-content: initial;
.icon:first-of-type {
margin-right: 1rem;
}
.icon:last-of-type {
margin-left: 0.5rem;
}
}
.cashier-status {
@ -796,10 +808,17 @@ ul {
}
}
#contacts {
position: relative;
padding: 0;
.scrolling-wrapper {
padding: 0 1.5rem;
}
}
#saved_ids_list {
display: grid;
grid-template-columns: minmax(0, 1fr);
margin-top: 1rem;
padding-bottom: 5rem;
}
.saved-id {
grid-template-columns: auto 1fr;
@ -1286,6 +1305,11 @@ ul {
right: 0;
}
}
.integrated-action-button {
.icon:last-of-type {
margin-left: auto;
}
}
}
@media screen and (min-width: 40rem) {
sm-popup {

File diff suppressed because one or more lines are too long

1255
scripts/floExchangeAPI.js Normal file

File diff suppressed because it is too large Load Diff

53
scripts/floTokenAPI.js Normal file
View File

@ -0,0 +1,53 @@
'use strict';
/* Token Operator to send/receive tokens from blockchain using API calls*/
(function(GLOBAL) {
const floTokenAPI = GLOBAL.floTokenAPI = {
fetch_api: function(apicall) {
return new Promise((resolve, reject) => {
console.log(floGlobals.tokenURL + apicall);
fetch(floGlobals.tokenURL + apicall).then(response => {
if (response.ok)
response.json().then(data => resolve(data));
else
reject(response)
}).catch(error => reject(error))
})
},
getBalance: function(floID, token = floGlobals.currency) {
return new Promise((resolve, reject) => {
this.fetch_api(`api/v1.0/getFloAddressBalance?token=${token}&floAddress=${floID}`)
.then(result => resolve(result.balance || 0))
.catch(error => reject(error))
})
},
getTx: function(txID) {
return new Promise((resolve, reject) => {
this.fetch_api(`api/v1.0/getTransactionDetails/${txID}`).then(res => {
if (res.result === "error")
reject(res.description);
else if (!res.parsedFloData)
reject("Data piece (parsedFloData) missing");
else if (!res.transactionDetails)
reject("Data piece (transactionDetails) missing");
else
resolve(res);
}).catch(error => reject(error))
})
},
sendToken: function(privKey, amount, receiverID, message = "", token = floGlobals.currency) {
return new Promise((resolve, reject) => {
let senderID = floCrypto.getFloID(privKey);
if (typeof amount !== "number" || amount <= 0)
return reject("Invalid amount");
this.getBalance(senderID, token).then(bal => {
if (amount > bal)
return reject(`Insufficient ${token}# balance`);
floBlockchainAPI.writeData(senderID, `send ${amount} ${token}# ${message}`, privKey, receiverID)
.then(txid => resolve(txid))
.catch(error => reject(error))
}).catch(error => reject(error))
});
}
}
})(typeof global !== "undefined" ? global : window);

View File

@ -99,6 +99,27 @@ function withdrawMoneyFromWallet() {
})
}
function transferToExchange() {
const amount = parseFloat(getRef('exchange_transfer__amount').value.trim());
buttonLoader('exchange_transfer__button', true);
floExchangeAPI.depositToken('rupee', amount, myFloID, 'FRJkPqdbbsug3TtQRAWviqvTL9Qr2EMnrm', myPrivKey).then(txid => {
console.log(txid);
showProcessStage('exchange_transfer_process', 1);
getRef('exchange_transfer__success_message').textContent = `Transferred ${formatAmount(amount)} to exchange`;
}).catch(error => {
console.log(error);
if (error.code) {
error = error.message;
}
if (error === 'Insufficient rupee# balance')
error = 'Insufficient rupee token balance in your wallet, please top-up your wallet.';
getRef('exchange_transfer__failed_reason').textContent = error;
showProcessStage('exchange_transfer_process', 2);
}).finally(() => {
buttonLoader('exchange_transfer__button', false);
});
}
async function renderSavedUpiIds() {
const frag = document.createDocumentFragment();
for (const upiId in floGlobals.savedUserData.upiIds) {

View File

@ -132,6 +132,9 @@ document.addEventListener('popupclosed', e => {
getRef('select_upi_id').parentNode.classList.add('hide')
getRef('select_upi_id').innerHTML = ''
break;
case 'transfer_to_exchange_popup':
showProcessStage('exchange_transfer_process', 0);
break;
}
})