Implements the minimum viable conversation loop for Workshop #222: visitor arrives → sends message → Timmy barks back. - js/visitor.js: Visitor presence protocol (#41) - visitor_entered on load (with device detection: ipad/desktop/mobile) - visitor_left on unload or 30s hidden (iPad tab suspend) - visitor_message dispatched from chat input - visitor_interaction export for future tap-to-interact (#44) - Session duration tracking - js/bark.js: Bark display system (#42) - showBark() renders prominent viewport toasts with typing animation - Auto-dismiss after display time + typing duration - Queue system (max 3 simultaneous, overflow queued) - Demo barks in mock mode (Workshop-themed: 222, sovereignty, chain) - Barks also logged permanently in chat panel - index.html: Chat input bar (#40) - Terminal-styled input + send button at viewport bottom - Enter to send (desktop), button tap (iPad) - Safe-area padding for notched devices - Chat panel repositioned above input bar - Bark container in upper viewport third - js/websocket.js: New message handlers - 'bark' message → showBark() dispatch - 'ambient_state' message → placeholder for #43 - Demo barks start in mock mode - js/ui.js: appendChatMessage() accepts optional CSS class - Visitor messages styled differently from agent messages Build: 18 modules, 0 errors Tested: desktop (1280x800) + mobile (390x844) via Playwright Closes #40, #41, #42 Ref: rockachopa/Timmy-time-dashboard#222, #243
193 lines
7.0 KiB
HTML
193 lines
7.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
|
<meta name="theme-color" content="#000000" />
|
|
<meta name="description" content="3D visualization of the Timmy agent network" />
|
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
|
<meta name="apple-mobile-web-app-title" content="Tower World" />
|
|
<link rel="manifest" href="/manifest.json" />
|
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
<link rel="apple-touch-icon" href="/icons/icon-192.svg" />
|
|
<title>Timmy Tower World</title>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body { background: #000; overflow: hidden; font-family: 'Courier New', monospace; }
|
|
canvas { display: block; }
|
|
|
|
/* Loading screen — hidden by main.js after init */
|
|
#loading-screen {
|
|
position: fixed; inset: 0; z-index: 100;
|
|
display: flex; align-items: center; justify-content: center;
|
|
background: #000;
|
|
color: #00ff41; font-size: 14px; letter-spacing: 4px;
|
|
text-shadow: 0 0 12px #00ff41;
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
#loading-screen.hidden { display: none; }
|
|
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
|
|
#loading-screen span { animation: blink 1.2s ease-in-out infinite; }
|
|
|
|
#ui-overlay {
|
|
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
|
|
pointer-events: none; z-index: 10;
|
|
}
|
|
#hud {
|
|
position: fixed; top: 16px; left: 16px;
|
|
color: #00ff41; font-size: clamp(10px, 1.5vw, 14px); line-height: 1.6;
|
|
text-shadow: 0 0 8px #00ff41;
|
|
pointer-events: none;
|
|
}
|
|
#hud h1 { font-size: clamp(12px, 2vw, 18px); letter-spacing: clamp(2px, 0.4vw, 4px); margin-bottom: 8px; color: #00ff88; }
|
|
#status-panel {
|
|
position: fixed; top: 16px; right: 16px;
|
|
color: #00ff41; font-size: clamp(9px, 1.2vw, 12px); line-height: 1.8;
|
|
text-shadow: 0 0 6px #00ff41; max-width: 240px;
|
|
}
|
|
#status-panel .label { color: #007722; }
|
|
#chat-panel {
|
|
position: fixed; bottom: 52px; left: 16px; right: 16px;
|
|
max-height: 150px; overflow-y: auto;
|
|
color: #00ff41; font-size: clamp(9px, 1.2vw, 12px); line-height: 1.6;
|
|
text-shadow: 0 0 4px #00ff41;
|
|
pointer-events: none;
|
|
}
|
|
.chat-entry { opacity: 0.8; }
|
|
.chat-entry .agent-name { color: #00ff88; font-weight: bold; }
|
|
.chat-entry.visitor { opacity: 1; }
|
|
.chat-entry.visitor .agent-name { color: #888; }
|
|
|
|
/* ── Chat input (#40) ── */
|
|
#chat-input-bar {
|
|
position: fixed; bottom: 0; left: 0; right: 0;
|
|
display: flex; align-items: center; gap: 8px;
|
|
padding: 8px 16px;
|
|
padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
|
|
background: rgba(0, 0, 0, 0.85);
|
|
border-top: 1px solid #003300;
|
|
z-index: 20;
|
|
pointer-events: auto;
|
|
}
|
|
#chat-input {
|
|
flex: 1;
|
|
background: rgba(0, 20, 0, 0.6);
|
|
border: 1px solid #003300;
|
|
color: #00ff41;
|
|
font-family: 'Courier New', monospace;
|
|
font-size: clamp(12px, 1.5vw, 14px);
|
|
padding: 8px 12px;
|
|
border-radius: 2px;
|
|
outline: none;
|
|
caret-color: #00ff41;
|
|
}
|
|
#chat-input::placeholder { color: #004400; }
|
|
#chat-input:focus { border-color: #00ff41; box-shadow: 0 0 8px rgba(0, 255, 65, 0.2); }
|
|
#chat-send {
|
|
background: transparent;
|
|
border: 1px solid #003300;
|
|
color: #00ff41;
|
|
font-family: 'Courier New', monospace;
|
|
font-size: 14px;
|
|
padding: 8px 16px;
|
|
cursor: pointer;
|
|
border-radius: 2px;
|
|
pointer-events: auto;
|
|
text-shadow: 0 0 6px #00ff41;
|
|
transition: all 0.15s;
|
|
}
|
|
#chat-send:hover, #chat-send:active { background: rgba(0, 255, 65, 0.1); border-color: #00ff41; }
|
|
|
|
/* ── Bark display (#42) ── */
|
|
#bark-container {
|
|
position: fixed;
|
|
top: 20%; left: 50%;
|
|
transform: translateX(-50%);
|
|
max-width: 600px; width: 90%;
|
|
z-index: 15;
|
|
pointer-events: none;
|
|
display: flex; flex-direction: column; align-items: center; gap: 8px;
|
|
}
|
|
.bark {
|
|
background: rgba(0, 10, 0, 0.85);
|
|
border: 1px solid #003300;
|
|
border-left: 3px solid #00ff41;
|
|
padding: 12px 20px;
|
|
color: #00ff41;
|
|
font-family: 'Courier New', monospace;
|
|
font-size: clamp(13px, 1.8vw, 16px);
|
|
line-height: 1.5;
|
|
text-shadow: 0 0 8px #00ff41;
|
|
opacity: 0;
|
|
animation: barkIn 0.4s ease-out forwards;
|
|
max-width: 100%;
|
|
}
|
|
.bark .bark-agent {
|
|
font-size: clamp(9px, 1vw, 11px);
|
|
color: #007722;
|
|
margin-bottom: 4px;
|
|
letter-spacing: 2px;
|
|
}
|
|
.bark.fade-out {
|
|
animation: barkOut 0.6s ease-in forwards;
|
|
}
|
|
@keyframes barkIn {
|
|
from { opacity: 0; transform: translateY(-8px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
@keyframes barkOut {
|
|
from { opacity: 1; transform: translateY(0); }
|
|
to { opacity: 0; transform: translateY(-8px); }
|
|
}
|
|
|
|
#connection-status {
|
|
position: fixed; bottom: 52px; right: 16px;
|
|
font-size: clamp(9px, 1.2vw, 12px); color: #555;
|
|
}
|
|
#connection-status.connected { color: #00ff41; text-shadow: 0 0 6px #00ff41; }
|
|
|
|
/* Safe area padding for notched devices */
|
|
@supports (padding: env(safe-area-inset-top)) {
|
|
#hud { top: calc(16px + env(safe-area-inset-top)); left: calc(16px + env(safe-area-inset-left)); }
|
|
#status-panel { top: calc(16px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); }
|
|
#chat-panel { bottom: calc(52px + env(safe-area-inset-bottom)); left: calc(16px + env(safe-area-inset-left)); right: calc(16px + env(safe-area-inset-right)); }
|
|
#connection-status { bottom: calc(52px + env(safe-area-inset-bottom)); right: calc(16px + env(safe-area-inset-right)); }
|
|
}
|
|
|
|
/* Stack status panel below HUD on narrow viewports (must come AFTER @supports) */
|
|
@media (max-width: 500px) {
|
|
#status-panel { top: 100px !important; left: 16px; right: auto; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="loading-screen"><span>INITIALIZING...</span></div>
|
|
<div id="ui-overlay">
|
|
<div id="hud">
|
|
<h1>TIMMY TOWER WORLD</h1>
|
|
<div id="agent-count">AGENTS: 0</div>
|
|
<div id="active-jobs">JOBS: 0</div>
|
|
<div id="fps">FPS: --</div>
|
|
</div>
|
|
<div id="status-panel">
|
|
<div id="agent-list"></div>
|
|
</div>
|
|
<div id="chat-panel"></div>
|
|
<div id="bark-container"></div>
|
|
<div id="connection-status">OFFLINE</div>
|
|
</div>
|
|
<div id="chat-input-bar">
|
|
<input id="chat-input" type="text" placeholder="Say something to the Workshop..." autocomplete="off" />
|
|
<button id="chat-send">></button>
|
|
</div>
|
|
<script type="module" src="./js/main.js"></script>
|
|
<script>
|
|
// Register service worker for PWA / offline support
|
|
if ('serviceWorker' in navigator) {
|
|
navigator.serviceWorker.register('/sw.js').catch(() => {});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|