Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
211 lines (183 loc) · 6.69 KB
/
Copy pathindex.html
File metadata and controls
211 lines (183 loc) · 6.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tendermint 56-Node Monitor</title>
<style>
:root {
--bg-color: #0f172a;
--card-bg: rgba(30, 41, 59, 0.7);
--border-color: rgba(255, 255, 255, 0.1);
--step-propose: #3b82f6; /* Blue */
--step-prevote: #eab308; /* Yellow */
--step-precommit: #f97316; /* Orange */
--step-commit: #22c55e; /* Green */
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Inter', 'Segoe UI', sans-serif;
}
body {
background-color: var(--bg-color);
color: #f8fafc;
min-height: 100vh;
padding: 2rem;
background-image:
radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
}
header {
text-align: center;
margin-bottom: 3rem;
}
h1 {
font-size: 2.5rem;
font-weight: 800;
background: linear-gradient(to right, #60a5fa, #34d399);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin-bottom: 0.5rem;
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
gap: 1.25rem;
max-width: 1400px;
margin: 0 auto;
}
.node-card {
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 12px;
padding: 1rem;
backdrop-filter: blur(10px);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
position: relative;
overflow: hidden;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.node-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 4px;
background: #475569;
transition: background 0.3s ease;
}
/* Step Colors */
.node-card[data-step="Propose"]::before { background: var(--step-propose); box-shadow: 0 0 10px var(--step-propose); }
.node-card[data-step="Prevote"]::before { background: var(--step-prevote); box-shadow: 0 0 10px var(--step-prevote); }
.node-card[data-step="Precommit"]::before { background: var(--step-precommit); box-shadow: 0 0 10px var(--step-precommit); }
.node-card.committed {
animation: pulse-green 0.5s ease-out;
border-color: var(--step-commit);
}
@keyframes pulse-green {
0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
50% { transform: scale(1.05); box-shadow: 0 0 20px 5px rgba(34, 197, 94, 0.4); }
100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.node-id {
font-size: 1.5rem;
font-weight: 700;
margin-bottom: 0.5rem;
color: #e2e8f0;
}
.node-stats {
display: flex;
gap: 1rem;
font-size: 0.875rem;
color: #94a3b8;
margin-bottom: 0.5rem;
}
.node-step {
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.05em;
font-weight: 600;
padding: 0.25rem 0.5rem;
border-radius: 9999px;
background: rgba(255,255,255,0.05);
}
.node-card[data-step="Propose"] .node-step { color: var(--step-propose); }
.node-card[data-step="Prevote"] .node-step { color: var(--step-prevote); }
.node-card[data-step="Precommit"] .node-step { color: var(--step-precommit); }
</style>
</head>
<body>
<header>
<h1>Tendermint Consensus (56 Nodes)</h1>
</header>
<div class="grid" id="node-grid">
<!-- Cards generated by JS -->
</div>
<script>
const NUM_NODES = 56;
const grid = document.getElementById('node-grid');
const cards = {};
// Initialize 50 cards
for (let i = 0; i < NUM_NODES; i++) {
const card = document.createElement('div');
card.className = 'node-card';
card.id = `node-${i}`;
card.innerHTML = `
<div class="node-id">N-${i}</div>
<div class="node-stats">
<span>H: <b id="height-${i}">-</b></span>
<span>R: <b id="round-${i}">-</b></span>
</div>
<div class="node-step" id="step-${i}">OFFLINE</div>
`;
grid.appendChild(card);
cards[i] = {
cardEl: card,
heightEl: document.getElementById(`height-${i}`),
roundEl: document.getElementById(`round-${i}`),
stepEl: document.getElementById(`step-${i}`),
lastHeight: 0
};
}
function connect() {
const ws = new WebSocket('ws://localhost:8081');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'init') {
for (const [id, state] of Object.entries(data.state)) {
updateNode(state);
}
} else {
updateNode(data);
}
};
ws.onclose = () => {
setTimeout(connect, 1000); // Reconnect
};
}
function updateNode(state) {
const node = cards[state.id];
if (!node) return;
node.heightEl.textContent = state.height;
node.roundEl.textContent = state.round;
node.stepEl.textContent = state.step;
node.cardEl.setAttribute('data-step', state.step);
// Trigger commit animation if height increases
if (state.height > node.lastHeight && node.lastHeight !== 0) {
node.cardEl.classList.remove('committed');
void node.cardEl.offsetWidth; // trigger reflow
node.cardEl.classList.add('committed');
}
node.lastHeight = state.height;
}
connect();
</script>
</body>
</html>