Added latest block to top

This commit is contained in:
sairaj mote 2023-04-28 00:25:53 +05:30
parent acbbd86bf1
commit b303b12c9b
4 changed files with 10 additions and 5 deletions

View File

@ -746,7 +746,7 @@ header.grid-2 {
#highlights {
padding: 1.5rem 0;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
gap: 1.5rem;
}
#highlights .highlight-item {

2
css/main.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -676,7 +676,7 @@ header.grid-2 {
#highlights {
padding: 1.5rem 0;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
gap: 1.5rem;
.highlight-item {
opacity: 0;

View File

@ -332,7 +332,7 @@
async function renderHome(state) {
getRef("page_header").classList.add("hidden");
let [data, latestTxs, latestBlocks] = await Promise.all([getBannerData(), getLatestTxs(), getAllBlocks(6)])
renderElem(getRef("page_container"), html`${render.homepage(data)}`);
renderElem(getRef("page_container"), html`${render.homepage({ ...data, latestBlock: latestBlocks[0] })}`);
renderTransactions('top_transaction_container', latestTxs)
const renderedBlocks = latestBlocks.map(block => render.blockCard(block))
renderElem(document.getElementById('top_blocks_container'), html`${renderedBlocks}`)
@ -636,7 +636,8 @@
let frag = document.createDocumentFragment();
const render = {
homepage(obj) {
let { topToken, totalTransactions, walletAddresses } = obj;
let { topToken, totalTransactions, walletAddresses, latestBlock } = obj;
const { height, time } = latestBlock
return html`
<div id="homepage" class="page">
<section id="first_section">
@ -653,6 +654,10 @@
<h4 class="label">Wallet addresses</h4>
<h2>${walletAddresses}</h2>
</div>
<div class="highlight-item">
<h4 class="label">Latest block (${getFormattedTime(time, 'relative')})</h4>
<h2><a class="block-height" href=${`#/block/${height}`}>${height}</a></h2>
</div>
</div>
</section>
<section id="latest_transaction_section" class="margin-bottom-2">