51 lines
1.5 KiB
JavaScript
Raw Normal View History

2025-10-17 14:46:44 +02:00
import { h } from 'preact';
2026-02-16 23:58:06 +04:00
import { useState } from 'preact/hooks';
2025-10-17 14:46:44 +02:00
import BlocksTable from '../components/BlocksTable.js';
import TransactionsTable from '../components/TransactionsTable.js';
export default function HomeView() {
2026-02-16 23:58:06 +04:00
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);
`;
2025-10-17 14:46:44 +02:00
return h(
'main',
{ class: 'wrap' },
2026-02-16 23:58:06 +04:00
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',
),
),
2026-03-09 11:28:46 +00:00
h(
'section',
{ class: 'two-columns twocol' },
2026-02-17 00:14:34 +04:00
h(BlocksTable, { live, onDisableLive: () => setLive(false) }),
h(TransactionsTable, { live, onDisableLive: () => setLive(false) }),
2026-02-16 23:58:06 +04:00
),
2025-10-17 14:46:44 +02:00
);
}