Merge branch 'master' into master
This commit is contained in:
commit
15bcf7e7bd
20
css/main.css
20
css/main.css
@ -871,7 +871,6 @@ theme-toggle {
|
|||||||
.page > h3.heading {
|
.page > h3.heading {
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.balance-card {
|
.balance-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@ -879,8 +878,8 @@ theme-toggle {
|
|||||||
background-size: cover;
|
background-size: cover;
|
||||||
color: white;
|
color: white;
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
padding: 2rem 1.5rem;
|
padding: max(1.5rem, 3vw);
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 2rem;
|
||||||
}
|
}
|
||||||
.balance-card h2,
|
.balance-card h2,
|
||||||
.balance-card h3,
|
.balance-card h3,
|
||||||
@ -953,6 +952,21 @@ theme-toggle {
|
|||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#token_balance_list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.token-balance {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 1rem;
|
||||||
|
background-color: rgba(0, 0, 0, 0.2);
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
.transaction {
|
.transaction {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
|
|||||||
2
css/main.min.css
vendored
2
css/main.min.css
vendored
File diff suppressed because one or more lines are too long
@ -800,8 +800,8 @@ theme-toggle {
|
|||||||
background-size: cover;
|
background-size: cover;
|
||||||
color: white;
|
color: white;
|
||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
padding: 2rem 1.5rem;
|
padding: max(1.5rem, 3vw);
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 2rem;
|
||||||
h2,
|
h2,
|
||||||
h3,
|
h3,
|
||||||
h4,
|
h4,
|
||||||
@ -866,6 +866,19 @@ theme-toggle {
|
|||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#token_balance_list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
.token-balance {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 1rem;
|
||||||
|
background-color: rgba(0, 0, 0, 0.2);
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
.transaction {
|
.transaction {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
|
|||||||
38
index.html
38
index.html
@ -345,15 +345,10 @@
|
|||||||
try {
|
try {
|
||||||
const [floAddress] = state.wildcards
|
const [floAddress] = state.wildcards
|
||||||
if (!floAddress) return;
|
if (!floAddress) return;
|
||||||
let [addressInfo, addressBalance, addressTxs] = await Promise.all([getAddressInfo(floAddress), getAddressBalance(floAddress), getAddressTxs(floAddress)])
|
let [ownedTokens, floBalance, addressTxs] = await Promise.all([getAddressInfo(floAddress), getAddressBalance(floAddress), getAddressTxs(floAddress)])
|
||||||
renderElem(getRef("page_container"), html`${render.addressPage({ balance: addressBalance, address: floAddress })}`);
|
renderElem(getRef("page_container"), html`${render.addressPage({ floBalance, floAddress, ownedTokens })}`);
|
||||||
getRef("page_title").textContent = 'Address'
|
getRef("page_title").textContent = 'Address'
|
||||||
renderTransactions('address_transaction_container', addressTxs)
|
renderTransactions('address_transaction_container', addressTxs)
|
||||||
const tokenHolders = []
|
|
||||||
for (const token in addressInfo) {
|
|
||||||
tokenHolders.push(render.tokenBalanceCard(token, addressInfo[token].balance))
|
|
||||||
}
|
|
||||||
renderElem(document.getElementById('token_balance_container'), html`${tokenHolders.length ? tokenHolders : html`<div>No tokens found</div>`}`)
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
renderElem(getRef("page_container"), html`${render.errorPage(e)}`);
|
renderElem(getRef("page_container"), html`${render.errorPage(e)}`);
|
||||||
@ -702,28 +697,31 @@
|
|||||||
`;
|
`;
|
||||||
},
|
},
|
||||||
addressPage(obj) {
|
addressPage(obj) {
|
||||||
let { balance, address } = obj;
|
const { floBalance, floAddress, ownedTokens = {} } = obj;
|
||||||
|
console.log(obj)
|
||||||
return html`
|
return html`
|
||||||
<div id="address_page" class="page">
|
<div id="address_page" class="page">
|
||||||
<div class="balance-card">
|
<div class="balance-card">
|
||||||
<h2 class="wrap-around margin-bottom-2">${address}</h2>
|
<h2 class="wrap-around margin-bottom-2">${floAddress}</h2>
|
||||||
<h5 class="label">Balance</h5>
|
<h5 class="label">FLO Balance</h5>
|
||||||
<h3>${balance} FLO</h3>
|
<h3 class="margin-bottom-2">${floBalance} FLO</h3>
|
||||||
</div>
|
<div class="grid gap-0-5">
|
||||||
<sm-chips data-target="address_views" onchange="changeView(event)">
|
<h5>Tokens</h5>
|
||||||
<sm-chip value="0" selected>Transactions</sm-chip>
|
<ul id="token_balance_list">
|
||||||
<sm-chip value="1">Tokens</sm-chip>
|
${Object.keys(ownedTokens)
|
||||||
</sm-chips>
|
.filter(token => ownedTokens[token].balance > 0)
|
||||||
<div id="address_views" class="view-wrapper">
|
.map(token => render.tokenBalanceCard(token, ownedTokens[token].balance))}
|
||||||
<ul id="address_transaction_container" class="transaction-container"></ul>
|
</ul>
|
||||||
<ul id="token_balance_container" class="hidden"></ul>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<h4>Transactions</h4>
|
||||||
|
<ul id="address_transaction_container" class="transaction-container"></ul>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
},
|
},
|
||||||
tokenBalanceCard(token, balance) {
|
tokenBalanceCard(token, balance) {
|
||||||
return html`
|
return html`
|
||||||
<li class="card">
|
<li class="token-balance">
|
||||||
<a href=${`#/token/${token}`} class="label token">${token}</a>
|
<a href=${`#/token/${token}`} class="label token">${token}</a>
|
||||||
<h4>${formatAmount(balance, token.toLowerCase() === 'rupee' ? 'inr' : 'usd')}</h4>
|
<h4>${formatAmount(balance, token.toLowerCase() === 'rupee' ? 'inr' : 'usd')}</h4>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user