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 {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.balance-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -879,8 +878,8 @@ theme-toggle {
|
||||
background-size: cover;
|
||||
color: white;
|
||||
border-radius: 0.5rem;
|
||||
padding: 2rem 1.5rem;
|
||||
margin-bottom: 1rem;
|
||||
padding: max(1.5rem, 3vw);
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
.balance-card h2,
|
||||
.balance-card h3,
|
||||
@ -953,6 +952,21 @@ theme-toggle {
|
||||
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 {
|
||||
display: grid;
|
||||
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;
|
||||
color: white;
|
||||
border-radius: 0.5rem;
|
||||
padding: 2rem 1.5rem;
|
||||
margin-bottom: 1rem;
|
||||
padding: max(1.5rem, 3vw);
|
||||
margin-bottom: 2rem;
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
@ -866,6 +866,19 @@ theme-toggle {
|
||||
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 {
|
||||
display: grid;
|
||||
gap: 1.5rem;
|
||||
|
||||
38
index.html
38
index.html
@ -345,15 +345,10 @@
|
||||
try {
|
||||
const [floAddress] = state.wildcards
|
||||
if (!floAddress) return;
|
||||
let [addressInfo, addressBalance, addressTxs] = await Promise.all([getAddressInfo(floAddress), getAddressBalance(floAddress), getAddressTxs(floAddress)])
|
||||
renderElem(getRef("page_container"), html`${render.addressPage({ balance: addressBalance, address: floAddress })}`);
|
||||
let [ownedTokens, floBalance, addressTxs] = await Promise.all([getAddressInfo(floAddress), getAddressBalance(floAddress), getAddressTxs(floAddress)])
|
||||
renderElem(getRef("page_container"), html`${render.addressPage({ floBalance, floAddress, ownedTokens })}`);
|
||||
getRef("page_title").textContent = 'Address'
|
||||
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) {
|
||||
console.error(e)
|
||||
renderElem(getRef("page_container"), html`${render.errorPage(e)}`);
|
||||
@ -702,28 +697,31 @@
|
||||
`;
|
||||
},
|
||||
addressPage(obj) {
|
||||
let { balance, address } = obj;
|
||||
const { floBalance, floAddress, ownedTokens = {} } = obj;
|
||||
console.log(obj)
|
||||
return html`
|
||||
<div id="address_page" class="page">
|
||||
<div class="balance-card">
|
||||
<h2 class="wrap-around margin-bottom-2">${address}</h2>
|
||||
<h5 class="label">Balance</h5>
|
||||
<h3>${balance} FLO</h3>
|
||||
</div>
|
||||
<sm-chips data-target="address_views" onchange="changeView(event)">
|
||||
<sm-chip value="0" selected>Transactions</sm-chip>
|
||||
<sm-chip value="1">Tokens</sm-chip>
|
||||
</sm-chips>
|
||||
<div id="address_views" class="view-wrapper">
|
||||
<ul id="address_transaction_container" class="transaction-container"></ul>
|
||||
<ul id="token_balance_container" class="hidden"></ul>
|
||||
<h2 class="wrap-around margin-bottom-2">${floAddress}</h2>
|
||||
<h5 class="label">FLO Balance</h5>
|
||||
<h3 class="margin-bottom-2">${floBalance} FLO</h3>
|
||||
<div class="grid gap-0-5">
|
||||
<h5>Tokens</h5>
|
||||
<ul id="token_balance_list">
|
||||
${Object.keys(ownedTokens)
|
||||
.filter(token => ownedTokens[token].balance > 0)
|
||||
.map(token => render.tokenBalanceCard(token, ownedTokens[token].balance))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<h4>Transactions</h4>
|
||||
<ul id="address_transaction_container" class="transaction-container"></ul>
|
||||
</div>
|
||||
`;
|
||||
},
|
||||
tokenBalanceCard(token, balance) {
|
||||
return html`
|
||||
<li class="card">
|
||||
<li class="token-balance">
|
||||
<a href=${`#/token/${token}`} class="label token">${token}</a>
|
||||
<h4>${formatAmount(balance, token.toLowerCase() === 'rupee' ? 'inr' : 'usd')}</h4>
|
||||
</li>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user