mirror of
https://github.com/logos-blockchain/logos-blockchain-block-explorer-template.git
synced 2026-02-17 19:43:08 +00:00
49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
import { h } from 'preact';
|
|
import { useState } from 'preact/hooks';
|
|
import BlocksTable from '../components/BlocksTable.js';
|
|
import TransactionsTable from '../components/TransactionsTable.js';
|
|
|
|
export default function HomeView() {
|
|
const [live, setLive] = useState(true);
|
|
|
|
const toggleLive = () => setLive((prev) => !prev);
|
|
|
|
const liveButtonStyle = live
|
|
? `
|
|
cursor: pointer;
|
|
background: #ff4444;
|
|
color: white;
|
|
border: none;
|
|
animation: live-pulse 1.5s ease-in-out infinite;
|
|
`
|
|
: `
|
|
cursor: pointer;
|
|
background: var(--bg-secondary, #333);
|
|
color: var(--muted, #888);
|
|
border: 1px solid var(--border, #444);
|
|
`;
|
|
|
|
return h(
|
|
'main',
|
|
{ class: 'wrap' },
|
|
h(
|
|
'div',
|
|
{ style: 'display:flex; justify-content:flex-end; margin-bottom:12px;' },
|
|
h(
|
|
'button',
|
|
{
|
|
class: 'pill',
|
|
style: liveButtonStyle,
|
|
onClick: toggleLive,
|
|
title: live ? 'Live updates enabled' : 'Click to enable live updates',
|
|
},
|
|
live ? 'LIVE \u2022' : 'LIVE',
|
|
),
|
|
),
|
|
h('section', { class: 'two-columns twocol' },
|
|
h(BlocksTable, { live }),
|
|
h(TransactionsTable, { live }),
|
|
),
|
|
);
|
|
}
|