@aaronbassett/midnight-local-devnet 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -26
- package/dist/cli/commands/dashboard.js +55 -14
- package/dist/cli/commands/dashboard.js.map +1 -1
- package/dist/cli/dashboard/html.d.ts +3 -0
- package/dist/cli/dashboard/html.js +1880 -0
- package/dist/cli/dashboard/html.js.map +1 -0
- package/dist/cli/dashboard/server.d.ts +17 -0
- package/dist/cli/dashboard/server.js +230 -0
- package/dist/cli/dashboard/server.js.map +1 -0
- package/dist/cli/dashboard/state-collector.d.ts +90 -0
- package/dist/cli/dashboard/state-collector.js +171 -0
- package/dist/cli/dashboard/state-collector.js.map +1 -0
- package/dist/core/wallet.d.ts +2 -0
- package/dist/core/wallet.js +28 -0
- package/dist/core/wallet.js.map +1 -1
- package/package.json +4 -5
- package/dist/cli/dashboard/app.d.ts +0 -9
- package/dist/cli/dashboard/app.js +0 -106
- package/dist/cli/dashboard/app.js.map +0 -1
- package/dist/cli/dashboard/components/gauge.d.ts +0 -9
- package/dist/cli/dashboard/components/gauge.js +0 -10
- package/dist/cli/dashboard/components/gauge.js.map +0 -1
- package/dist/cli/dashboard/components/panel-box.d.ts +0 -10
- package/dist/cli/dashboard/components/panel-box.js +0 -6
- package/dist/cli/dashboard/components/panel-box.js.map +0 -1
- package/dist/cli/dashboard/components/sparkline.d.ts +0 -9
- package/dist/cli/dashboard/components/sparkline.js +0 -25
- package/dist/cli/dashboard/components/sparkline.js.map +0 -1
- package/dist/cli/dashboard/components/status-badge.d.ts +0 -6
- package/dist/cli/dashboard/components/status-badge.js +0 -24
- package/dist/cli/dashboard/components/status-badge.js.map +0 -1
- package/dist/cli/dashboard/hooks/use-breakpoint.d.ts +0 -7
- package/dist/cli/dashboard/hooks/use-breakpoint.js +0 -15
- package/dist/cli/dashboard/hooks/use-breakpoint.js.map +0 -1
- package/dist/cli/dashboard/hooks/use-health.d.ts +0 -9
- package/dist/cli/dashboard/hooks/use-health.js +0 -35
- package/dist/cli/dashboard/hooks/use-health.js.map +0 -1
- package/dist/cli/dashboard/hooks/use-indexer-info.d.ts +0 -5
- package/dist/cli/dashboard/hooks/use-indexer-info.js +0 -19
- package/dist/cli/dashboard/hooks/use-indexer-info.js.map +0 -1
- package/dist/cli/dashboard/hooks/use-logs.d.ts +0 -19
- package/dist/cli/dashboard/hooks/use-logs.js +0 -55
- package/dist/cli/dashboard/hooks/use-logs.js.map +0 -1
- package/dist/cli/dashboard/hooks/use-node-info.d.ts +0 -21
- package/dist/cli/dashboard/hooks/use-node-info.js +0 -49
- package/dist/cli/dashboard/hooks/use-node-info.js.map +0 -1
- package/dist/cli/dashboard/hooks/use-polling.d.ts +0 -7
- package/dist/cli/dashboard/hooks/use-polling.js +0 -35
- package/dist/cli/dashboard/hooks/use-polling.js.map +0 -1
- package/dist/cli/dashboard/hooks/use-proof-server.d.ts +0 -7
- package/dist/cli/dashboard/hooks/use-proof-server.js +0 -14
- package/dist/cli/dashboard/hooks/use-proof-server.js.map +0 -1
- package/dist/cli/dashboard/hooks/use-services.d.ts +0 -3
- package/dist/cli/dashboard/hooks/use-services.js +0 -6
- package/dist/cli/dashboard/hooks/use-services.js.map +0 -1
- package/dist/cli/dashboard/hooks/use-terminal-size.d.ts +0 -5
- package/dist/cli/dashboard/hooks/use-terminal-size.js +0 -22
- package/dist/cli/dashboard/hooks/use-terminal-size.js.map +0 -1
- package/dist/cli/dashboard/hooks/use-wallet-state.d.ts +0 -10
- package/dist/cli/dashboard/hooks/use-wallet-state.js +0 -63
- package/dist/cli/dashboard/hooks/use-wallet-state.js.map +0 -1
- package/dist/cli/dashboard/layouts/large.d.ts +0 -7
- package/dist/cli/dashboard/layouts/large.js +0 -13
- package/dist/cli/dashboard/layouts/large.js.map +0 -1
- package/dist/cli/dashboard/layouts/medium.d.ts +0 -7
- package/dist/cli/dashboard/layouts/medium.js +0 -11
- package/dist/cli/dashboard/layouts/medium.js.map +0 -1
- package/dist/cli/dashboard/layouts/small.d.ts +0 -7
- package/dist/cli/dashboard/layouts/small.js +0 -11
- package/dist/cli/dashboard/layouts/small.js.map +0 -1
- package/dist/cli/dashboard/panels/indexer-panel.d.ts +0 -11
- package/dist/cli/dashboard/panels/indexer-panel.js +0 -17
- package/dist/cli/dashboard/panels/indexer-panel.js.map +0 -1
- package/dist/cli/dashboard/panels/log-panel.d.ts +0 -13
- package/dist/cli/dashboard/panels/log-panel.js +0 -27
- package/dist/cli/dashboard/panels/log-panel.js.map +0 -1
- package/dist/cli/dashboard/panels/node-panel.d.ts +0 -10
- package/dist/cli/dashboard/panels/node-panel.js +0 -17
- package/dist/cli/dashboard/panels/node-panel.js.map +0 -1
- package/dist/cli/dashboard/panels/proof-panel.d.ts +0 -10
- package/dist/cli/dashboard/panels/proof-panel.js +0 -20
- package/dist/cli/dashboard/panels/proof-panel.js.map +0 -1
- package/dist/cli/dashboard/panels/response-graph.d.ts +0 -10
- package/dist/cli/dashboard/panels/response-graph.js +0 -12
- package/dist/cli/dashboard/panels/response-graph.js.map +0 -1
- package/dist/cli/dashboard/panels/wallet-panel.d.ts +0 -9
- package/dist/cli/dashboard/panels/wallet-panel.js +0 -24
- package/dist/cli/dashboard/panels/wallet-panel.js.map +0 -1
- package/dist/cli/dashboard/types.d.ts +0 -39
- package/dist/cli/dashboard/types.js +0 -2
- package/dist/cli/dashboard/types.js.map +0 -1
|
@@ -0,0 +1,1880 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a complete single-page HTML dashboard for the Midnight local devnet.
|
|
3
|
+
* Uses Preact + HTM via CDN import maps. All CSS and JS are inline.
|
|
4
|
+
*/
|
|
5
|
+
function safeJsonInScript(value) {
|
|
6
|
+
return JSON.stringify(value)
|
|
7
|
+
.replace(/</g, '\\u003c')
|
|
8
|
+
.replace(/>/g, '\\u003e');
|
|
9
|
+
}
|
|
10
|
+
export function generateDashboardHtml({ wsUrl }) {
|
|
11
|
+
return `<!DOCTYPE html>
|
|
12
|
+
<html lang="en">
|
|
13
|
+
<head>
|
|
14
|
+
<meta charset="utf-8" />
|
|
15
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
16
|
+
<title>Midnight Devnet Dashboard</title>
|
|
17
|
+
|
|
18
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
19
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
20
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet" />
|
|
21
|
+
|
|
22
|
+
<script type="importmap">
|
|
23
|
+
{
|
|
24
|
+
"imports": {
|
|
25
|
+
"preact": "https://esm.sh/preact@10.25.4",
|
|
26
|
+
"preact/hooks": "https://esm.sh/preact@10.25.4/hooks",
|
|
27
|
+
"htm/preact": "https://esm.sh/htm@3.1.1/preact?external=preact"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<style>
|
|
33
|
+
:root {
|
|
34
|
+
--mn-void: #09090f;
|
|
35
|
+
--mn-surface: #0f0f1e;
|
|
36
|
+
--mn-surface-alt: #14142b;
|
|
37
|
+
--mn-border: #1c1c3a;
|
|
38
|
+
--mn-border-bright: #2a2a50;
|
|
39
|
+
--mn-accent: #3b3bff;
|
|
40
|
+
--mn-accent-hover: #5252ff;
|
|
41
|
+
--mn-accent-muted: #2a2aaa;
|
|
42
|
+
--mn-accent-glow: rgba(59, 59, 255, 0.25);
|
|
43
|
+
--mn-text: #f0f0ff;
|
|
44
|
+
--mn-text-secondary: #8080aa;
|
|
45
|
+
--mn-text-muted: #505070;
|
|
46
|
+
--mn-success: #22c55e;
|
|
47
|
+
--mn-warning: #eab308;
|
|
48
|
+
--mn-error: #ef4444;
|
|
49
|
+
--mn-gradient-hero: linear-gradient(135deg, #1a1a4a 0%, #09090f 50%, #0f1a2f 100%);
|
|
50
|
+
--mn-gradient-accent: linear-gradient(135deg, #3b3bff 0%, #6b3bff 100%);
|
|
51
|
+
--mn-gradient-card: linear-gradient(180deg, rgba(59, 59, 255, 0.08) 0%, transparent 60%);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
*, *::before, *::after {
|
|
55
|
+
margin: 0;
|
|
56
|
+
padding: 0;
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
body {
|
|
61
|
+
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
|
62
|
+
background-color: var(--mn-void);
|
|
63
|
+
background-image: radial-gradient(circle, rgba(59, 59, 255, 0.02) 1px, transparent 1px);
|
|
64
|
+
background-size: 24px 24px;
|
|
65
|
+
color: var(--mn-text);
|
|
66
|
+
min-height: 100vh;
|
|
67
|
+
line-height: 1.5;
|
|
68
|
+
-webkit-font-smoothing: antialiased;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.mono {
|
|
72
|
+
font-family: 'JetBrains Mono', monospace;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#app {
|
|
76
|
+
max-width: 1280px;
|
|
77
|
+
margin: 0 auto;
|
|
78
|
+
padding: 24px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* --- Animations --- */
|
|
82
|
+
@keyframes fadeInUp {
|
|
83
|
+
from {
|
|
84
|
+
opacity: 0;
|
|
85
|
+
transform: translateY(12px);
|
|
86
|
+
}
|
|
87
|
+
to {
|
|
88
|
+
opacity: 1;
|
|
89
|
+
transform: translateY(0);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@keyframes slideInRight {
|
|
94
|
+
from {
|
|
95
|
+
opacity: 0;
|
|
96
|
+
transform: translateX(100%);
|
|
97
|
+
}
|
|
98
|
+
to {
|
|
99
|
+
opacity: 1;
|
|
100
|
+
transform: translateX(0);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@keyframes fadeOut {
|
|
105
|
+
from { opacity: 1; }
|
|
106
|
+
to { opacity: 0; }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@keyframes pulse {
|
|
110
|
+
0%, 100% { opacity: 1; }
|
|
111
|
+
50% { opacity: 0.5; }
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.fade-in {
|
|
115
|
+
animation: fadeInUp 0.35s ease-out both;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* --- Header --- */
|
|
119
|
+
.header {
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: space-between;
|
|
123
|
+
margin-bottom: 28px;
|
|
124
|
+
padding: 20px 24px;
|
|
125
|
+
background: var(--mn-surface);
|
|
126
|
+
border: 1px solid var(--mn-border);
|
|
127
|
+
border-radius: 12px;
|
|
128
|
+
position: relative;
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.header::before {
|
|
133
|
+
content: '';
|
|
134
|
+
position: absolute;
|
|
135
|
+
top: -60%;
|
|
136
|
+
left: -10%;
|
|
137
|
+
width: 300px;
|
|
138
|
+
height: 300px;
|
|
139
|
+
background: radial-gradient(circle, rgba(59, 59, 255, 0.12) 0%, transparent 70%);
|
|
140
|
+
pointer-events: none;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.header-left {
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
gap: 16px;
|
|
147
|
+
position: relative;
|
|
148
|
+
z-index: 1;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.logo {
|
|
152
|
+
font-size: 22px;
|
|
153
|
+
font-weight: 700;
|
|
154
|
+
letter-spacing: -0.02em;
|
|
155
|
+
color: var(--mn-text);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.logo-icon {
|
|
159
|
+
color: var(--mn-accent);
|
|
160
|
+
margin-right: 4px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.status-badge {
|
|
164
|
+
display: inline-flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
gap: 8px;
|
|
167
|
+
padding: 6px 14px;
|
|
168
|
+
border-radius: 20px;
|
|
169
|
+
font-size: 13px;
|
|
170
|
+
font-weight: 500;
|
|
171
|
+
background: var(--mn-surface-alt);
|
|
172
|
+
border: 1px solid var(--mn-border);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.status-dot {
|
|
176
|
+
width: 8px;
|
|
177
|
+
height: 8px;
|
|
178
|
+
border-radius: 50%;
|
|
179
|
+
flex-shrink: 0;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.status-dot.running { background: var(--mn-success); box-shadow: 0 0 6px var(--mn-success); }
|
|
183
|
+
.status-dot.stopped { background: var(--mn-error); }
|
|
184
|
+
.status-dot.starting, .status-dot.stopping { background: var(--mn-warning); animation: pulse 1.5s ease-in-out infinite; }
|
|
185
|
+
.status-dot.unknown { background: var(--mn-text-muted); }
|
|
186
|
+
|
|
187
|
+
.header-actions {
|
|
188
|
+
display: flex;
|
|
189
|
+
gap: 8px;
|
|
190
|
+
position: relative;
|
|
191
|
+
z-index: 1;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.btn {
|
|
195
|
+
display: inline-flex;
|
|
196
|
+
align-items: center;
|
|
197
|
+
gap: 6px;
|
|
198
|
+
padding: 8px 16px;
|
|
199
|
+
border-radius: 8px;
|
|
200
|
+
border: 1px solid var(--mn-border);
|
|
201
|
+
background: var(--mn-surface-alt);
|
|
202
|
+
color: var(--mn-text);
|
|
203
|
+
font-family: 'Inter', sans-serif;
|
|
204
|
+
font-size: 13px;
|
|
205
|
+
font-weight: 500;
|
|
206
|
+
cursor: pointer;
|
|
207
|
+
transition: all 0.15s ease-out;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.btn:hover {
|
|
211
|
+
border-color: var(--mn-border-bright);
|
|
212
|
+
background: var(--mn-border);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.btn-primary {
|
|
216
|
+
background: var(--mn-accent);
|
|
217
|
+
border-color: var(--mn-accent);
|
|
218
|
+
color: var(--mn-text);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.btn-primary:hover {
|
|
222
|
+
background: var(--mn-accent-hover);
|
|
223
|
+
border-color: var(--mn-accent-hover);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.btn-danger {
|
|
227
|
+
border-color: rgba(239, 68, 68, 0.3);
|
|
228
|
+
color: var(--mn-error);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.btn-danger:hover {
|
|
232
|
+
background: rgba(239, 68, 68, 0.1);
|
|
233
|
+
border-color: var(--mn-error);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/* --- Cards Grid --- */
|
|
237
|
+
.cards-grid {
|
|
238
|
+
display: grid;
|
|
239
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
240
|
+
gap: 16px;
|
|
241
|
+
margin-bottom: 16px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.card {
|
|
245
|
+
background: var(--mn-surface);
|
|
246
|
+
border: 1px solid var(--mn-border);
|
|
247
|
+
border-radius: 12px;
|
|
248
|
+
padding: 20px;
|
|
249
|
+
transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
|
|
250
|
+
position: relative;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.card:hover {
|
|
254
|
+
border-color: var(--mn-border-bright);
|
|
255
|
+
box-shadow: 0 4px 24px var(--mn-accent-glow);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.card:hover::after {
|
|
259
|
+
content: '';
|
|
260
|
+
position: absolute;
|
|
261
|
+
inset: 0;
|
|
262
|
+
border-radius: 12px;
|
|
263
|
+
background: var(--mn-gradient-card);
|
|
264
|
+
pointer-events: none;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.card-header {
|
|
268
|
+
display: flex;
|
|
269
|
+
align-items: center;
|
|
270
|
+
justify-content: space-between;
|
|
271
|
+
margin-bottom: 16px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.card-title {
|
|
275
|
+
display: flex;
|
|
276
|
+
align-items: center;
|
|
277
|
+
gap: 10px;
|
|
278
|
+
font-size: 14px;
|
|
279
|
+
font-weight: 600;
|
|
280
|
+
color: var(--mn-text-secondary);
|
|
281
|
+
text-transform: uppercase;
|
|
282
|
+
letter-spacing: 0.05em;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.card-health-dot {
|
|
286
|
+
width: 8px;
|
|
287
|
+
height: 8px;
|
|
288
|
+
border-radius: 50%;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.card-health-dot.healthy { background: var(--mn-success); box-shadow: 0 0 6px var(--mn-success); }
|
|
292
|
+
.card-health-dot.unhealthy { background: var(--mn-error); box-shadow: 0 0 6px var(--mn-error); }
|
|
293
|
+
|
|
294
|
+
.stat-value {
|
|
295
|
+
font-family: 'JetBrains Mono', monospace;
|
|
296
|
+
font-size: 28px;
|
|
297
|
+
font-weight: 600;
|
|
298
|
+
color: var(--mn-text);
|
|
299
|
+
line-height: 1.2;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.stat-label {
|
|
303
|
+
font-size: 12px;
|
|
304
|
+
color: var(--mn-text-muted);
|
|
305
|
+
margin-top: 2px;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.stat-row {
|
|
309
|
+
display: flex;
|
|
310
|
+
align-items: baseline;
|
|
311
|
+
justify-content: space-between;
|
|
312
|
+
padding: 8px 0;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.stat-row:not(:last-child) {
|
|
316
|
+
border-bottom: 1px solid var(--mn-border);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.stat-row-label {
|
|
320
|
+
font-size: 13px;
|
|
321
|
+
color: var(--mn-text-secondary);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.stat-row-value {
|
|
325
|
+
font-family: 'JetBrains Mono', monospace;
|
|
326
|
+
font-size: 14px;
|
|
327
|
+
color: var(--mn-text);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/* --- Gauge --- */
|
|
331
|
+
.gauge-container {
|
|
332
|
+
margin-top: 12px;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.gauge-bar {
|
|
336
|
+
width: 100%;
|
|
337
|
+
height: 6px;
|
|
338
|
+
background: var(--mn-surface-alt);
|
|
339
|
+
border-radius: 3px;
|
|
340
|
+
overflow: hidden;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.gauge-fill {
|
|
344
|
+
height: 100%;
|
|
345
|
+
border-radius: 3px;
|
|
346
|
+
transition: width 0.3s ease-out, background 0.3s ease-out;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.gauge-label {
|
|
350
|
+
display: flex;
|
|
351
|
+
justify-content: space-between;
|
|
352
|
+
margin-top: 6px;
|
|
353
|
+
font-size: 11px;
|
|
354
|
+
color: var(--mn-text-muted);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/* --- Wallet Card (full-width) --- */
|
|
358
|
+
.full-width {
|
|
359
|
+
grid-column: 1 / -1;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.wallet-grid {
|
|
363
|
+
display: grid;
|
|
364
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
365
|
+
gap: 20px;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.wallet-address {
|
|
369
|
+
grid-column: 1 / -1;
|
|
370
|
+
font-family: 'JetBrains Mono', monospace;
|
|
371
|
+
font-size: 13px;
|
|
372
|
+
color: var(--mn-text-secondary);
|
|
373
|
+
overflow: hidden;
|
|
374
|
+
text-overflow: ellipsis;
|
|
375
|
+
white-space: nowrap;
|
|
376
|
+
padding: 10px 14px;
|
|
377
|
+
background: var(--mn-surface-alt);
|
|
378
|
+
border-radius: 8px;
|
|
379
|
+
border: 1px solid var(--mn-border);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.balance-item {
|
|
383
|
+
text-align: center;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.balance-value {
|
|
387
|
+
font-family: 'JetBrains Mono', monospace;
|
|
388
|
+
font-size: 22px;
|
|
389
|
+
font-weight: 600;
|
|
390
|
+
color: var(--mn-text);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.balance-label {
|
|
394
|
+
font-size: 12px;
|
|
395
|
+
color: var(--mn-text-muted);
|
|
396
|
+
margin-top: 2px;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/* --- Response Chart --- */
|
|
400
|
+
.chart-section {
|
|
401
|
+
margin-bottom: 16px;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.sparkline-row {
|
|
405
|
+
display: flex;
|
|
406
|
+
align-items: center;
|
|
407
|
+
gap: 16px;
|
|
408
|
+
padding: 12px 0;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.sparkline-row:not(:last-child) {
|
|
412
|
+
border-bottom: 1px solid var(--mn-border);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.sparkline-label {
|
|
416
|
+
width: 100px;
|
|
417
|
+
font-size: 13px;
|
|
418
|
+
color: var(--mn-text-secondary);
|
|
419
|
+
flex-shrink: 0;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.sparkline-svg {
|
|
423
|
+
flex: 1;
|
|
424
|
+
height: 32px;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.sparkline-value {
|
|
428
|
+
width: 60px;
|
|
429
|
+
text-align: right;
|
|
430
|
+
font-family: 'JetBrains Mono', monospace;
|
|
431
|
+
font-size: 12px;
|
|
432
|
+
color: var(--mn-text-muted);
|
|
433
|
+
flex-shrink: 0;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/* --- Log Viewer --- */
|
|
437
|
+
.log-viewer {
|
|
438
|
+
background: var(--mn-surface);
|
|
439
|
+
border: 1px solid var(--mn-border);
|
|
440
|
+
border-radius: 12px;
|
|
441
|
+
overflow: hidden;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.log-toolbar {
|
|
445
|
+
display: flex;
|
|
446
|
+
align-items: center;
|
|
447
|
+
gap: 8px;
|
|
448
|
+
padding: 12px 16px;
|
|
449
|
+
border-bottom: 1px solid var(--mn-border);
|
|
450
|
+
background: var(--mn-surface-alt);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.log-select {
|
|
454
|
+
padding: 6px 10px;
|
|
455
|
+
border-radius: 6px;
|
|
456
|
+
border: 1px solid var(--mn-border);
|
|
457
|
+
background: var(--mn-surface);
|
|
458
|
+
color: var(--mn-text);
|
|
459
|
+
font-family: 'Inter', sans-serif;
|
|
460
|
+
font-size: 12px;
|
|
461
|
+
cursor: pointer;
|
|
462
|
+
outline: none;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.log-select:focus {
|
|
466
|
+
border-color: var(--mn-accent);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.log-search {
|
|
470
|
+
flex: 1;
|
|
471
|
+
padding: 6px 10px;
|
|
472
|
+
border-radius: 6px;
|
|
473
|
+
border: 1px solid var(--mn-border);
|
|
474
|
+
background: var(--mn-surface);
|
|
475
|
+
color: var(--mn-text);
|
|
476
|
+
font-family: 'Inter', sans-serif;
|
|
477
|
+
font-size: 12px;
|
|
478
|
+
outline: none;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.log-search::placeholder {
|
|
482
|
+
color: var(--mn-text-muted);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.log-search:focus {
|
|
486
|
+
border-color: var(--mn-accent);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.log-entries {
|
|
490
|
+
max-height: 320px;
|
|
491
|
+
overflow-y: auto;
|
|
492
|
+
padding: 8px 0;
|
|
493
|
+
scroll-behavior: smooth;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.log-entries::-webkit-scrollbar {
|
|
497
|
+
width: 6px;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.log-entries::-webkit-scrollbar-track {
|
|
501
|
+
background: transparent;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.log-entries::-webkit-scrollbar-thumb {
|
|
505
|
+
background: var(--mn-border-bright);
|
|
506
|
+
border-radius: 3px;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.log-line {
|
|
510
|
+
display: flex;
|
|
511
|
+
align-items: flex-start;
|
|
512
|
+
gap: 8px;
|
|
513
|
+
padding: 3px 16px;
|
|
514
|
+
font-family: 'JetBrains Mono', monospace;
|
|
515
|
+
font-size: 12px;
|
|
516
|
+
line-height: 1.6;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.log-line:hover {
|
|
520
|
+
background: var(--mn-surface-alt);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.log-tag {
|
|
524
|
+
display: inline-block;
|
|
525
|
+
padding: 1px 6px;
|
|
526
|
+
border-radius: 4px;
|
|
527
|
+
font-size: 10px;
|
|
528
|
+
font-weight: 600;
|
|
529
|
+
text-transform: uppercase;
|
|
530
|
+
letter-spacing: 0.04em;
|
|
531
|
+
flex-shrink: 0;
|
|
532
|
+
min-width: 52px;
|
|
533
|
+
text-align: center;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.log-tag.node { background: rgba(59, 59, 255, 0.15); color: #7070ff; }
|
|
537
|
+
.log-tag.indexer { background: rgba(99, 59, 255, 0.15); color: #9070ff; }
|
|
538
|
+
.log-tag.proof { background: rgba(139, 59, 255, 0.15); color: #b070ff; }
|
|
539
|
+
|
|
540
|
+
.log-level {
|
|
541
|
+
font-size: 10px;
|
|
542
|
+
font-weight: 500;
|
|
543
|
+
min-width: 40px;
|
|
544
|
+
flex-shrink: 0;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.log-level.info { color: var(--mn-text-muted); }
|
|
548
|
+
.log-level.warn { color: var(--mn-warning); }
|
|
549
|
+
.log-level.error { color: var(--mn-error); }
|
|
550
|
+
|
|
551
|
+
.log-message {
|
|
552
|
+
color: var(--mn-text-secondary);
|
|
553
|
+
word-break: break-all;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/* --- Modal Overlay --- */
|
|
557
|
+
.modal-overlay {
|
|
558
|
+
position: fixed;
|
|
559
|
+
inset: 0;
|
|
560
|
+
background: rgba(9, 9, 15, 0.85);
|
|
561
|
+
display: flex;
|
|
562
|
+
align-items: center;
|
|
563
|
+
justify-content: center;
|
|
564
|
+
z-index: 150;
|
|
565
|
+
backdrop-filter: blur(4px);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
.modal-dialog {
|
|
569
|
+
background: var(--mn-surface);
|
|
570
|
+
border: 1px solid var(--mn-border);
|
|
571
|
+
border-radius: 12px;
|
|
572
|
+
padding: 24px;
|
|
573
|
+
width: 480px;
|
|
574
|
+
max-width: 90vw;
|
|
575
|
+
max-height: 80vh;
|
|
576
|
+
overflow-y: auto;
|
|
577
|
+
box-shadow: 0 16px 64px rgba(9, 9, 15, 0.8);
|
|
578
|
+
animation: fadeInUp 0.2s ease-out;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.modal-header {
|
|
582
|
+
display: flex;
|
|
583
|
+
align-items: center;
|
|
584
|
+
justify-content: space-between;
|
|
585
|
+
margin-bottom: 20px;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.modal-title {
|
|
589
|
+
font-size: 16px;
|
|
590
|
+
font-weight: 600;
|
|
591
|
+
color: var(--mn-text);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.modal-close {
|
|
595
|
+
background: none;
|
|
596
|
+
border: none;
|
|
597
|
+
color: var(--mn-text-secondary);
|
|
598
|
+
cursor: pointer;
|
|
599
|
+
padding: 4px;
|
|
600
|
+
display: flex;
|
|
601
|
+
align-items: center;
|
|
602
|
+
justify-content: center;
|
|
603
|
+
border-radius: 6px;
|
|
604
|
+
transition: all 0.15s;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.modal-close:hover {
|
|
608
|
+
color: var(--mn-text);
|
|
609
|
+
background: var(--mn-surface-alt);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/* --- Import Modal Tabs --- */
|
|
613
|
+
.modal-tabs {
|
|
614
|
+
display: flex;
|
|
615
|
+
gap: 0;
|
|
616
|
+
margin-bottom: 16px;
|
|
617
|
+
border-bottom: 1px solid var(--mn-border);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.modal-tab {
|
|
621
|
+
flex: 1;
|
|
622
|
+
padding: 10px 16px;
|
|
623
|
+
background: none;
|
|
624
|
+
border: none;
|
|
625
|
+
border-bottom: 2px solid transparent;
|
|
626
|
+
color: var(--mn-text-secondary);
|
|
627
|
+
font-family: 'Inter', sans-serif;
|
|
628
|
+
font-size: 13px;
|
|
629
|
+
font-weight: 500;
|
|
630
|
+
cursor: pointer;
|
|
631
|
+
transition: all 0.15s;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.modal-tab:hover {
|
|
635
|
+
color: var(--mn-text);
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
.modal-tab.active {
|
|
639
|
+
color: var(--mn-accent);
|
|
640
|
+
border-bottom-color: var(--mn-accent);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
.modal-field {
|
|
644
|
+
margin-bottom: 14px;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
.modal-label {
|
|
648
|
+
display: block;
|
|
649
|
+
font-size: 12px;
|
|
650
|
+
font-weight: 500;
|
|
651
|
+
color: var(--mn-text-secondary);
|
|
652
|
+
margin-bottom: 6px;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
.modal-input {
|
|
656
|
+
width: 100%;
|
|
657
|
+
padding: 8px 12px;
|
|
658
|
+
border-radius: 6px;
|
|
659
|
+
border: 1px solid var(--mn-border);
|
|
660
|
+
background: var(--mn-surface-alt);
|
|
661
|
+
color: var(--mn-text);
|
|
662
|
+
font-family: 'Inter', sans-serif;
|
|
663
|
+
font-size: 13px;
|
|
664
|
+
outline: none;
|
|
665
|
+
transition: border-color 0.15s;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
.modal-input:focus {
|
|
669
|
+
border-color: var(--mn-accent);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
.modal-input.mono {
|
|
673
|
+
font-family: 'JetBrains Mono', monospace;
|
|
674
|
+
font-size: 12px;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
.modal-actions {
|
|
678
|
+
display: flex;
|
|
679
|
+
gap: 8px;
|
|
680
|
+
justify-content: flex-end;
|
|
681
|
+
margin-top: 20px;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/* --- Wallet Selector Dropdown --- */
|
|
685
|
+
.wallet-selector {
|
|
686
|
+
display: flex;
|
|
687
|
+
align-items: center;
|
|
688
|
+
gap: 8px;
|
|
689
|
+
flex: 1;
|
|
690
|
+
min-width: 0;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
.wallet-select {
|
|
694
|
+
flex: 1;
|
|
695
|
+
min-width: 0;
|
|
696
|
+
padding: 6px 10px;
|
|
697
|
+
border-radius: 6px;
|
|
698
|
+
border: 1px solid var(--mn-border);
|
|
699
|
+
background: var(--mn-surface-alt);
|
|
700
|
+
color: var(--mn-text);
|
|
701
|
+
font-family: 'Inter', sans-serif;
|
|
702
|
+
font-size: 13px;
|
|
703
|
+
cursor: pointer;
|
|
704
|
+
outline: none;
|
|
705
|
+
transition: border-color 0.15s;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
.wallet-select:focus {
|
|
709
|
+
border-color: var(--mn-accent);
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/* --- Inline Edit Input --- */
|
|
713
|
+
.inline-edit-input {
|
|
714
|
+
padding: 4px 8px;
|
|
715
|
+
border-radius: 4px;
|
|
716
|
+
border: 1px solid var(--mn-accent);
|
|
717
|
+
background: var(--mn-surface-alt);
|
|
718
|
+
color: var(--mn-text);
|
|
719
|
+
font-family: 'Inter', sans-serif;
|
|
720
|
+
font-size: 13px;
|
|
721
|
+
outline: none;
|
|
722
|
+
width: 180px;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/* --- Icon Button --- */
|
|
726
|
+
.icon-btn {
|
|
727
|
+
background: none;
|
|
728
|
+
border: none;
|
|
729
|
+
color: var(--mn-text-muted);
|
|
730
|
+
cursor: pointer;
|
|
731
|
+
padding: 4px;
|
|
732
|
+
display: inline-flex;
|
|
733
|
+
align-items: center;
|
|
734
|
+
justify-content: center;
|
|
735
|
+
border-radius: 4px;
|
|
736
|
+
transition: all 0.15s;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
.icon-btn:hover {
|
|
740
|
+
color: var(--mn-text);
|
|
741
|
+
background: var(--mn-surface-alt);
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
.icon-btn.danger:hover {
|
|
745
|
+
color: var(--mn-error);
|
|
746
|
+
background: rgba(239, 68, 68, 0.1);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/* --- Copy Button --- */
|
|
750
|
+
.copy-btn {
|
|
751
|
+
background: none;
|
|
752
|
+
border: none;
|
|
753
|
+
color: var(--mn-text-muted);
|
|
754
|
+
cursor: pointer;
|
|
755
|
+
padding: 4px 6px;
|
|
756
|
+
display: inline-flex;
|
|
757
|
+
align-items: center;
|
|
758
|
+
gap: 4px;
|
|
759
|
+
border-radius: 4px;
|
|
760
|
+
font-family: 'Inter', sans-serif;
|
|
761
|
+
font-size: 11px;
|
|
762
|
+
transition: all 0.15s;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
.copy-btn:hover {
|
|
766
|
+
color: var(--mn-text);
|
|
767
|
+
background: var(--mn-surface-alt);
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
.copy-btn.copied {
|
|
771
|
+
color: var(--mn-success);
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
/* --- Pulsing Sync Animation --- */
|
|
775
|
+
@keyframes syncPulse {
|
|
776
|
+
0%, 100% { box-shadow: 0 0 0 0 var(--mn-accent-glow); }
|
|
777
|
+
50% { box-shadow: 0 0 12px 4px var(--mn-accent-glow); }
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
.sync-indicator {
|
|
781
|
+
display: flex;
|
|
782
|
+
align-items: center;
|
|
783
|
+
gap: 8px;
|
|
784
|
+
font-size: 12px;
|
|
785
|
+
color: var(--mn-text-secondary);
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
.sync-spinner {
|
|
789
|
+
width: 14px;
|
|
790
|
+
height: 14px;
|
|
791
|
+
border: 2px solid var(--mn-border);
|
|
792
|
+
border-top-color: var(--mn-accent);
|
|
793
|
+
border-radius: 50%;
|
|
794
|
+
animation: spin 0.8s linear infinite;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
.sync-glow {
|
|
798
|
+
animation: syncPulse 2s ease-in-out infinite;
|
|
799
|
+
border-radius: 12px;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/* --- Confirm Delete Inline Prompt --- */
|
|
803
|
+
.confirm-delete {
|
|
804
|
+
display: flex;
|
|
805
|
+
align-items: center;
|
|
806
|
+
gap: 8px;
|
|
807
|
+
padding: 6px 10px;
|
|
808
|
+
background: var(--mn-surface-alt);
|
|
809
|
+
border: 1px solid rgba(239, 68, 68, 0.3);
|
|
810
|
+
border-radius: 6px;
|
|
811
|
+
font-size: 12px;
|
|
812
|
+
color: var(--mn-text-secondary);
|
|
813
|
+
animation: fadeInUp 0.15s ease-out;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
.confirm-delete .btn {
|
|
817
|
+
padding: 4px 10px;
|
|
818
|
+
font-size: 11px;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
/* --- Wallet Card Header Row --- */
|
|
822
|
+
.wallet-header-row {
|
|
823
|
+
display: flex;
|
|
824
|
+
align-items: center;
|
|
825
|
+
gap: 8px;
|
|
826
|
+
margin-bottom: 16px;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
.wallet-address-row {
|
|
830
|
+
display: flex;
|
|
831
|
+
align-items: center;
|
|
832
|
+
gap: 8px;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/* --- Connection Overlay --- */
|
|
836
|
+
.connection-overlay {
|
|
837
|
+
position: fixed;
|
|
838
|
+
inset: 0;
|
|
839
|
+
background: rgba(9, 9, 15, 0.85);
|
|
840
|
+
display: flex;
|
|
841
|
+
align-items: center;
|
|
842
|
+
justify-content: center;
|
|
843
|
+
z-index: 100;
|
|
844
|
+
backdrop-filter: blur(4px);
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
.connection-message {
|
|
848
|
+
text-align: center;
|
|
849
|
+
color: var(--mn-text-secondary);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
.connection-message h2 {
|
|
853
|
+
font-size: 18px;
|
|
854
|
+
margin-bottom: 8px;
|
|
855
|
+
color: var(--mn-text);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
.connection-message p {
|
|
859
|
+
font-size: 14px;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
.connection-spinner {
|
|
863
|
+
width: 24px;
|
|
864
|
+
height: 24px;
|
|
865
|
+
border: 2px solid var(--mn-border);
|
|
866
|
+
border-top-color: var(--mn-accent);
|
|
867
|
+
border-radius: 50%;
|
|
868
|
+
animation: spin 0.8s linear infinite;
|
|
869
|
+
margin: 0 auto 16px;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
@keyframes spin {
|
|
873
|
+
to { transform: rotate(360deg); }
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/* --- Toast --- */
|
|
877
|
+
.toast-container {
|
|
878
|
+
position: fixed;
|
|
879
|
+
top: 16px;
|
|
880
|
+
right: 16px;
|
|
881
|
+
z-index: 200;
|
|
882
|
+
display: flex;
|
|
883
|
+
flex-direction: column;
|
|
884
|
+
gap: 8px;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
.toast {
|
|
888
|
+
padding: 12px 20px;
|
|
889
|
+
border-radius: 8px;
|
|
890
|
+
font-size: 13px;
|
|
891
|
+
font-weight: 500;
|
|
892
|
+
border: 1px solid var(--mn-border);
|
|
893
|
+
background: var(--mn-surface);
|
|
894
|
+
color: var(--mn-text);
|
|
895
|
+
animation: slideInRight 0.2s ease-out;
|
|
896
|
+
min-width: 240px;
|
|
897
|
+
box-shadow: 0 8px 32px rgba(9, 9, 15, 0.5);
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
.toast.success { border-left: 3px solid var(--mn-success); }
|
|
901
|
+
.toast.error { border-left: 3px solid var(--mn-error); }
|
|
902
|
+
.toast.fade-out { animation: fadeOut 0.3s ease-out forwards; }
|
|
903
|
+
|
|
904
|
+
/* --- Card Footer (server time) --- */
|
|
905
|
+
.card-footer {
|
|
906
|
+
color: var(--mn-text-muted);
|
|
907
|
+
font-size: 11px;
|
|
908
|
+
text-align: right;
|
|
909
|
+
margin-top: 12px;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/* --- Disabled Button --- */
|
|
913
|
+
.btn:disabled {
|
|
914
|
+
opacity: 0.5;
|
|
915
|
+
cursor: not-allowed;
|
|
916
|
+
pointer-events: none;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
.btn-spinner {
|
|
920
|
+
display: inline-block;
|
|
921
|
+
width: 12px;
|
|
922
|
+
height: 12px;
|
|
923
|
+
border: 2px solid var(--mn-border);
|
|
924
|
+
border-top-color: currentColor;
|
|
925
|
+
border-radius: 50%;
|
|
926
|
+
animation: spin 0.8s linear infinite;
|
|
927
|
+
flex-shrink: 0;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/* --- Polling Settings Popover --- */
|
|
931
|
+
.settings-wrapper {
|
|
932
|
+
position: relative;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
.settings-popover {
|
|
936
|
+
position: absolute;
|
|
937
|
+
top: calc(100% + 8px);
|
|
938
|
+
right: 0;
|
|
939
|
+
width: 280px;
|
|
940
|
+
background: var(--mn-surface);
|
|
941
|
+
border: 1px solid var(--mn-border-bright);
|
|
942
|
+
border-radius: 10px;
|
|
943
|
+
padding: 16px;
|
|
944
|
+
z-index: 50;
|
|
945
|
+
box-shadow: 0 8px 32px rgba(9, 9, 15, 0.6);
|
|
946
|
+
animation: fadeInUp 0.15s ease-out;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
.settings-title {
|
|
950
|
+
font-size: 13px;
|
|
951
|
+
font-weight: 600;
|
|
952
|
+
color: var(--mn-text);
|
|
953
|
+
margin-bottom: 12px;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
.settings-row {
|
|
957
|
+
display: flex;
|
|
958
|
+
align-items: center;
|
|
959
|
+
justify-content: space-between;
|
|
960
|
+
padding: 6px 0;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
.settings-row:not(:last-child) {
|
|
964
|
+
border-bottom: 1px solid var(--mn-border);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
.settings-label {
|
|
968
|
+
font-size: 12px;
|
|
969
|
+
color: var(--mn-text-secondary);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
.settings-input {
|
|
973
|
+
width: 64px;
|
|
974
|
+
padding: 4px 8px;
|
|
975
|
+
border-radius: 4px;
|
|
976
|
+
border: 1px solid var(--mn-border);
|
|
977
|
+
background: var(--mn-surface-alt);
|
|
978
|
+
color: var(--mn-text);
|
|
979
|
+
font-family: 'JetBrains Mono', monospace;
|
|
980
|
+
font-size: 12px;
|
|
981
|
+
text-align: center;
|
|
982
|
+
outline: none;
|
|
983
|
+
transition: border-color 0.15s;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
.settings-input:focus {
|
|
987
|
+
border-color: var(--mn-accent);
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
.settings-unit {
|
|
991
|
+
font-size: 11px;
|
|
992
|
+
color: var(--mn-text-muted);
|
|
993
|
+
margin-left: 4px;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
/* --- Responsive --- */
|
|
997
|
+
@media (max-width: 768px) {
|
|
998
|
+
#app { padding: 12px; }
|
|
999
|
+
.header { flex-direction: column; gap: 12px; padding: 16px; }
|
|
1000
|
+
.wallet-grid { grid-template-columns: 1fr; }
|
|
1001
|
+
.sparkline-row { flex-direction: column; align-items: flex-start; gap: 4px; }
|
|
1002
|
+
.sparkline-label { width: auto; }
|
|
1003
|
+
.sparkline-value { width: auto; text-align: left; }
|
|
1004
|
+
}
|
|
1005
|
+
</style>
|
|
1006
|
+
</head>
|
|
1007
|
+
<body>
|
|
1008
|
+
<div id="app"></div>
|
|
1009
|
+
|
|
1010
|
+
<script type="module">
|
|
1011
|
+
import { h, render } from 'preact';
|
|
1012
|
+
import { useState, useEffect, useRef, useCallback, useMemo } from 'preact/hooks';
|
|
1013
|
+
import { html } from 'htm/preact';
|
|
1014
|
+
|
|
1015
|
+
// --- Lucide icon SVGs (inline, stroke-based) ---
|
|
1016
|
+
// Using simple inline SVG paths instead of full lucide library for performance
|
|
1017
|
+
const icons = {
|
|
1018
|
+
play: html\`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="6 3 20 12 6 21 6 3"/></svg>\`,
|
|
1019
|
+
square: html\`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2"/></svg>\`,
|
|
1020
|
+
box: html\`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"/><path d="m3.3 7 8.7 5 8.7-5"/><path d="M12 22V12"/></svg>\`,
|
|
1021
|
+
database: html\`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/></svg>\`,
|
|
1022
|
+
shield: html\`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/></svg>\`,
|
|
1023
|
+
wallet: html\`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1"/><path d="M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"/></svg>\`,
|
|
1024
|
+
activity: html\`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/></svg>\`,
|
|
1025
|
+
terminal: html\`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5"/><line x1="12" x2="20" y1="19" y2="19"/></svg>\`,
|
|
1026
|
+
search: html\`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>\`,
|
|
1027
|
+
copy: html\`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>\`,
|
|
1028
|
+
pencil: html\`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/></svg>\`,
|
|
1029
|
+
trash: html\`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/></svg>\`,
|
|
1030
|
+
plus: html\`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14"/><path d="M12 5v14"/></svg>\`,
|
|
1031
|
+
x: html\`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>\`,
|
|
1032
|
+
settings: html\`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/></svg>\`,
|
|
1033
|
+
};
|
|
1034
|
+
|
|
1035
|
+
// --- WebSocket URL (injected at generation time) ---
|
|
1036
|
+
const WS_URL = ${safeJsonInScript(wsUrl)};
|
|
1037
|
+
|
|
1038
|
+
// --- Utility functions ---
|
|
1039
|
+
function formatNumber(n) {
|
|
1040
|
+
if (n == null) return '--';
|
|
1041
|
+
return n.toLocaleString();
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
function formatBalance(val) {
|
|
1045
|
+
if (val == null || val === '0') return '0';
|
|
1046
|
+
const num = BigInt(val);
|
|
1047
|
+
return num.toLocaleString();
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
function truncateAddress(addr) {
|
|
1051
|
+
if (!addr) return '--';
|
|
1052
|
+
if (addr.length <= 20) return addr;
|
|
1053
|
+
return addr.slice(0, 10) + '...' + addr.slice(-8);
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
function formatMs(ms) {
|
|
1057
|
+
if (ms == null) return '--';
|
|
1058
|
+
return ms < 1000 ? ms.toFixed(0) + 'ms' : (ms / 1000).toFixed(2) + 's';
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
function gaugeColor(pct) {
|
|
1062
|
+
if (pct >= 90) return 'var(--mn-error)';
|
|
1063
|
+
if (pct >= 70) return 'var(--mn-warning)';
|
|
1064
|
+
return 'var(--mn-success)';
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
function formatTime(isoString) {
|
|
1068
|
+
if (!isoString) return '--:--:--';
|
|
1069
|
+
try {
|
|
1070
|
+
const d = new Date(isoString);
|
|
1071
|
+
if (isNaN(d.getTime())) return '--:--:--';
|
|
1072
|
+
return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false });
|
|
1073
|
+
} catch (e) {
|
|
1074
|
+
return '--:--:--';
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
const POLLING_KEY = 'mn-polling-config';
|
|
1079
|
+
|
|
1080
|
+
// --- Default state ---
|
|
1081
|
+
const defaultState = {
|
|
1082
|
+
node: { chain: null, name: null, version: null, blockHeight: null, avgBlockTime: null, peers: null, syncing: null },
|
|
1083
|
+
indexer: { ready: false, responseTime: null },
|
|
1084
|
+
proofServer: { version: null, ready: false, jobsProcessing: null, jobsPending: null, jobCapacity: null, proofVersions: null },
|
|
1085
|
+
wallet: { address: null, connected: false, unshielded: '0', shielded: '0', dust: '0' },
|
|
1086
|
+
health: {
|
|
1087
|
+
node: { status: 'unhealthy', history: [] },
|
|
1088
|
+
indexer: { status: 'unhealthy', history: [] },
|
|
1089
|
+
proofServer: { status: 'unhealthy', history: [] },
|
|
1090
|
+
},
|
|
1091
|
+
containers: [],
|
|
1092
|
+
logs: [],
|
|
1093
|
+
networkStatus: 'unknown',
|
|
1094
|
+
walletSyncStatus: 'idle',
|
|
1095
|
+
serverTime: '',
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
// --- Toast component ---
|
|
1099
|
+
function ToastContainer({ toasts, onRemove }) {
|
|
1100
|
+
return html\`
|
|
1101
|
+
<div class="toast-container">
|
|
1102
|
+
\${toasts.map(t => html\`
|
|
1103
|
+
<div key=\${t.id} class="toast \${t.type} \${t.fading ? 'fade-out' : ''}"
|
|
1104
|
+
onAnimationEnd=\${() => t.fading && onRemove(t.id)}>
|
|
1105
|
+
\${t.message}
|
|
1106
|
+
</div>
|
|
1107
|
+
\`)}
|
|
1108
|
+
</div>
|
|
1109
|
+
\`;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
// --- ConnectionStatus ---
|
|
1113
|
+
function ConnectionStatus({ connected }) {
|
|
1114
|
+
if (connected) return null;
|
|
1115
|
+
return html\`
|
|
1116
|
+
<div class="connection-overlay">
|
|
1117
|
+
<div class="connection-message">
|
|
1118
|
+
<div class="connection-spinner"></div>
|
|
1119
|
+
<h2>Reconnecting...</h2>
|
|
1120
|
+
<p>Attempting to connect to dashboard server</p>
|
|
1121
|
+
</div>
|
|
1122
|
+
</div>
|
|
1123
|
+
\`;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
// --- PollingSettings ---
|
|
1127
|
+
function PollingSettings({ sendMessage }) {
|
|
1128
|
+
const [open, setOpen] = useState(false);
|
|
1129
|
+
const [config, setConfig] = useState(() => {
|
|
1130
|
+
try {
|
|
1131
|
+
const raw = localStorage.getItem(POLLING_KEY);
|
|
1132
|
+
if (raw) return JSON.parse(raw);
|
|
1133
|
+
} catch (e) { /* ignore */ }
|
|
1134
|
+
return { node: 5, indexer: 5, proofServer: 5 };
|
|
1135
|
+
});
|
|
1136
|
+
|
|
1137
|
+
// Send saved polling config on mount
|
|
1138
|
+
useEffect(() => {
|
|
1139
|
+
const saved = config;
|
|
1140
|
+
['node', 'indexer', 'proofServer'].forEach(service => {
|
|
1141
|
+
if (saved[service] && saved[service] !== 5) {
|
|
1142
|
+
sendMessage({ type: 'command', action: 'set-polling', service, interval: saved[service] * 1000 });
|
|
1143
|
+
}
|
|
1144
|
+
});
|
|
1145
|
+
}, []);
|
|
1146
|
+
|
|
1147
|
+
const handleChange = useCallback((service, value) => {
|
|
1148
|
+
const num = Math.max(1, Math.min(60, parseInt(value, 10) || 5));
|
|
1149
|
+
setConfig(prev => {
|
|
1150
|
+
const updated = { ...prev, [service]: num };
|
|
1151
|
+
localStorage.setItem(POLLING_KEY, JSON.stringify(updated));
|
|
1152
|
+
return updated;
|
|
1153
|
+
});
|
|
1154
|
+
sendMessage({ type: 'command', action: 'set-polling', service, interval: num * 1000 });
|
|
1155
|
+
}, [sendMessage]);
|
|
1156
|
+
|
|
1157
|
+
return html\`
|
|
1158
|
+
<div class="settings-wrapper">
|
|
1159
|
+
<button class="btn" onClick=\${() => setOpen(!open)} title="Polling Settings">
|
|
1160
|
+
\${icons.settings}
|
|
1161
|
+
</button>
|
|
1162
|
+
\${open ? html\`
|
|
1163
|
+
<div class="settings-popover">
|
|
1164
|
+
<div class="settings-title">Polling Intervals</div>
|
|
1165
|
+
<div class="settings-row">
|
|
1166
|
+
<span class="settings-label">Node</span>
|
|
1167
|
+
<div>
|
|
1168
|
+
<input class="settings-input" type="number" min="1" max="60"
|
|
1169
|
+
value=\${config.node}
|
|
1170
|
+
onChange=\${e => handleChange('node', e.target.value)} />
|
|
1171
|
+
<span class="settings-unit">sec</span>
|
|
1172
|
+
</div>
|
|
1173
|
+
</div>
|
|
1174
|
+
<div class="settings-row">
|
|
1175
|
+
<span class="settings-label">Indexer</span>
|
|
1176
|
+
<div>
|
|
1177
|
+
<input class="settings-input" type="number" min="1" max="60"
|
|
1178
|
+
value=\${config.indexer}
|
|
1179
|
+
onChange=\${e => handleChange('indexer', e.target.value)} />
|
|
1180
|
+
<span class="settings-unit">sec</span>
|
|
1181
|
+
</div>
|
|
1182
|
+
</div>
|
|
1183
|
+
<div class="settings-row">
|
|
1184
|
+
<span class="settings-label">Proof Server</span>
|
|
1185
|
+
<div>
|
|
1186
|
+
<input class="settings-input" type="number" min="1" max="60"
|
|
1187
|
+
value=\${config.proofServer}
|
|
1188
|
+
onChange=\${e => handleChange('proofServer', e.target.value)} />
|
|
1189
|
+
<span class="settings-unit">sec</span>
|
|
1190
|
+
</div>
|
|
1191
|
+
</div>
|
|
1192
|
+
</div>
|
|
1193
|
+
\` : null}
|
|
1194
|
+
</div>
|
|
1195
|
+
\`;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
// --- Header ---
|
|
1199
|
+
function Header({ networkStatus, onStart, onStop, sendMessage }) {
|
|
1200
|
+
const statusLabel = networkStatus.charAt(0).toUpperCase() + networkStatus.slice(1);
|
|
1201
|
+
|
|
1202
|
+
const renderButtons = () => {
|
|
1203
|
+
if (networkStatus === 'running') {
|
|
1204
|
+
return html\`<button class="btn btn-danger" onClick=\${onStop}>\${icons.square} Stop</button>\`;
|
|
1205
|
+
}
|
|
1206
|
+
if (networkStatus === 'stopped') {
|
|
1207
|
+
return html\`<button class="btn btn-primary" onClick=\${onStart}>\${icons.play} Start</button>\`;
|
|
1208
|
+
}
|
|
1209
|
+
if (networkStatus === 'starting') {
|
|
1210
|
+
return html\`<button class="btn btn-primary" disabled><span class="btn-spinner"></span> Starting...</button>\`;
|
|
1211
|
+
}
|
|
1212
|
+
if (networkStatus === 'stopping') {
|
|
1213
|
+
return html\`<button class="btn btn-danger" disabled><span class="btn-spinner"></span> Stopping...</button>\`;
|
|
1214
|
+
}
|
|
1215
|
+
// unknown — show both
|
|
1216
|
+
return html\`
|
|
1217
|
+
<button class="btn btn-primary" onClick=\${onStart}>\${icons.play} Start</button>
|
|
1218
|
+
<button class="btn btn-danger" onClick=\${onStop}>\${icons.square} Stop</button>
|
|
1219
|
+
\`;
|
|
1220
|
+
};
|
|
1221
|
+
|
|
1222
|
+
return html\`
|
|
1223
|
+
<div class="header fade-in">
|
|
1224
|
+
<div class="header-left">
|
|
1225
|
+
<div class="logo"><span class="logo-icon">◈</span> Midnight Devnet</div>
|
|
1226
|
+
<div class="status-badge">
|
|
1227
|
+
<span class="status-dot \${networkStatus}"></span>
|
|
1228
|
+
\${statusLabel}
|
|
1229
|
+
</div>
|
|
1230
|
+
</div>
|
|
1231
|
+
<div class="header-actions">
|
|
1232
|
+
\${renderButtons()}
|
|
1233
|
+
<\${PollingSettings} sendMessage=\${sendMessage} />
|
|
1234
|
+
</div>
|
|
1235
|
+
</div>
|
|
1236
|
+
\`;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
// --- NodeCard ---
|
|
1240
|
+
function NodeCard({ node, health, serverTime }) {
|
|
1241
|
+
const blockTimeStr = node.avgBlockTime != null ? (node.avgBlockTime / 1000).toFixed(1) + 's' : '--';
|
|
1242
|
+
return html\`
|
|
1243
|
+
<div class="card fade-in" style="animation-delay: 0ms">
|
|
1244
|
+
<div class="card-header">
|
|
1245
|
+
<div class="card-title">
|
|
1246
|
+
\${icons.box}
|
|
1247
|
+
Node
|
|
1248
|
+
</div>
|
|
1249
|
+
<span class="card-health-dot \${health.status}"></span>
|
|
1250
|
+
</div>
|
|
1251
|
+
<div class="stat-value mono">\${formatNumber(node.blockHeight)}</div>
|
|
1252
|
+
<div class="stat-label">Block Height</div>
|
|
1253
|
+
<div style="margin-top: 14px">
|
|
1254
|
+
<div class="stat-row">
|
|
1255
|
+
<span class="stat-row-label">Avg Block Time</span>
|
|
1256
|
+
<span class="stat-row-value">\${blockTimeStr}</span>
|
|
1257
|
+
</div>
|
|
1258
|
+
<div class="stat-row">
|
|
1259
|
+
<span class="stat-row-label">Peers</span>
|
|
1260
|
+
<span class="stat-row-value">\${formatNumber(node.peers)}</span>
|
|
1261
|
+
</div>
|
|
1262
|
+
<div class="stat-row">
|
|
1263
|
+
<span class="stat-row-label">Version</span>
|
|
1264
|
+
<span class="stat-row-value">\${node.version || '--'}</span>
|
|
1265
|
+
</div>
|
|
1266
|
+
</div>
|
|
1267
|
+
<div class="card-footer">\${formatTime(serverTime)}</div>
|
|
1268
|
+
</div>
|
|
1269
|
+
\`;
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
// --- IndexerCard ---
|
|
1273
|
+
function IndexerCard({ indexer, health, serverTime }) {
|
|
1274
|
+
return html\`
|
|
1275
|
+
<div class="card fade-in" style="animation-delay: 150ms">
|
|
1276
|
+
<div class="card-header">
|
|
1277
|
+
<div class="card-title">
|
|
1278
|
+
\${icons.database}
|
|
1279
|
+
Indexer
|
|
1280
|
+
</div>
|
|
1281
|
+
<span class="card-health-dot \${health.status}"></span>
|
|
1282
|
+
</div>
|
|
1283
|
+
<div class="stat-value mono" style="font-size: 22px; color: \${indexer.ready ? 'var(--mn-success)' : 'var(--mn-error)'}">\${indexer.ready ? 'Ready' : 'Not Ready'}</div>
|
|
1284
|
+
<div class="stat-label">Service Status</div>
|
|
1285
|
+
<div style="margin-top: 14px">
|
|
1286
|
+
<div class="stat-row">
|
|
1287
|
+
<span class="stat-row-label">Response Time</span>
|
|
1288
|
+
<span class="stat-row-value">\${formatMs(indexer.responseTime)}</span>
|
|
1289
|
+
</div>
|
|
1290
|
+
</div>
|
|
1291
|
+
<div class="card-footer">\${formatTime(serverTime)}</div>
|
|
1292
|
+
</div>
|
|
1293
|
+
\`;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
// --- ProofServerCard ---
|
|
1297
|
+
function ProofServerCard({ proofServer, health, serverTime }) {
|
|
1298
|
+
const capacity = proofServer.jobCapacity || 1;
|
|
1299
|
+
const processing = proofServer.jobsProcessing || 0;
|
|
1300
|
+
const pct = Math.min(100, (processing / capacity) * 100);
|
|
1301
|
+
const proofVersionsDisplay = proofServer.proofVersions && proofServer.proofVersions.length > 0
|
|
1302
|
+
? proofServer.proofVersions.join(', ')
|
|
1303
|
+
: 'None';
|
|
1304
|
+
return html\`
|
|
1305
|
+
<div class="card fade-in" style="animation-delay: 300ms">
|
|
1306
|
+
<div class="card-header">
|
|
1307
|
+
<div class="card-title">
|
|
1308
|
+
\${icons.shield}
|
|
1309
|
+
Proof Server
|
|
1310
|
+
</div>
|
|
1311
|
+
<span class="card-health-dot \${health.status}"></span>
|
|
1312
|
+
</div>
|
|
1313
|
+
<div class="stat-value mono" style="font-size: 22px; color: \${proofServer.ready ? 'var(--mn-success)' : 'var(--mn-error)'}">\${proofServer.ready ? 'Ready' : 'Not Ready'}</div>
|
|
1314
|
+
<div class="stat-label">Service Status</div>
|
|
1315
|
+
<div class="gauge-container">
|
|
1316
|
+
<div class="gauge-bar">
|
|
1317
|
+
<div class="gauge-fill" style="width: \${pct}%; background: \${gaugeColor(pct)}"></div>
|
|
1318
|
+
</div>
|
|
1319
|
+
<div class="gauge-label">
|
|
1320
|
+
<span>Jobs: \${formatNumber(processing)} / \${formatNumber(capacity)}</span>
|
|
1321
|
+
<span>Pending: \${formatNumber(proofServer.jobsPending)}</span>
|
|
1322
|
+
</div>
|
|
1323
|
+
</div>
|
|
1324
|
+
<div style="margin-top: 10px">
|
|
1325
|
+
<div class="stat-row">
|
|
1326
|
+
<span class="stat-row-label">Server Version</span>
|
|
1327
|
+
<span class="stat-row-value">\${proofServer.version || '--'}</span>
|
|
1328
|
+
</div>
|
|
1329
|
+
<div class="stat-row">
|
|
1330
|
+
<span class="stat-row-label">Proof Versions</span>
|
|
1331
|
+
<span class="stat-row-value">\${proofVersionsDisplay}</span>
|
|
1332
|
+
</div>
|
|
1333
|
+
</div>
|
|
1334
|
+
<div class="card-footer">\${formatTime(serverTime)}</div>
|
|
1335
|
+
</div>
|
|
1336
|
+
\`;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
// --- localStorage helpers for wallet list ---
|
|
1340
|
+
const WALLETS_KEY = 'mn-wallets';
|
|
1341
|
+
|
|
1342
|
+
function loadWallets() {
|
|
1343
|
+
try {
|
|
1344
|
+
const raw = localStorage.getItem(WALLETS_KEY);
|
|
1345
|
+
if (raw) return JSON.parse(raw);
|
|
1346
|
+
} catch (e) { /* ignore */ }
|
|
1347
|
+
return [];
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
function saveWallets(wallets) {
|
|
1351
|
+
localStorage.setItem(WALLETS_KEY, JSON.stringify(wallets));
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
// --- ImportWalletModal ---
|
|
1355
|
+
function ImportWalletModal({ onClose, onImport, sendMessage, deriveResult }) {
|
|
1356
|
+
const [tab, setTab] = useState('mnemonic');
|
|
1357
|
+
const [mnemonic, setMnemonic] = useState('');
|
|
1358
|
+
const [address, setAddress] = useState('');
|
|
1359
|
+
const [displayName, setDisplayName] = useState('');
|
|
1360
|
+
const [deriving, setDeriving] = useState(false);
|
|
1361
|
+
const [derivedAddress, setDerivedAddress] = useState(null);
|
|
1362
|
+
|
|
1363
|
+
// Watch for derive-result coming in
|
|
1364
|
+
useEffect(() => {
|
|
1365
|
+
if (deriveResult && deriving) {
|
|
1366
|
+
setDerivedAddress(deriveResult);
|
|
1367
|
+
setDeriving(false);
|
|
1368
|
+
}
|
|
1369
|
+
}, [deriveResult, deriving]);
|
|
1370
|
+
|
|
1371
|
+
const handleDerive = useCallback(() => {
|
|
1372
|
+
if (!mnemonic.trim()) return;
|
|
1373
|
+
setDeriving(true);
|
|
1374
|
+
setDerivedAddress(null);
|
|
1375
|
+
sendMessage({ type: 'command', action: 'derive-address', mnemonic: mnemonic.trim() });
|
|
1376
|
+
}, [mnemonic, sendMessage]);
|
|
1377
|
+
|
|
1378
|
+
const handleImport = useCallback(() => {
|
|
1379
|
+
if (tab === 'mnemonic') {
|
|
1380
|
+
if (!derivedAddress) return;
|
|
1381
|
+
onImport({
|
|
1382
|
+
id: crypto.randomUUID(),
|
|
1383
|
+
publicKey: derivedAddress,
|
|
1384
|
+
displayName: displayName.trim() || 'Imported Wallet',
|
|
1385
|
+
hasMnemonic: true,
|
|
1386
|
+
});
|
|
1387
|
+
} else {
|
|
1388
|
+
if (!address.trim()) return;
|
|
1389
|
+
onImport({
|
|
1390
|
+
id: crypto.randomUUID(),
|
|
1391
|
+
publicKey: address.trim(),
|
|
1392
|
+
displayName: displayName.trim() || 'Imported Wallet',
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
onClose();
|
|
1396
|
+
}, [tab, derivedAddress, address, displayName, onImport, onClose]);
|
|
1397
|
+
|
|
1398
|
+
return html\`
|
|
1399
|
+
<div class="modal-overlay" onClick=\${(e) => { if (e.target === e.currentTarget) onClose(); }}>
|
|
1400
|
+
<div class="modal-dialog">
|
|
1401
|
+
<div class="modal-header">
|
|
1402
|
+
<span class="modal-title">Import Wallet</span>
|
|
1403
|
+
<button class="modal-close" onClick=\${onClose}>\${icons.x}</button>
|
|
1404
|
+
</div>
|
|
1405
|
+
<div class="modal-tabs">
|
|
1406
|
+
<button class="modal-tab \${tab === 'mnemonic' ? 'active' : ''}" onClick=\${() => { setTab('mnemonic'); setDerivedAddress(null); }}>Mnemonic</button>
|
|
1407
|
+
<button class="modal-tab \${tab === 'address' ? 'active' : ''}" onClick=\${() => setTab('address')}>Address</button>
|
|
1408
|
+
</div>
|
|
1409
|
+
\${tab === 'mnemonic' ? html\`
|
|
1410
|
+
<div class="modal-field">
|
|
1411
|
+
<label class="modal-label">Mnemonic Phrase</label>
|
|
1412
|
+
<input class="modal-input mono" type="text" placeholder="Enter mnemonic words..."
|
|
1413
|
+
value=\${mnemonic} onInput=\${e => setMnemonic(e.target.value)} />
|
|
1414
|
+
</div>
|
|
1415
|
+
<div style="margin-bottom: 14px">
|
|
1416
|
+
<button class="btn" onClick=\${handleDerive} disabled=\${deriving || !mnemonic.trim()}>
|
|
1417
|
+
\${deriving ? 'Deriving...' : 'Derive Address'}
|
|
1418
|
+
</button>
|
|
1419
|
+
\${derivedAddress ? html\`
|
|
1420
|
+
<div style="margin-top: 8px; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--mn-success); word-break: break-all;">
|
|
1421
|
+
Derived: \${truncateAddress(derivedAddress)}
|
|
1422
|
+
</div>
|
|
1423
|
+
\` : null}
|
|
1424
|
+
</div>
|
|
1425
|
+
\` : html\`
|
|
1426
|
+
<div class="modal-field">
|
|
1427
|
+
<label class="modal-label">Public Key / Address</label>
|
|
1428
|
+
<input class="modal-input mono" type="text" placeholder="Paste public key..."
|
|
1429
|
+
value=\${address} onInput=\${e => setAddress(e.target.value)} />
|
|
1430
|
+
</div>
|
|
1431
|
+
\`}
|
|
1432
|
+
<div class="modal-field">
|
|
1433
|
+
<label class="modal-label">Display Name (optional)</label>
|
|
1434
|
+
<input class="modal-input" type="text" placeholder="e.g. My Wallet"
|
|
1435
|
+
value=\${displayName} onInput=\${e => setDisplayName(e.target.value)} />
|
|
1436
|
+
</div>
|
|
1437
|
+
<div class="modal-actions">
|
|
1438
|
+
<button class="btn" onClick=\${onClose}>Cancel</button>
|
|
1439
|
+
<button class="btn btn-primary" onClick=\${handleImport}
|
|
1440
|
+
disabled=\${tab === 'mnemonic' ? !derivedAddress : !address.trim()}>
|
|
1441
|
+
Import
|
|
1442
|
+
</button>
|
|
1443
|
+
</div>
|
|
1444
|
+
</div>
|
|
1445
|
+
</div>
|
|
1446
|
+
\`;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
// --- WalletCard ---
|
|
1450
|
+
function WalletCard({ wallet, walletSyncStatus, sendMessage, onOpenImportModal, importHandlerRef }) {
|
|
1451
|
+
// Load wallets from localStorage, ensuring master wallet is always first
|
|
1452
|
+
const [wallets, setWallets] = useState(() => {
|
|
1453
|
+
const stored = loadWallets();
|
|
1454
|
+
const hasMaster = stored.some(w => w.id === 'master');
|
|
1455
|
+
if (!hasMaster) {
|
|
1456
|
+
const masterEntry = { id: 'master', publicKey: wallet.address || '', displayName: 'Master Wallet' };
|
|
1457
|
+
const all = [masterEntry, ...stored];
|
|
1458
|
+
saveWallets(all);
|
|
1459
|
+
return all;
|
|
1460
|
+
}
|
|
1461
|
+
return stored;
|
|
1462
|
+
});
|
|
1463
|
+
|
|
1464
|
+
const [selectedId, setSelectedId] = useState('master');
|
|
1465
|
+
const [editingId, setEditingId] = useState(null);
|
|
1466
|
+
const [editName, setEditName] = useState('');
|
|
1467
|
+
const [deletingId, setDeletingId] = useState(null);
|
|
1468
|
+
const [copied, setCopied] = useState(false);
|
|
1469
|
+
|
|
1470
|
+
// Keep master wallet address in sync with server state
|
|
1471
|
+
useEffect(() => {
|
|
1472
|
+
if (wallet.address) {
|
|
1473
|
+
setWallets(prev => {
|
|
1474
|
+
const updated = prev.map(w => w.id === 'master' ? { ...w, publicKey: wallet.address } : w);
|
|
1475
|
+
saveWallets(updated);
|
|
1476
|
+
return updated;
|
|
1477
|
+
});
|
|
1478
|
+
}
|
|
1479
|
+
}, [wallet.address]);
|
|
1480
|
+
|
|
1481
|
+
const selectedWallet = useMemo(() => {
|
|
1482
|
+
return wallets.find(w => w.id === selectedId) || wallets[0] || null;
|
|
1483
|
+
}, [wallets, selectedId]);
|
|
1484
|
+
|
|
1485
|
+
const isMaster = selectedWallet && selectedWallet.id === 'master';
|
|
1486
|
+
|
|
1487
|
+
const handleImportWallet = useCallback((newWallet) => {
|
|
1488
|
+
setWallets(prev => {
|
|
1489
|
+
const updated = [...prev, newWallet];
|
|
1490
|
+
saveWallets(updated);
|
|
1491
|
+
return updated;
|
|
1492
|
+
});
|
|
1493
|
+
setSelectedId(newWallet.id);
|
|
1494
|
+
}, []);
|
|
1495
|
+
|
|
1496
|
+
// Expose import handler to parent via ref
|
|
1497
|
+
useEffect(() => {
|
|
1498
|
+
if (importHandlerRef) importHandlerRef.current = handleImportWallet;
|
|
1499
|
+
}, [importHandlerRef, handleImportWallet]);
|
|
1500
|
+
|
|
1501
|
+
const handleStartEdit = useCallback((w) => {
|
|
1502
|
+
setEditingId(w.id);
|
|
1503
|
+
setEditName(w.displayName);
|
|
1504
|
+
}, []);
|
|
1505
|
+
|
|
1506
|
+
const handleSaveEdit = useCallback(() => {
|
|
1507
|
+
if (!editingId) return;
|
|
1508
|
+
setWallets(prev => {
|
|
1509
|
+
const updated = prev.map(w => w.id === editingId ? { ...w, displayName: editName.trim() || w.displayName } : w);
|
|
1510
|
+
saveWallets(updated);
|
|
1511
|
+
return updated;
|
|
1512
|
+
});
|
|
1513
|
+
setEditingId(null);
|
|
1514
|
+
}, [editingId, editName]);
|
|
1515
|
+
|
|
1516
|
+
const handleDelete = useCallback((id) => {
|
|
1517
|
+
setWallets(prev => {
|
|
1518
|
+
const updated = prev.filter(w => w.id !== id);
|
|
1519
|
+
saveWallets(updated);
|
|
1520
|
+
return updated;
|
|
1521
|
+
});
|
|
1522
|
+
setDeletingId(null);
|
|
1523
|
+
if (selectedId === id) setSelectedId('master');
|
|
1524
|
+
}, [selectedId]);
|
|
1525
|
+
|
|
1526
|
+
const handleCopy = useCallback((text) => {
|
|
1527
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
1528
|
+
setCopied(true);
|
|
1529
|
+
setTimeout(() => setCopied(false), 1500);
|
|
1530
|
+
}).catch(() => {});
|
|
1531
|
+
}, []);
|
|
1532
|
+
|
|
1533
|
+
const showBalances = isMaster && walletSyncStatus !== 'syncing';
|
|
1534
|
+
const displayAddress = selectedWallet ? selectedWallet.publicKey : null;
|
|
1535
|
+
|
|
1536
|
+
return html\`
|
|
1537
|
+
<div class="card full-width fade-in \${walletSyncStatus === 'syncing' ? 'sync-glow' : ''}" style="animation-delay: 450ms">
|
|
1538
|
+
<div class="card-header">
|
|
1539
|
+
<div class="card-title">
|
|
1540
|
+
\${icons.wallet}
|
|
1541
|
+
Wallet
|
|
1542
|
+
\${walletSyncStatus === 'syncing' ? html\`
|
|
1543
|
+
<span class="sync-indicator">
|
|
1544
|
+
<span class="sync-spinner"></span>
|
|
1545
|
+
Syncing...
|
|
1546
|
+
</span>
|
|
1547
|
+
\` : null}
|
|
1548
|
+
</div>
|
|
1549
|
+
<span class="card-health-dot \${wallet.connected ? 'healthy' : 'unhealthy'}"></span>
|
|
1550
|
+
</div>
|
|
1551
|
+
|
|
1552
|
+
<div class="wallet-header-row">
|
|
1553
|
+
<div class="wallet-selector">
|
|
1554
|
+
\${editingId === (selectedWallet && selectedWallet.id) ? html\`
|
|
1555
|
+
<input class="inline-edit-input" type="text" value=\${editName}
|
|
1556
|
+
onInput=\${e => setEditName(e.target.value)}
|
|
1557
|
+
onBlur=\${handleSaveEdit}
|
|
1558
|
+
onKeyDown=\${e => { if (e.key === 'Enter') handleSaveEdit(); if (e.key === 'Escape') setEditingId(null); }}
|
|
1559
|
+
autofocus />
|
|
1560
|
+
\` : html\`
|
|
1561
|
+
<select class="wallet-select" value=\${selectedId}
|
|
1562
|
+
onChange=\${e => { setSelectedId(e.target.value); setDeletingId(null); }}>
|
|
1563
|
+
\${wallets.map(w => html\`
|
|
1564
|
+
<option key=\${w.id} value=\${w.id}>\${w.displayName}</option>
|
|
1565
|
+
\`)}
|
|
1566
|
+
</select>
|
|
1567
|
+
\`}
|
|
1568
|
+
<button class="icon-btn" title="Rename wallet" onClick=\${() => selectedWallet && handleStartEdit(selectedWallet)}>
|
|
1569
|
+
\${icons.pencil}
|
|
1570
|
+
</button>
|
|
1571
|
+
\${selectedWallet && selectedWallet.id !== 'master' ? html\`
|
|
1572
|
+
<button class="icon-btn danger" title="Delete wallet" onClick=\${() => setDeletingId(selectedWallet.id)}>
|
|
1573
|
+
\${icons.trash}
|
|
1574
|
+
</button>
|
|
1575
|
+
\` : null}
|
|
1576
|
+
</div>
|
|
1577
|
+
<button class="btn" onClick=\${onOpenImportModal}>
|
|
1578
|
+
\${icons.plus} Import
|
|
1579
|
+
</button>
|
|
1580
|
+
</div>
|
|
1581
|
+
|
|
1582
|
+
\${deletingId ? html\`
|
|
1583
|
+
<div class="confirm-delete">
|
|
1584
|
+
<span>Delete this wallet?</span>
|
|
1585
|
+
<button class="btn btn-danger" onClick=\${() => handleDelete(deletingId)}>Yes, delete</button>
|
|
1586
|
+
<button class="btn" onClick=\${() => setDeletingId(null)}>Cancel</button>
|
|
1587
|
+
</div>
|
|
1588
|
+
\` : null}
|
|
1589
|
+
|
|
1590
|
+
<div class="wallet-grid">
|
|
1591
|
+
<div class="wallet-address">
|
|
1592
|
+
<div class="wallet-address-row">
|
|
1593
|
+
<span class="mono" title=\${displayAddress || ''} style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;">
|
|
1594
|
+
\${displayAddress ? truncateAddress(displayAddress) : 'No wallet connected'}
|
|
1595
|
+
</span>
|
|
1596
|
+
\${displayAddress ? html\`
|
|
1597
|
+
<button class="copy-btn \${copied ? 'copied' : ''}" onClick=\${() => handleCopy(displayAddress)}>
|
|
1598
|
+
\${icons.copy}
|
|
1599
|
+
\${copied ? 'Copied!' : 'Copy'}
|
|
1600
|
+
</button>
|
|
1601
|
+
\` : null}
|
|
1602
|
+
</div>
|
|
1603
|
+
</div>
|
|
1604
|
+
\${showBalances ? html\`
|
|
1605
|
+
<div class="balance-item">
|
|
1606
|
+
<div class="balance-value">\${formatBalance(wallet.unshielded)}</div>
|
|
1607
|
+
<div class="balance-label">NIGHT (Unshielded)</div>
|
|
1608
|
+
</div>
|
|
1609
|
+
<div class="balance-item">
|
|
1610
|
+
<div class="balance-value">\${formatBalance(wallet.shielded)}</div>
|
|
1611
|
+
<div class="balance-label">NIGHT (Shielded)</div>
|
|
1612
|
+
</div>
|
|
1613
|
+
<div class="balance-item">
|
|
1614
|
+
<div class="balance-value">\${formatBalance(wallet.dust)}</div>
|
|
1615
|
+
<div class="balance-label">DUST</div>
|
|
1616
|
+
</div>
|
|
1617
|
+
\` : isMaster && walletSyncStatus === 'syncing' ? html\`
|
|
1618
|
+
<div class="balance-item" style="grid-column: 1 / -1; text-align: center;">
|
|
1619
|
+
<div class="sync-indicator" style="justify-content: center;">
|
|
1620
|
+
<span class="sync-spinner"></span>
|
|
1621
|
+
Syncing balances...
|
|
1622
|
+
</div>
|
|
1623
|
+
</div>
|
|
1624
|
+
\` : !isMaster ? html\`
|
|
1625
|
+
<div class="balance-item" style="grid-column: 1 / -1; text-align: center;">
|
|
1626
|
+
<div style="font-size: 13px; color: var(--mn-text-muted); padding: 8px 0;">
|
|
1627
|
+
\${selectedWallet && selectedWallet.hasMnemonic ? 'Derived address — balances not available' : 'Address only — balances not available'}
|
|
1628
|
+
</div>
|
|
1629
|
+
</div>
|
|
1630
|
+
\` : null}
|
|
1631
|
+
</div>
|
|
1632
|
+
</div>
|
|
1633
|
+
|
|
1634
|
+
\`;
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
// --- Sparkline ---
|
|
1638
|
+
function Sparkline({ data, color, width, height }) {
|
|
1639
|
+
if (!data || data.length < 2) {
|
|
1640
|
+
return html\`<svg class="sparkline-svg" viewBox="0 0 \${width} \${height}" preserveAspectRatio="none">
|
|
1641
|
+
<line x1="0" y1=\${height / 2} x2=\${width} y2=\${height / 2} stroke="var(--mn-border)" stroke-width="1" />
|
|
1642
|
+
</svg>\`;
|
|
1643
|
+
}
|
|
1644
|
+
const max = Math.max(...data, 1);
|
|
1645
|
+
const min = Math.min(...data, 0);
|
|
1646
|
+
const range = max - min || 1;
|
|
1647
|
+
const step = width / (data.length - 1);
|
|
1648
|
+
const points = data.map((v, i) => {
|
|
1649
|
+
const x = i * step;
|
|
1650
|
+
const y = height - ((v - min) / range) * (height - 4) - 2;
|
|
1651
|
+
return x.toFixed(1) + ',' + y.toFixed(1);
|
|
1652
|
+
}).join(' ');
|
|
1653
|
+
|
|
1654
|
+
return html\`
|
|
1655
|
+
<svg class="sparkline-svg" viewBox="0 0 \${width} \${height}" preserveAspectRatio="none">
|
|
1656
|
+
<polyline points=\${points} fill="none" stroke=\${color} stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
|
|
1657
|
+
</svg>
|
|
1658
|
+
\`;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
// --- ResponseChart ---
|
|
1662
|
+
function ResponseChart({ health }) {
|
|
1663
|
+
const lastVal = (arr) => arr.length > 0 ? formatMs(arr[arr.length - 1]) : '--';
|
|
1664
|
+
return html\`
|
|
1665
|
+
<div class="card full-width chart-section fade-in" style="animation-delay: 600ms">
|
|
1666
|
+
<div class="card-header">
|
|
1667
|
+
<div class="card-title">
|
|
1668
|
+
\${icons.activity}
|
|
1669
|
+
Response Times
|
|
1670
|
+
</div>
|
|
1671
|
+
</div>
|
|
1672
|
+
<div class="sparkline-row">
|
|
1673
|
+
<span class="sparkline-label">Node</span>
|
|
1674
|
+
<\${Sparkline} data=\${health.node.history} color="var(--mn-accent)" width=\${400} height=\${32} />
|
|
1675
|
+
<span class="sparkline-value">\${lastVal(health.node.history)}</span>
|
|
1676
|
+
</div>
|
|
1677
|
+
<div class="sparkline-row">
|
|
1678
|
+
<span class="sparkline-label">Indexer</span>
|
|
1679
|
+
<\${Sparkline} data=\${health.indexer.history} color="#6b3bff" width=\${400} height=\${32} />
|
|
1680
|
+
<span class="sparkline-value">\${lastVal(health.indexer.history)}</span>
|
|
1681
|
+
</div>
|
|
1682
|
+
<div class="sparkline-row">
|
|
1683
|
+
<span class="sparkline-label">Proof Server</span>
|
|
1684
|
+
<\${Sparkline} data=\${health.proofServer.history} color="#9b3bff" width=\${400} height=\${32} />
|
|
1685
|
+
<span class="sparkline-value">\${lastVal(health.proofServer.history)}</span>
|
|
1686
|
+
</div>
|
|
1687
|
+
</div>
|
|
1688
|
+
\`;
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
// --- LogViewer ---
|
|
1692
|
+
function LogViewer({ logs }) {
|
|
1693
|
+
const [serviceFilter, setServiceFilter] = useState('all');
|
|
1694
|
+
const [levelFilter, setLevelFilter] = useState('all');
|
|
1695
|
+
const [searchText, setSearchText] = useState('');
|
|
1696
|
+
const [pinBottom, setPinBottom] = useState(true);
|
|
1697
|
+
const entriesRef = useRef(null);
|
|
1698
|
+
|
|
1699
|
+
const filteredLogs = logs.filter(log => {
|
|
1700
|
+
if (serviceFilter !== 'all' && log.service !== serviceFilter) return false;
|
|
1701
|
+
if (levelFilter !== 'all' && log.level !== levelFilter) return false;
|
|
1702
|
+
if (searchText && !log.message.toLowerCase().includes(searchText.toLowerCase()) && !(log.raw || '').toLowerCase().includes(searchText.toLowerCase())) return false;
|
|
1703
|
+
return true;
|
|
1704
|
+
});
|
|
1705
|
+
|
|
1706
|
+
useEffect(() => {
|
|
1707
|
+
if (pinBottom && entriesRef.current) {
|
|
1708
|
+
entriesRef.current.scrollTop = entriesRef.current.scrollHeight;
|
|
1709
|
+
}
|
|
1710
|
+
}, [filteredLogs.length, pinBottom]);
|
|
1711
|
+
|
|
1712
|
+
const handleScroll = useCallback((e) => {
|
|
1713
|
+
const el = e.target;
|
|
1714
|
+
const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 40;
|
|
1715
|
+
setPinBottom(atBottom);
|
|
1716
|
+
}, []);
|
|
1717
|
+
|
|
1718
|
+
return html\`
|
|
1719
|
+
<div class="log-viewer fade-in" style="animation-delay: 750ms">
|
|
1720
|
+
<div class="log-toolbar">
|
|
1721
|
+
\${icons.terminal}
|
|
1722
|
+
<select class="log-select" value=\${serviceFilter} onChange=\${e => setServiceFilter(e.target.value)}>
|
|
1723
|
+
<option value="all">All Services</option>
|
|
1724
|
+
<option value="node">Node</option>
|
|
1725
|
+
<option value="indexer">Indexer</option>
|
|
1726
|
+
<option value="proof-server">Proof Server</option>
|
|
1727
|
+
</select>
|
|
1728
|
+
<select class="log-select" value=\${levelFilter} onChange=\${e => setLevelFilter(e.target.value)}>
|
|
1729
|
+
<option value="all">All Levels</option>
|
|
1730
|
+
<option value="info">Info</option>
|
|
1731
|
+
<option value="warn">Warning</option>
|
|
1732
|
+
<option value="error">Error</option>
|
|
1733
|
+
</select>
|
|
1734
|
+
<input class="log-search" type="text" placeholder="Search logs..." value=\${searchText} onInput=\${e => setSearchText(e.target.value)} />
|
|
1735
|
+
</div>
|
|
1736
|
+
<div class="log-entries" ref=\${entriesRef} onScroll=\${handleScroll}>
|
|
1737
|
+
\${filteredLogs.map((log, i) => html\`
|
|
1738
|
+
<div class="log-line" key=\${log.service + '-' + i + '-' + (log.message || '').slice(0, 20)}>
|
|
1739
|
+
<span class="log-tag \${(log.service || '').replace('-', '')}">\${log.service || 'sys'}</span>
|
|
1740
|
+
<span class="log-level \${log.level}">\${(log.level || 'info').toUpperCase()}</span>
|
|
1741
|
+
<span class="log-message">\${log.message || log.raw || ''}</span>
|
|
1742
|
+
</div>
|
|
1743
|
+
\`)}
|
|
1744
|
+
\${filteredLogs.length === 0 && html\`
|
|
1745
|
+
<div class="log-line"><span class="log-message" style="color: var(--mn-text-muted)">No log entries</span></div>
|
|
1746
|
+
\`}
|
|
1747
|
+
</div>
|
|
1748
|
+
</div>
|
|
1749
|
+
\`;
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
// --- App ---
|
|
1753
|
+
function App() {
|
|
1754
|
+
const [state, setState] = useState(defaultState);
|
|
1755
|
+
const [connected, setConnected] = useState(false);
|
|
1756
|
+
const [toasts, setToasts] = useState([]);
|
|
1757
|
+
const wsRef = useRef(null);
|
|
1758
|
+
const reconnectTimer = useRef(null);
|
|
1759
|
+
const backoff = useRef(1000);
|
|
1760
|
+
const toastId = useRef(0);
|
|
1761
|
+
|
|
1762
|
+
const addToast = useCallback((message, type) => {
|
|
1763
|
+
const id = ++toastId.current;
|
|
1764
|
+
setToasts(prev => [...prev, { id, message, type, fading: false }]);
|
|
1765
|
+
setTimeout(() => {
|
|
1766
|
+
setToasts(prev => prev.map(t => t.id === id ? { ...t, fading: true } : t));
|
|
1767
|
+
}, 2700);
|
|
1768
|
+
setTimeout(() => {
|
|
1769
|
+
setToasts(prev => prev.filter(t => t.id !== id));
|
|
1770
|
+
}, 3000);
|
|
1771
|
+
}, []);
|
|
1772
|
+
|
|
1773
|
+
const removeToast = useCallback((id) => {
|
|
1774
|
+
setToasts(prev => prev.filter(t => t.id !== id));
|
|
1775
|
+
}, []);
|
|
1776
|
+
|
|
1777
|
+
const sendCommand = useCallback((action) => {
|
|
1778
|
+
if (wsRef.current && wsRef.current.readyState === WebSocket.OPEN) {
|
|
1779
|
+
wsRef.current.send(JSON.stringify({ type: 'command', action }));
|
|
1780
|
+
}
|
|
1781
|
+
}, []);
|
|
1782
|
+
|
|
1783
|
+
const sendMessage = useCallback((msg) => {
|
|
1784
|
+
if (wsRef.current && wsRef.current.readyState === WebSocket.OPEN) {
|
|
1785
|
+
wsRef.current.send(JSON.stringify(msg));
|
|
1786
|
+
}
|
|
1787
|
+
}, []);
|
|
1788
|
+
|
|
1789
|
+
const [deriveResult, setDeriveResult] = useState(null);
|
|
1790
|
+
const [showImportModal, setShowImportModal] = useState(false);
|
|
1791
|
+
const importHandlerRef = useRef(null);
|
|
1792
|
+
|
|
1793
|
+
useEffect(() => {
|
|
1794
|
+
function connect() {
|
|
1795
|
+
const ws = new WebSocket(WS_URL);
|
|
1796
|
+
wsRef.current = ws;
|
|
1797
|
+
|
|
1798
|
+
ws.addEventListener('open', () => {
|
|
1799
|
+
setConnected(true);
|
|
1800
|
+
backoff.current = 1000;
|
|
1801
|
+
// Auto-sync wallet on first connect
|
|
1802
|
+
ws.send(JSON.stringify({ type: 'command', action: 'sync-wallet' }));
|
|
1803
|
+
});
|
|
1804
|
+
|
|
1805
|
+
ws.addEventListener('message', (event) => {
|
|
1806
|
+
try {
|
|
1807
|
+
const msg = JSON.parse(event.data);
|
|
1808
|
+
if (msg.type === 'state') {
|
|
1809
|
+
setState(msg.data);
|
|
1810
|
+
} else if (msg.type === 'result') {
|
|
1811
|
+
addToast(msg.message || (msg.success ? 'Command succeeded' : 'Command failed'), msg.success ? 'success' : 'error');
|
|
1812
|
+
} else if (msg.type === 'derive-result') {
|
|
1813
|
+
setDeriveResult(msg.address || null);
|
|
1814
|
+
}
|
|
1815
|
+
} catch (e) {
|
|
1816
|
+
// ignore malformed messages
|
|
1817
|
+
}
|
|
1818
|
+
});
|
|
1819
|
+
|
|
1820
|
+
ws.addEventListener('close', () => {
|
|
1821
|
+
setConnected(false);
|
|
1822
|
+
scheduleReconnect();
|
|
1823
|
+
});
|
|
1824
|
+
|
|
1825
|
+
ws.addEventListener('error', () => {
|
|
1826
|
+
ws.close();
|
|
1827
|
+
});
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
function scheduleReconnect() {
|
|
1831
|
+
if (reconnectTimer.current) clearTimeout(reconnectTimer.current);
|
|
1832
|
+
reconnectTimer.current = setTimeout(() => {
|
|
1833
|
+
backoff.current = Math.min(backoff.current * 2, 30000);
|
|
1834
|
+
connect();
|
|
1835
|
+
}, backoff.current);
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
connect();
|
|
1839
|
+
|
|
1840
|
+
return () => {
|
|
1841
|
+
if (wsRef.current) wsRef.current.close();
|
|
1842
|
+
if (reconnectTimer.current) clearTimeout(reconnectTimer.current);
|
|
1843
|
+
};
|
|
1844
|
+
}, [addToast]);
|
|
1845
|
+
|
|
1846
|
+
return html\`
|
|
1847
|
+
<\${ConnectionStatus} connected=\${connected} />
|
|
1848
|
+
<\${ToastContainer} toasts=\${toasts} onRemove=\${removeToast} />
|
|
1849
|
+
<\${Header} networkStatus=\${state.networkStatus} onStart=\${() => sendCommand('start')} onStop=\${() => sendCommand('stop')} sendMessage=\${sendMessage} />
|
|
1850
|
+
<div class="cards-grid">
|
|
1851
|
+
<\${NodeCard} node=\${state.node} health=\${state.health.node} serverTime=\${state.serverTime} />
|
|
1852
|
+
<\${IndexerCard} indexer=\${state.indexer} health=\${state.health.indexer} serverTime=\${state.serverTime} />
|
|
1853
|
+
<\${ProofServerCard} proofServer=\${state.proofServer} health=\${state.health.proofServer} serverTime=\${state.serverTime} />
|
|
1854
|
+
</div>
|
|
1855
|
+
<div class="cards-grid">
|
|
1856
|
+
<\${WalletCard} wallet=\${state.wallet} walletSyncStatus=\${state.walletSyncStatus} sendMessage=\${sendMessage} onOpenImportModal=\${() => { setDeriveResult(null); setShowImportModal(true); }} importHandlerRef=\${importHandlerRef} />
|
|
1857
|
+
</div>
|
|
1858
|
+
<div class="cards-grid">
|
|
1859
|
+
<\${ResponseChart} health=\${state.health} />
|
|
1860
|
+
</div>
|
|
1861
|
+
<\${LogViewer} logs=\${state.logs} />
|
|
1862
|
+
\${showImportModal ? html\`
|
|
1863
|
+
<\${ImportWalletModal}
|
|
1864
|
+
onClose=\${() => setShowImportModal(false)}
|
|
1865
|
+
onImport=\${(w) => importHandlerRef.current && importHandlerRef.current(w)}
|
|
1866
|
+
sendMessage=\${sendMessage}
|
|
1867
|
+
deriveResult=\${deriveResult}
|
|
1868
|
+
/>
|
|
1869
|
+
\` : null}
|
|
1870
|
+
\`;
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
render(html\`<\${App} />\`, document.getElementById('app'));
|
|
1874
|
+
</script>
|
|
1875
|
+
|
|
1876
|
+
<!-- lucide-style icons rendered as inline SVGs above -->
|
|
1877
|
+
</body>
|
|
1878
|
+
</html>`;
|
|
1879
|
+
}
|
|
1880
|
+
//# sourceMappingURL=html.js.map
|