-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.html
More file actions
505 lines (418 loc) · 16.4 KB
/
demo.html
File metadata and controls
505 lines (418 loc) · 16.4 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>mdtail - Split Terminal Demo</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #1e1e1e;
font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
padding: 20px;
}
.terminal-container {
background: #000;
border-radius: 8px;
box-shadow: 0 20px 60px rgba(0,0,0,0.5);
overflow: hidden;
width: 1200px;
max-width: 100%;
height: 600px;
}
.terminal-header {
background: linear-gradient(#504b45 0%, #3c3b37 100%);
padding: 10px;
display: flex;
align-items: center;
}
.terminal-controls {
display: flex;
gap: 8px;
}
.terminal-control {
width: 12px;
height: 12px;
border-radius: 50%;
}
.close { background: #ff5f56; }
.minimize { background: #ffbd2e; }
.maximize { background: #27c93f; }
.terminal-title {
flex: 1;
text-align: center;
color: #ccc;
font-size: 14px;
}
.terminal-split {
display: flex;
height: calc(100% - 40px);
}
.terminal-pane {
flex: 1;
padding: 20px;
color: #d4d4d4;
font-size: 13px;
line-height: 1.6;
overflow-y: auto;
overflow-x: hidden;
position: relative;
}
.terminal-left {
border-right: 1px solid #333;
background: #0c0c0c;
}
.terminal-right {
background: #000;
}
.prompt {
color: #569cd6;
}
.command {
color: #d4d4d4;
}
.comment {
color: #608b4e;
}
.output {
color: #d4d4d4;
margin: 10px 0;
}
.border {
color: #764ba2;
font-weight: bold;
display: block;
overflow: hidden;
white-space: nowrap;
}
.border::after {
content: '══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════';
display: inline-block;
}
.divider {
color: #666;
display: block;
overflow: hidden;
white-space: nowrap;
}
.divider::after {
content: '──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────';
display: inline-block;
}
.filename {
color: #667eea;
text-align: center;
font-weight: bold;
text-transform: uppercase;
}
.content {
color: #d4d4d4;
white-space: pre-wrap;
font-family: inherit;
}
.content h1 { color: #569cd6; margin: 10px 0; }
.content h2 { color: #608b4e; margin: 10px 0; }
.content li { margin-left: 20px; }
.typing {
display: inline;
border-right: 2px solid #0f0;
animation: blink 1s infinite;
}
@keyframes blink {
0%, 50% { border-color: #0f0; }
51%, 100% { border-color: transparent; }
}
.hidden {
display: none;
}
.navigation {
color: #569cd6;
text-align: center;
margin-top: 10px;
}
.cursor {
display: inline-block;
width: 8px;
height: 16px;
background: #0f0;
animation: blink 1s infinite;
vertical-align: text-bottom;
}
.tmux-status {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: #222;
color: #fff;
padding: 2px 10px;
font-size: 12px;
display: flex;
justify-content: space-between;
}
.tmux-left {
color: #0f0;
}
.tmux-center {
color: #569cd6;
}
.tmux-right {
color: #764ba2;
}
@media (max-width: 768px) {
.terminal-split {
flex-direction: column;
}
.terminal-left {
border-right: none;
border-bottom: 1px solid #333;
}
}
</style>
</head>
<body>
<div class="terminal-container">
<div class="terminal-header">
<div class="terminal-controls">
<div class="terminal-control close"></div>
<div class="terminal-control minimize"></div>
<div class="terminal-control maximize"></div>
</div>
<div class="terminal-title">Terminal - tmux session: mdtail-demo</div>
</div>
<div class="terminal-split">
<!-- Left Pane - Command Line -->
<div class="terminal-pane terminal-left" id="left-pane">
<div id="left-content"></div>
<div class="tmux-status">
<span class="tmux-left">[0] 0:bash*</span>
<span class="tmux-center">"mdtail-demo"</span>
<span class="tmux-right">14:23</span>
</div>
</div>
<!-- Right Pane - mdtail -->
<div class="terminal-pane terminal-right" id="right-pane">
<div id="right-content"></div>
<div class="tmux-status">
<span class="tmux-left">[1] 1:mdtail</span>
<span class="tmux-center">"mdtail-demo"</span>
<span class="tmux-right">14:23</span>
</div>
</div>
</div>
</div>
<script>
async function typeText(text, element, speed = 50) {
for (let i = 0; i < text.length; i++) {
element.innerHTML += text[i];
await new Promise(r => setTimeout(r, speed));
}
}
async function runRightPane() {
const container = document.getElementById('right-content');
// Initial prompt
const prompt1 = document.createElement('span');
prompt1.className = 'prompt';
prompt1.innerHTML = '$ ';
container.appendChild(prompt1);
await new Promise(r => setTimeout(r, 500));
// Type npm install command
const npmCmd = document.createElement('span');
npmCmd.className = 'command';
container.appendChild(npmCmd);
await typeText('npm install -g mdtail', npmCmd, 60);
await new Promise(r => setTimeout(r, 500));
container.appendChild(document.createTextNode('\n'));
// Show npm installation output
const npmOutput = document.createElement('div');
npmOutput.className = 'output';
npmOutput.style.color = '#888';
npmOutput.textContent = 'added 1 package in 2s';
container.appendChild(npmOutput);
await new Promise(r => setTimeout(r, 1000));
// Second prompt - no extra newline
const prompt2 = document.createElement('span');
prompt2.className = 'prompt';
prompt2.innerHTML = '$ ';
container.appendChild(prompt2);
await new Promise(r => setTimeout(r, 500));
// Type mdtail command
const mdtailCmd = document.createElement('span');
mdtailCmd.className = 'command';
container.appendChild(mdtailCmd);
await typeText('mdtail *.md', mdtailCmd, 60);
await new Promise(r => setTimeout(r, 500));
container.appendChild(document.createTextNode('\n\n'));
// Show mdtail output with tabs
showMdtailOutput();
}
function showMdtailOutput() {
const container = document.getElementById('right-content');
const mdtailOutput = document.createElement('div');
mdtailOutput.innerHTML = `
<span class="border"></span>
<div style="color: #d4d4d4; padding: 2px 0;">
<span style="font-weight: bold; color: #fff;">[README.md]</span> │ TODO.md
</div>
<span class="divider"></span>
<div class="content" id="mdtail-content"># My Project
A simple demo application showcasing mdtail functionality.
## Quick Start
1. Install dependencies: npm install
2. Run the app: npm start
3. View docs: mdtail *.md
## Features
- Live markdown preview
- File watching
- Tab navigation</div>
<span class="border"></span>
<div class="navigation">Tab 1 of 2 │ ← → Navigate │ Ctrl+C Exit</div>`;
container.appendChild(mdtailOutput);
// Simulate switching to TODO.md after 3 seconds
setTimeout(() => {
mdtailOutput.innerHTML = `
<span class="border"></span>
<div style="color: #d4d4d4; padding: 2px 0;">
README.md │ <span style="font-weight: bold; color: #fff;">[TODO.md]</span>
</div>
<span class="divider"></span>
<div class="content" id="mdtail-content"># TODO List
## This Week
- [x] Setup project
- [x] Write documentation
- [ ] Add tests
- [ ] Deploy to production
## Next Sprint
- [ ] User authentication
- [ ] API integration
- [ ] Performance optimization</div>
<span class="border"></span>
<div class="navigation">Tab 2 of 2 │ ← → Navigate │ Ctrl+C Exit</div>`;
// Simulate live update when Claude edits TODO.md
// This happens after Claude shows "✓ Updated TODO.md"
// Timing: 10s wait + typing + response + tests = ~14s total
setTimeout(() => {
// Flash effect to show file changed
mdtailOutput.style.opacity = '0.7';
setTimeout(() => {
mdtailOutput.style.opacity = '1';
mdtailOutput.innerHTML = `
<span class="border"></span>
<div style="color: #d4d4d4; padding: 2px 0;">
README.md │ <span style="font-weight: bold; color: #fff;">[TODO.md]</span>
</div>
<span class="divider"></span>
<div class="content" id="mdtail-content"># TODO List
## This Week
- [x] Setup project
- [x] Write documentation
- [x] Add tests
- [ ] Deploy to production
## Next Sprint
- [ ] User authentication
- [ ] API integration
- [ ] Performance optimization</div>
<span class="border"></span>
<div class="navigation" style="color: #27c93f;">File updated • Tab 2 of 2 │ ← → Navigate │ Ctrl+C Exit</div>`;
}, 100);
}, 11000); // Update TODO.md after Claude shows "✓ Updated TODO.md" message
}, 3000);
}
async function runLeftPane() {
const container = document.getElementById('left-content');
// Show previous Claude command already executed
const prevPrompt = document.createElement('span');
prevPrompt.className = 'prompt';
prevPrompt.innerHTML = '$ ';
container.appendChild(prevPrompt);
const prevCmd = document.createElement('span');
prevCmd.className = 'command';
prevCmd.textContent = 'claude';
container.appendChild(prevCmd);
container.appendChild(document.createTextNode('\n'));
// Claude welcome message
const welcomeMsg = document.createElement('div');
welcomeMsg.style.color = '#569cd6';
welcomeMsg.innerHTML = 'Claude Code v1.0.1\n';
container.appendChild(welcomeMsg);
const sessionMsg = document.createElement('div');
sessionMsg.style.color = '#888';
sessionMsg.innerHTML = 'Starting new session...\n\n';
container.appendChild(sessionMsg);
// Show Claude prompt
const claudePrompt = document.createElement('span');
claudePrompt.style.color = '#764ba2';
claudePrompt.innerHTML = '🤖 ';
container.appendChild(claudePrompt);
const cursor1 = document.createElement('span');
cursor1.className = 'cursor';
container.appendChild(cursor1);
// Wait for mdtail to start and switch to TODO.md
// Initial: 0.5s + npm typing: 1.3s + wait: 0.5s + npm output wait: 1s +
// mdtail typing: 0.7s + wait: 0.5s + switch to TODO: 3s = ~7.5s
// Adding buffer to ensure TODO.md is fully displayed
await new Promise(r => setTimeout(r, 10000));
// Remove cursor and type claude command
cursor1.remove();
const claudeCmd = document.createElement('span');
claudeCmd.className = 'command';
container.appendChild(claudeCmd);
await typeText('add tests for the new feature and update TODO.md', claudeCmd, 50);
await new Promise(r => setTimeout(r, 500));
container.appendChild(document.createTextNode('\n\n'));
// Claude response
const claudeOutput = document.createElement('div');
claudeOutput.className = 'output';
claudeOutput.style.color = '#d4d4d4';
claudeOutput.innerHTML = 'I\'ll add tests for the new feature and update the TODO list.\n\n';
container.appendChild(claudeOutput);
await new Promise(r => setTimeout(r, 1000));
// Show creating test file
const createTest = document.createElement('div');
createTest.style.color = '#608b4e';
createTest.innerHTML = '✓ Created test/feature.test.js\n\n';
container.appendChild(createTest);
await new Promise(r => setTimeout(r, 500));
// Running tests
const runningTests = document.createElement('div');
runningTests.style.color = '#888';
runningTests.innerHTML = 'Running tests...\n';
container.appendChild(runningTests);
await new Promise(r => setTimeout(r, 1500));
// Test results
const testResults = document.createElement('div');
testResults.style.color = '#27c93f';
testResults.innerHTML = 'PASS test/feature.test.js\n✓ 15 tests passed\n\n';
container.appendChild(testResults);
await new Promise(r => setTimeout(r, 500));
// Update TODO.md after tests pass
const updateTodo = document.createElement('div');
updateTodo.style.color = '#608b4e';
updateTodo.innerHTML = '✓ Updated TODO.md\n\n';
container.appendChild(updateTodo);
// New Claude prompt
const claudePrompt2 = document.createElement('span');
claudePrompt2.style.color = '#764ba2';
claudePrompt2.innerHTML = '🤖 ';
container.appendChild(claudePrompt2);
// Add blinking cursor
const cursor = document.createElement('span');
cursor.className = 'cursor';
container.appendChild(cursor);
}
// Start the demo
window.addEventListener('load', () => {
runLeftPane();
runRightPane();
});
</script>
</body>
</html>