104 lines
2.8 KiB
HTML
104 lines
2.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Waku Node Visualizer</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh;
|
|
margin: 0;
|
|
background-color: #f0f0f0;
|
|
}
|
|
#nodeGrid {
|
|
display: grid;
|
|
grid-template-columns: repeat(10, 1fr);
|
|
gap: 10px;
|
|
}
|
|
.node {
|
|
width: 30px;
|
|
height: 30px;
|
|
border-radius: 50%;
|
|
background-color: #ccc;
|
|
transition: background-color 0.3s ease;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="nodeGrid"></div>
|
|
<script src="/wails/ipc.js"></script>
|
|
<script>
|
|
const nodeGrid = document.getElementById('nodeGrid');
|
|
const nodes = {};
|
|
|
|
function createNode(peerId) {
|
|
const node = document.createElement('div');
|
|
node.className = 'node';
|
|
node.id = peerId;
|
|
nodeGrid.appendChild(node);
|
|
nodes[peerId] = node;
|
|
}
|
|
|
|
function updateNode(peerId, color) {
|
|
if (!nodes[peerId]) {
|
|
createNode(peerId);
|
|
}
|
|
nodes[peerId].style.backgroundColor = color;
|
|
setTimeout(() => {
|
|
nodes[peerId].style.backgroundColor = '#ccc';
|
|
}, 1000);
|
|
}
|
|
|
|
// Listen for events from the backend
|
|
window.runtime.EventsOn("nodeUpdate", (event) => {
|
|
updateNode(event.peerId, event.color);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Node Visualizer</title>
|
|
<style>
|
|
.node {
|
|
width: 20px;
|
|
height: 20px;
|
|
display: inline-block;
|
|
margin: 2px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="grid"></div>
|
|
<script>
|
|
const grid = document.getElementById('grid');
|
|
const nodes = {};
|
|
|
|
for (let i = 0; i < 50; i++) {
|
|
const node = document.createElement('div');
|
|
node.className = 'node';
|
|
node.id = 'node-' + i;
|
|
node.style.backgroundColor = '#ccc';
|
|
grid.appendChild(node);
|
|
nodes['node-' + i] = node;
|
|
}
|
|
|
|
if (window.runtime) {
|
|
window.runtime.EventsOn('nodeUpdate', (event) => {
|
|
const node = nodes['node-' + event.peerId];
|
|
if (node) {
|
|
node.style.backgroundColor = event.color;
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|