diff options
| author | Monzero Build System <builds@monzero.org> | 2026-08-15 22:02:03 +0100 |
|---|---|---|
| committer | Monzero Build System <builds@monzero.org> | 2026-08-15 22:02:03 +0100 |
| commit | 30cce40b48e86bb92146378a1a8178d774d65a71 (patch) | |
| tree | ccf51422964f817a1a9e8efee1094903d5aef928 /website/app/app.js | |
| parent | 310832fe087427fc01af504821190c2482a438d7 (diff) | |
| download | monzero-core-30cce40b48e86bb92146378a1a8178d774d65a71.tar.gz monzero-core-30cce40b48e86bb92146378a1a8178d774d65a71.tar.xz monzero-core-30cce40b48e86bb92146378a1a8178d774d65a71.zip | |
Launch gated Monzero Studio beta
Diffstat (limited to 'website/app/app.js')
| -rw-r--r-- | website/app/app.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/website/app/app.js b/website/app/app.js new file mode 100644 index 000000000..ea1791839 --- /dev/null +++ b/website/app/app.js @@ -0,0 +1,26 @@ +const tabs = [...document.querySelectorAll('[role="tab"]')]; +const panels = [...document.querySelectorAll('[role="tabpanel"]')]; + +tabs.forEach((tab) => tab.addEventListener('click', () => { + tabs.forEach((item) => item.setAttribute('aria-selected', String(item === tab))); + panels.forEach((panel) => { + const active = panel.id === tab.dataset.panel; + panel.hidden = !active; + panel.classList.toggle('active', active); + }); +})); + +fetch('/api/node/get_info', { + method: 'POST', + headers: {'Content-Type': 'application/json'}, + body: '{}' +}).then((response) => { + if (!response.ok) throw new Error('node unavailable'); + return response.json(); +}).then((info) => { + document.querySelector('#node-state').textContent = info.status === 'OK' ? 'Online' : info.status; + document.querySelector('#height').textContent = Number(info.height).toLocaleString(); + document.querySelector('#peers').textContent = Number(info.incoming_connections_count || 0) + Number(info.outgoing_connections_count || 0); +}).catch(() => { + document.querySelector('#node-state').textContent = 'Unavailable'; +}); |
