feat(landing): add animated fake UI demo with tool call visualization

Replaces the screenshot placeholder with a live animated demo showing:
- Sidebar with fake sessions and token usage bars
- User typing animation with cursor
- Thinking indicator with animated dots
- Colored tool call badges (web_search, exec)
- Expandable tool results with parameters
- Formatted assistant response with markdown
- Auto-looping animation

All pure CSS/JS, no dependencies. Matches the app's dark theme and color scheme.

Closes feedback item #12
This commit is contained in:
Nicolas Varrot
2026-02-11 19:16:52 +00:00
parent 195ad621f7
commit d26c4988f2
2 changed files with 346 additions and 3 deletions

View File

@@ -328,15 +328,339 @@
</div>
</section>
<section class="screenshot-section">
<section class="demo-section">
<div class="container">
<h2>See it in Action</h2>
<div class="screenshot-placeholder">
📸 Screenshots coming soon — <a href="https://github.com/MarlBurroW/pinchchat/issues" style="color: var(--accent-cyan);">contributions welcome</a>!
<p style="text-align:center;color:var(--text-secondary);margin-bottom:2rem;font-size:0.95rem;">Watch the agent think, call tools, and respond — all in real-time.</p>
<div class="demo-window">
<!-- Sidebar -->
<div class="demo-sidebar">
<div class="demo-sidebar-header">
<img src="https://raw.githubusercontent.com/MarlBurroW/pinchchat/main/public/logo.png" alt="" class="demo-sidebar-logo" />
<span>PinchChat</span>
</div>
<div class="demo-session demo-session-active">
<div class="demo-session-name">🏠 Main Session</div>
<div class="demo-token-bar"><div class="demo-token-fill" style="width:42%"></div></div>
</div>
<div class="demo-session">
<div class="demo-session-name">⏰ Daily AI Watch</div>
<div class="demo-token-bar"><div class="demo-token-fill demo-token-low" style="width:18%"></div></div>
</div>
<div class="demo-session">
<div class="demo-session-name">🔧 PinchChat Improve</div>
<div class="demo-token-bar"><div class="demo-token-fill" style="width:67%"></div></div>
</div>
<div class="demo-session">
<div class="demo-session-name">📧 Email Check</div>
<div class="demo-token-bar"><div class="demo-token-fill demo-token-low" style="width:8%"></div></div>
</div>
</div>
<!-- Chat area -->
<div class="demo-chat">
<div class="demo-chat-scroll" id="demo-chat-area">
<!-- Messages injected by JS -->
</div>
<div class="demo-input">
<div class="demo-input-box" id="demo-input-text"></div>
<div class="demo-send-btn"></div>
</div>
</div>
</div>
</div>
</section>
<style>
.demo-section { padding: 3rem 0 4rem; }
.demo-section h2 { text-align: center; font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; }
.demo-window {
display: flex;
border: 1px solid var(--border);
border-radius: 1rem;
overflow: hidden;
height: 420px;
background: var(--bg-secondary);
box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
/* Sidebar */
.demo-sidebar {
width: 220px;
min-width: 220px;
background: #0d0d14;
border-right: 1px solid var(--border);
padding: 0.75rem;
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.demo-sidebar-header {
display: flex; align-items: center; gap: 0.5rem;
font-weight: 700; font-size: 0.95rem; padding: 0.5rem 0.25rem 0.75rem;
color: var(--text-primary);
}
.demo-sidebar-logo { width: 22px; height: 22px; border-radius: 4px; }
.demo-session {
padding: 0.5rem 0.6rem;
border-radius: 0.5rem;
cursor: default;
transition: background 0.15s;
}
.demo-session-active { background: rgba(34,211,238,0.08); }
.demo-session-name { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.demo-session-active .demo-session-name { color: var(--text-primary); }
.demo-token-bar {
height: 3px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden;
}
.demo-token-fill { height: 100%; background: var(--accent-cyan); border-radius: 2px; transition: width 1s ease; }
.demo-token-low { background: #4ade80; }
/* Chat */
.demo-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.demo-chat-scroll { flex: 1; overflow-y: auto; padding: 1.25rem 1.25rem 0.5rem; display: flex; flex-direction: column; gap: 1rem; }
.demo-input {
display: flex; align-items: center; gap: 0.5rem;
padding: 0.75rem 1rem;
border-top: 1px solid var(--border);
}
.demo-input-box {
flex: 1; background: rgba(255,255,255,0.04); border: 1px solid var(--border);
border-radius: 0.5rem; padding: 0.5rem 0.75rem;
font-size: 0.85rem; color: var(--text-primary); min-height: 34px;
font-family: inherit;
}
.demo-send-btn {
width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
border-radius: 0.5rem; color: var(--bg-primary); font-size: 1rem; cursor: default;
}
/* Messages */
.demo-msg { display: flex; gap: 0.6rem; animation: msgIn 0.3s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.demo-avatar {
width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
font-size: 0.75rem; flex-shrink: 0; margin-top: 2px;
}
.demo-avatar-user { background: rgba(34,211,238,0.15); color: var(--accent-cyan); }
.demo-avatar-bot { background: rgba(167,139,250,0.15); color: var(--accent-purple); }
.demo-msg-body { flex: 1; min-width: 0; }
.demo-msg-role { font-size: 0.7rem; color: var(--text-secondary); margin-bottom: 0.15rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.demo-msg-text { font-size: 0.85rem; line-height: 1.55; color: var(--text-primary); }
.demo-msg-text code { background: rgba(255,255,255,0.06); padding: 0.1em 0.35em; border-radius: 3px; font-size: 0.8rem; font-family: 'SF Mono','Fira Code',monospace; }
/* Thinking */
.demo-thinking {
display: inline-flex; align-items: center; gap: 0.4rem;
font-size: 0.78rem; color: var(--accent-purple); padding: 0.3rem 0;
}
.demo-thinking-dots span {
display: inline-block; width: 4px; height: 4px; background: var(--accent-purple);
border-radius: 50%; animation: blink 1.2s infinite;
}
.demo-thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.demo-thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100% { opacity: 0.2; } 40% { opacity: 1; } }
/* Tool calls */
.demo-tool {
display: inline-flex; align-items: center; gap: 0.35rem;
padding: 0.2rem 0.55rem; border-radius: 0.375rem; font-size: 0.75rem; font-weight: 500;
border: 1px solid; margin: 0.2rem 0.3rem 0.2rem 0; cursor: default;
transition: all 0.2s;
}
.demo-tool-exec { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.1); color: #fcd34d; }
.demo-tool-read { border-color: rgba(14,165,233,0.3); background: rgba(14,165,233,0.1); color: #7dd3fc; }
.demo-tool-web { border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.1); color: #6ee7b7; }
.demo-tool-edit { border-color: rgba(139,92,246,0.3); background: rgba(139,92,246,0.1); color: #c4b5fd; }
.demo-tool-memory { border-color: rgba(244,63,94,0.3); background: rgba(244,63,94,0.1); color: #fda4af; }
.demo-tool-expand {
margin: 0.2rem 0 0.3rem;
border: 1px solid rgba(255,255,255,0.06);
border-radius: 0.5rem;
background: rgba(255,255,255,0.02);
font-size: 0.73rem;
overflow: hidden;
animation: expandIn 0.3s ease;
}
@keyframes expandIn { from { opacity:0; max-height:0; } to { opacity:1; max-height:200px; } }
.demo-tool-expand-header {
padding: 0.35rem 0.6rem;
color: var(--text-secondary);
font-weight: 600;
border-bottom: 1px solid rgba(255,255,255,0.04);
}
.demo-tool-expand-body {
padding: 0.35rem 0.6rem;
color: var(--text-secondary);
font-family: 'SF Mono','Fira Code',monospace;
font-size: 0.7rem;
white-space: pre-wrap;
max-height: 80px;
overflow: hidden;
}
/* Typing cursor */
.demo-cursor { display: inline-block; width: 2px; height: 1em; background: var(--accent-cyan); animation: cursorBlink 0.8s step-end infinite; vertical-align: text-bottom; margin-left: 1px; }
@keyframes cursorBlink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
/* Responsive: hide sidebar on small screens */
@media (max-width: 640px) {
.demo-sidebar { display: none; }
.demo-window { height: 380px; }
}
</style>
<script>
(function() {
const chat = document.getElementById('demo-chat-area');
const input = document.getElementById('demo-input-text');
// Scenario timeline
const scenario = [
{ type: 'input-type', text: 'What\'s the weather in Grenoble and check my latest emails?', delay: 0 },
{ type: 'input-send', delay: 800 },
{ type: 'user-msg', text: 'What\'s the weather in Grenoble and check my latest emails?', delay: 200 },
{ type: 'thinking', delay: 400 },
{ type: 'tool-badge', name: 'web_search', cls: 'demo-tool-web', icon: '🌐', label: 'web_search', delay: 800 },
{ type: 'tool-expand', tool: 'web_search', params: '{ "query": "weather Grenoble today" }', result: '☀️ Grenoble: 14°C, partly cloudy\nWind: 12 km/h NW · Humidity: 58%\nForecast: Clear evening, 8°C overnight', delay: 600 },
{ type: 'tool-badge', name: 'exec', cls: 'demo-tool-exec', icon: '⚡', label: 'exec', delay: 500 },
{ type: 'tool-expand', tool: 'exec', params: '{ "command": "gmail unread 3" }', result: '1. [Urgent] Deploy review needed — team@fasst.io\n2. Charlotte\'s school — photo day reminder\n3. Newsletter — This Week in AI', delay: 700 },
{ type: 'remove-thinking', delay: 100 },
{ type: 'assistant-msg', html: 'Here\'s your update:<br><br>🌤️ <strong>Grenoble</strong> — 14°C, partly cloudy. Clear evening ahead (8°C tonight).<br><br>📧 <strong>3 unread emails:</strong><br>1. <code>[Urgent]</code> Deploy review needed — from team@fasst.io<br>2. Charlotte\'s school — photo day reminder 📸<br>3. Newsletter — This Week in AI<br><br>Want me to open any of these?', delay: 200 },
{ type: 'pause', delay: 4000 },
{ type: 'reset', delay: 0 },
];
let thinkingEl = null;
let toolArea = null;
let currentBotMsg = null;
function scrollDown() {
chat.scrollTop = chat.scrollHeight;
}
function typeText(el, text, cb) {
let i = 0;
el.textContent = '';
const cursor = document.createElement('span');
cursor.className = 'demo-cursor';
el.appendChild(cursor);
const iv = setInterval(() => {
if (i < text.length) {
el.insertBefore(document.createTextNode(text[i]), cursor);
i++;
} else {
clearInterval(iv);
if (cursor.parentNode) cursor.remove();
if (cb) cb();
}
}, 28);
}
function createBotMsg() {
const msg = document.createElement('div');
msg.className = 'demo-msg';
msg.innerHTML = '<div class="demo-avatar demo-avatar-bot">🤖</div><div class="demo-msg-body"><div class="demo-msg-role">Assistant</div></div>';
chat.appendChild(msg);
currentBotMsg = msg.querySelector('.demo-msg-body');
toolArea = document.createElement('div');
currentBotMsg.appendChild(toolArea);
scrollDown();
return currentBotMsg;
}
function runStep(idx) {
if (idx >= scenario.length) return;
const step = scenario[idx];
const next = () => setTimeout(() => runStep(idx + 1), scenario[idx + 1]?.delay || 0);
switch (step.type) {
case 'input-type':
typeText(input, step.text, next);
break;
case 'input-send':
input.textContent = '';
next();
break;
case 'user-msg': {
const msg = document.createElement('div');
msg.className = 'demo-msg';
msg.innerHTML = '<div class="demo-avatar demo-avatar-user">👤</div><div class="demo-msg-body"><div class="demo-msg-role">You</div><div class="demo-msg-text"></div></div>';
chat.appendChild(msg);
msg.querySelector('.demo-msg-text').textContent = step.text;
scrollDown();
next();
break;
}
case 'thinking': {
if (!currentBotMsg) createBotMsg();
thinkingEl = document.createElement('div');
thinkingEl.className = 'demo-thinking';
thinkingEl.innerHTML = 'Thinking <span class="demo-thinking-dots"><span></span><span></span><span></span></span>';
currentBotMsg.appendChild(thinkingEl);
scrollDown();
next();
break;
}
case 'tool-badge': {
if (!toolArea) createBotMsg();
const badge = document.createElement('span');
badge.className = 'demo-tool ' + step.cls;
badge.innerHTML = step.icon + ' ' + step.label;
badge.dataset.toolName = step.name;
toolArea.appendChild(badge);
scrollDown();
next();
break;
}
case 'tool-expand': {
const expand = document.createElement('div');
expand.className = 'demo-tool-expand';
expand.innerHTML =
'<div class="demo-tool-expand-header">▶ ' + step.tool + '</div>' +
'<div class="demo-tool-expand-body"><strong>Parameters:</strong>\n' + step.params + '\n\n<strong>Result:</strong>\n' + step.result + '</div>';
toolArea.appendChild(expand);
scrollDown();
next();
break;
}
case 'remove-thinking':
if (thinkingEl) { thinkingEl.remove(); thinkingEl = null; }
next();
break;
case 'assistant-msg': {
const textDiv = document.createElement('div');
textDiv.className = 'demo-msg-text';
textDiv.innerHTML = step.html;
currentBotMsg.appendChild(textDiv);
scrollDown();
next();
break;
}
case 'pause':
setTimeout(next, step.delay);
break;
case 'reset':
setTimeout(() => {
chat.innerHTML = '';
input.textContent = '';
thinkingEl = null;
toolArea = null;
currentBotMsg = null;
runStep(0);
}, 500);
break;
}
}
// Start after a short delay
setTimeout(() => runStep(0), 1200);
})();
</script>
<footer class="footer">
<div class="container">
<div class="footer-links">