<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cerulean - Internal Service Ledger</title>
<!-- Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600&family=Lora:ital,wght@0,400;0,500;1,400&family=Work+Sans:wght@300;400;500&display=swap" rel="stylesheet">
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Three.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<!-- Tween.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/tween.js/18.6.4/tween.umd.js"></script>
<!-- Phosphor Icons -->
<script src="https://unpkg.com/@phosphor-icons/web"></script>
<style>
:root {
--stone-1: #E8E4DF;
--stone-2: #D6Cfc8;
--stone-3: #C4B7AE;
--stone-4: #A99D92;
--stone-5: #8B7F74;
--leaf-1: #EBEBD8;
--leaf-2: #C4D7BD;
--leaf-3: #9CBA8C;
--leaf-4: #6EA965;
--leaf-5: #4A8240;
--water-1: #D9E4EB;
--water-2: #B8CAD4;
--water-3: #9AB0BD;
--water-4: #7A96A3;
--water-5: #5F7C86;
--clay-1: #F2E6E4;
--clay-2: #E0CCC7;
--clay-3: #CAB2A6;
--clay-4: #B28E7F;
--clay-5: #9C7465;
--night-1: #1A1A1D;
--night-2: #252529;
--night-3: #2E2E33;
--night-4: #3A3A3F;
--night-5: #46464C;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background-color: var(--night-1);
color: var(--stone-1);
font-family: 'Work Sans', sans-serif;
overflow: hidden;
height: 100vh;
width: 100vw;
position: relative;
}
/* Noise texture overlay - simulated with CSS */
.noise-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.03;
pointer-events: none;
z-index: 50;
background-image:
radial-gradient(circle at 2px 2px, rgba(255,255,255,0.1) 1px, transparent 0);
background-size: 32px 32px;
}
/* Typography */
.serif {
font-family: 'Lora', serif;
}
.display {
font-family: 'Cinzel', serif;
}
/* Glass panels */
.glass-panel {
background: rgba(26, 26, 29, 0.6);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 1.5rem;
box-shadow:
0 4px 30px rgba(0, 0, 0, 0.1),
0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}
/* Organic shape clip */
.organic-clip {
clip-path: polygon(
2% 0%, 98% 0%, 100% 5%,
100% 95%, 98% 100%, 2% 100%,
0% 95%, 0% 5%
);
}
/* Tree ring animation */
@keyframes ringPulse {
0%, 100% { filter: brightness(1); }
50% { filter: brightness(1.2); }
}
/* Flowing blob background */
#blob1, #blob2 {
position: absolute;
border-radius: 50%;
filter: blur(80px);
opacity: 0.15;
z-index: -1;
transition: all 20s ease-in-out;
}
#blob1 {
width: 50vw;
height: 50vw;
background: var(--water-2);
top: -10%;
left: -10%;
animation: blobMove1 30s infinite alternate ease-in-out;
}
#blob2 {
width: 30vw;
height: 30vw;
background: var(--leaf-3);
bottom: -10%;
right: -5%;
animation: blobMove2 40s infinite alternate-reverse ease-in-out;
}
@keyframes blobMove1 {
0% { transform: translate(0, 0) scale(1); }
100% { transform: translate(100px, 50px) scale(1.1); }
}
@keyframes blobMove2 {
0% { transform: translate(0, 0) scale(1); }
100% { transform: translate(-80px, 30px) scale(0.95); }
}
/* Custom scrollbar */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: rgba(255,255,255,0.05);
border-radius: 4px;
}
::-webkit-scrollbar-thumb {
background: rgba(255,255,255,0.2);
border-radius: 4px;
}
/* Three.js canvas container */
#scene-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 10;
pointer-events: none; /* Let clicks pass through to UI */
}
/* UI layers */
.ui-layer {
position: relative;
z-index: 20;
height: 100%;
width: 100%;
pointer-events: none;
}
.ui-element {
pointer-events: auto;
}
.monitor-wave {
fill: none;
stroke: var(--water-3);
stroke-width: 2;
stroke-linecap: round;
vector-effect: non-scaling-stroke;
}
</style>
</head>
<body>
<!-- Produktive Noise -->
<div class="noise-overlay"></div>
<!-- Organic Blobs -->
<div id="blob1"></div>
<div id="blob2"></div>
<!-- Three.js Scene -->
<div id="scene-container"></div>
<!-- UI Overlay -->
<div class="ui-layer">
<!-- Header -->
<header class="absolute top-0 left-0 right-0 p-8 flex justify-between items-start pointer-events-none">
<div class="ui-element">
<h1 class="display text-4xl text-[var(--stone-1)] tracking-wider mb-1 opacity-90">Cerulean</h1>
<p class="text-[var(--stone-3)] text-sm tracking-widest uppercase">Internal Transparency Ledger</p>
</div>
<div class="glass-panel px-6 py-3 ui-element flex items-center gap-4">
<div class="flex items-center gap-2">
<div class="w-2 h-2 rounded-full bg-[var(--leaf-4)] animate-pulse"></div>
<span class="text-xs uppercase tracking-wider">Synced</span>
</div>
<div class="h-4 w-[1px] bg-[var(--stone-5)] opacity-30"></div>
<div class="text-[var(--stone-3)] serif italic text-sm">
Last entry: <span id="last-entry-time">--:--</span>
</div>
</div>
</header>
<!-- Ledger Info (Left) -->
<aside class="absolute left-8 top-1/2 -translate-y-1/2 w-80 flex flex-col gap-6 pointer-events-none">
<div class="glass-panel p-6 ui-element transform transition-transform duration-700 hover:scale-[1.02]">
<h2 class="display text-xl mb-4 text-[var(--stestone-2)]">Ledger Health</h2>
<div class="space-y-4">
<div class="ledger-stat">
<div class="flex justify-between text-sm mb-1">
<span class="text-[var(--stone-3)]">Chain Strength</span>
<span class="font-medium text-[var(--stone-1)]" id="chain-strength">--</span>
</div>
<div class="h-1.5 bg-[var(--night-4)] rounded-full overflow-hidden">
<div id="chain-bar" class="h-full bg-[var(--water-3)] transition-all duration-1000 ease-out" style="width: 80%"></div>
</div>
</div>
<div class="ledger-stat">
<div class="flex justify-between text-sm mb-1">
<span class="text-[var(--stone-3)]">Node Coverage</span>
<span class="font-medium text-[var(--stone-1)]" id="node-coverage">--</span>
</div>
<div class="h-1.5 bg-[var(--night-4)] rounded-full overflow-hidden">
<div id="node-bar" class="h-full bg-[var(--leaf-4)] transition-all duration-1000 ease-out" style="width: 92%"></div>
</div>
</div>
<div class="ledger-stat">
<div class="flex justify-between text-sm mb-1">
<span class="text-[var(--stone-3)]">Gossip Health</span>
<span class="font-medium text-[var(--stone-1)]" id="gossip-health">--</span>
</div>
<div class="h-1.5 bg-[var(--night-4)] rounded-full overflow-hidden">
<div id="gossip-bar" class="h-full bg-[var(--clay-4)] transition-all duration-1000 ease-out" style="width: 88%"></div>
</div>
</div>
</div>
</div>
<!-- Recent Entries -->
<div class="glass-panel p-6 ui-element transform transition-transform duration-700 hover:scale-[1.02]">
<h3 class="text-lg font-serif mb-4 flex items-center gap-2">
<i class="ph ph-clock-counter-clockwise text-[var(--water-4)]"></i>
Recent Entries
</h3>
<div class="space-y-3 max-h-64 overflow-y-auto pr-2" id="entries-list">
<!-- Entries will be injected here -->
</div>
</div>
</aside>
<!-- Monitoring Panel (Right) -->
<aside class="absolute right-8 top-1/2 -translate-y-1/2 w-80 flex flex-col gap-6 pointer-events-none">
<div class="glass-panel p-6 ui-element transform transition-transform duration-700 hover:scale-[1.02]">
<h2 class="display text-xl mb-4 text-[var(--stone-2)]">Service Metrics</h2>
<!-- Waveform container -->
<div class="h-32 relative mb-4 overflow-hidden rounded-xl border border-[var(--night-5)] bg-[var(--night-2)]">
<svg id="waveform" class="w-full h-full" viewBox="0 0 100 50" preserveAspectRatio="none">
<!-- Waves will be drawn via JS -->
</svg>
<!-- Grid lines -->
<div class="absolute inset-0 grid grid-rows-3 pointer-events-none opacity-10">
<div class="border-b border-[var(--stone-1)]"></div>
<div class="border-b border-[var(--stone-1)]"></div>
<div class="border-b border-[var(--stone-1)]"></div>
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div class="metric-card bg-[var(--night-2)] rounded-lg p-3 border border-[var(--night-5)]">
<div class="text-xs text-[var(--stone-3)] uppercase tracking-wider mb-1">Latency</div>
<div class="text-2xl font-serif text-[var(--water-3)]" id="latency-val">42ms</div>
</div>
<div class="metric-card bg-[var(--night-2)] rounded-lg p-3 border border-[var(--night-5)]">
<div class="text-xs text-[var(--stone-3)] uppercase tracking-wider mb-1">Error Rate</div>
<div class="text-2xl font-serif text-[var(--leaf-4)]" id="error-val">0.01%</div>
</div>
</div>
</div>
<!-- Incident Response Panel -->
<div class="glass-panel p-6 ui-element transform transition-transform duration-700 hover:scale-[1.02] overflow-hidden">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-serif flex items-center gap-2">
<i class="ph ph-shield-check text-[var(--leaf-4)]"></i>
Incidents
</h3>
<span class="text-xs px-2 py-1 rounded-full bg-[var(--night-2)] border border-[var(--night-5)] text-[var(--stone-3)]" id="incident-count">0 Active</span>
</div>
<div class="space-y-2" id="incidents-list">
<div class="p-3 rounded-lg bg-[var(--night-2)] border border-[var(--night-5)] text-sm serif italic text-[var(--stone-3)]">
No active incidents. The forest is calm.
</div>
</div>
</div>
</aside>
<!-- Gossip Status (Bottom) -->
<div class="absolute bottom-8 left-1/2 -translate-x-1/2 glass-panel px-8 py-4 ui-element flex items-center gap-8">
<div class="flex items-center gap-3">
<div class="relative">
<i class="ph ph-network text-2xl text-[var(--clay-4)]"></i>
<span class="absolute -top-1 -right-1 w-2 h-2 bg-[var(--leaf-4)] rounded-full animate-ping"></span>
</div>
<div>
<div class="text-sm text-[var(--stone-3)] uppercase tracking-wider">Gossip Peers</div>
<div class="text-lg font-serif" id="peer-count">12</div>
</div>
</div>
<div class="h-8 w-[1px] bg-[var(--stone-5)] opacity-20"></div>
<div class="flex items-center gap-3">
<i class="ph ph-arrows-left-right text-2xl text-[var(--water-4)]"></i>
<div>
<div class="text-sm text-[var(--stone-3)] uppercase tracking-wider">Sync Rate</div>
<div class="text-lg font-serif" id="sync-rate">~4.2/s</div>
</div>
</div>
<div class="h-8 w-[1px] bg-[var(--stone-5)] opacity-20"></div>
<div class="flex items-center gap-3">
<i class="ph ph-tree-structure text-2xl text-[var(--leaf-4)]"></i>
<div>
<div class="text-sm text-[var(--stone-3)] uppercase tracking-wider">Ledger Depth</div>
<div class="text-lg font-serif" id="ledger-depth">0</div>
</div>
</div>
</div>
</div>
<script type="module">
// ============================================
// Configuration & State
// ============================================
const CONFIG = {
colors: {
stone1: 0xE8E4DF,
stone2: 0xD6Cfc8,
stone3: 0xC4B7AE,
stone4: 0xA99D92,
water3: 0x9AB0BD, // For rings
leaf4: 0x6EA965, // For nodes
clay4: 0xB28E7F, // For gossip lines
},
scene: {
bgColor: 0x1A1A1D,
fogColor: 0x1A1A1D,
fogNear: 10,
fogFar: 50
},
interactivity: {
mouseInfluence: 0.05,
rotationSpeed: 0.001
}
};
// State management
const state = {
nodes: [],
entries: [],
incidents: [],
ledgerDepth: 0,
metrics: {
latency: 42,
errorRate: 0.01,
chainStrength: 0,
nodeCoverage: 0,
gossipHealth: 0
},
time: 0
};
// ============================================
// Three.js Setup
// ============================================
const container = document.getElementById('scene-container');
const scene = new THREE.Scene();
scene.background = new THREE.Color(CONFIG.scene.bgColor);
scene.fog = new THREE.FogExp2(CONFIG.scene.fogColor, 0.035);
const camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(0, 4, 12);
camera.lookAt(0, 0, 0);
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.SoftShadowMap;
container.appendChild(renderer.domElement);
// Lights
const ambientLight = new THREE.AmbientLight(0xffffff, 0.4);
scene.add(ambientLight);
const dirLight = new THREE.DirectionalLight(0xffffff, 0.6);
dirLight.position.set(5, 10, 7);
dirLight.castShadow = true;
dirLight.shadow.mapSize.width = 2048;
dirLight.shadow.mapSize.height = 2048;
dirLight.shadow.camera.near = 0.5;
dirLight.shadow.camera.far = 50;
dirLight.shadow.camera.left = -15;
dirLight.shadow.camera.right = 15;
dirLight.shadow.camera.top = 15;
dirLight.shadow.camera.bottom = -15;
scene.add(dirLight);
// Soft rim light for depth
const rimLight = new THREE.PointLight(CONFIG.colors.water3, 0.5, 20);
rimLight.position.set(-10, 2, -5);
scene.add(rimLight);
// ============================================
// Materials
// ============================================
// Soft, matte-like materials with subtle edge glows
const ringMaterial = new THREE.MeshStandardMaterial({
color: CONFIG.colors.water3,
metalness: 0.2,
roughness: 0.8,
transparent: true,
opacity: 0.7,
emissive: CONFIG.colors.water3,
emissiveIntensity: 0.1,
side: THREE.DoubleSide
});
const nodeMaterial = new THREE.MeshStandardMaterial({
color: CONFIG.colors.leaf4,
metalness: 0.1,
roughness: 1.0,
emissive: CONFIG.colors.leaf4,
emissiveIntensity: 0.2
});
const lineMaterial = new THREE.LineBasicMaterial({
color: CONFIG.colors.clay4,
transparent: true,
opacity: 0.4,
linewidth: 2
});
// ============================================
// Ledger Tree (Concentric Rings)
// ============================================
const treeGroup = new THREE.Group();
scene.add(treeGroup);
const rings = [];
const MAX_RINGS = 20;
const RING_RADIUS_INCREMENT = 0.5;
const RING_INITIAL_RADIUS = 1;
const RING_THICKNESS = 0.04;
// Create initial rings
function createRing(radius) {
const geometry = new THREE.TorusGeometry(radius, RING_THICKNESS, 16, 100);
const ring = new THREE.Mesh(geometry, ringMaterial);
ring.rotation.x = Math.PI / 3; // Tilt for visual interest
ring.rotation.z = Math.PI / 8;
ring.userData = {
radius: radius,
age: 0,
maxAge: 2000,
pulsePhase: Math.random() * Math.PI * 2
};
return ring;
}
function addLedgerEntry(entryData) {
// Remove oldest ring if exceeding max
if (rings.length >= MAX_RINGS) {
const oldRing = rings.shift();
treeGroup.remove(oldRing);
// Dispose geometry to prevent leaks
oldRing.geometry.dispose();
}
// Determine new radius (largest)
let newRadius = RING_INITIAL_RADIUS;
if (rings.length > 0) {
const lastRing = rings[rings.length - 1];
newRadius = lastRing.userData.radius + RING_RADIUS_INCREMENT * (0.9 + Math.random() * 0.2);
}
const newRing = createRing(newRadius);
rings.push(newRing);
treeGroup.add(newRing);
// Animate the new ring popping in
newRing.scale.set(0,0,0);
newRing.material.opacity = 0;
new TWEEN.Tween(newRing.scale)
.to({ x: 1, y: 1, z: 1 }, 800)
.easing(TWEEN.Easing.Elastic.Out)
.start();
new TWEEN.Tween(newRing.material)
.to({ opacity: 0.7 }, 600)
.delay(200)
.start();
// Update state
state.ledgerDepth += 1;
state.lastEntry = entryData;
updateUI();
return newRing;
}
// ============================================
// Gossip Nodes (Organic Particles)
// ============================================
const nodeGroup = new THREE.Group();
scene.add(nodeGroup);
function createGossipNode() {
// Organic shape: slightly deformed sphere
const geometry = new THREE.IcosahedronGeometry(0.15, 2); // Detail 2 for smooth but low poly
const node = new THREE.Mesh(geometry, nodeMaterial.clone());
// Random position within a spherical shell
const angle = Math.random() * Math.PI * 2;
const phi = Math.acos(2 * Math.random() - 1);
// Radius between 4 and 8
const radius = 4 + Math.random() * 4;
node.position.x = radius * Math.sin(phi) * Math.cos(angle);
node.position.y = radius * Math.sin(phi) * Math.sin(angle) * 0.6; // Flatten Y for ground plane feel
node.position.z = radius * Math.cos(phi);
// Slight random rotation
node.rotation.set(
Math.random() * Math.PI,
Math.random() * Math.PI,
Math.random() * Math.PI
);
// Animation data
node.userData = {
basePos: node.position.clone(),
floatSpeed: 0.5 + Math.random() * 1.5,
floatOffset: Math.random() * Math.PI * 2,
pulseSpeed: 1 + Math.random() * 2,
pulseOffset: Math.random() * Math.PI * 2
};
return node;
}
// Create initial set of nodes
const NUM_NODES = 12;
for (let i = 0; i < NUM_NODES; i++) {
const node = createGossipNode();
nodeGroup.add(node);
state.nodes.push(node);
}
// Gossip lines
const lineGroup = new THREE.Group();
scene.add(lineGroup);
// Update gossip connections dynamically
function updateGossipConnections() {
// Remove old lines
while(lineGroup.children.length > 0){
const line = lineGroup.children[0];
lineGroup.remove(line);
line.geometry.dispose();
}
// Connect random nodes (simulate gossip mesh)
const connections = [];
const pairs = new Set();
// Ensure each node has at least one connection
state.nodes.forEach(node => {
// Find another node
let partner = state.nodes[Math.floor(Math.random() * state.nodes.length)];
while (partner === node) {
partner = state.nodes[Math.floor(Math.random() * state.nodes.length)];
}
const key = [node.id, partner.id].sort().join('-');
if (!pairs.has(key)) {
pairs.add(key);
connections.push([node.position, partner.position]);
}
});
// Add extra random connections
for (let i = 0; i < NUM_NODES * 0.5; i++) {
const n1 = state.nodes[Math.floor(Math.random() * state.nodes.length)];
const n2 = state.nodes[Math.floor(Math.random() * state.nodes.length)];
if (n1 !== n2) {
const key = [n1.id, n2.id].sort().join('-');
if (!pairs.has(key)) {
pairs.add(key);
connections.push([n1.position, n2.position]);
}
}
}
// Draw lines
connections.forEach(posPair => {
const points = [
new THREE.Vector3().copy(posPair[0]),
new THREE.Vector3().copy(posPair[1])
];
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const line = new THREE.Line(geometry, lineMaterial.clone());
// Store for animation
line.userData = {
start: points[0],
end: points[1],
pulseOffset: Math.random() * Math.PI * 2
};
lineGroup.add(line);
});
}
updateGossipConnections(); // Initial
// ============================================
// Simulation Loop
// ============================================
// Utility: formatted time
function getTimeString() {
const now = new Date();
return now.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' });
}
// Add a log entry (ledger tree)
function simulateLogEntry() {
const services = ['auth', 'billing', 'inventory', 'notify', 'search', 'cache', 'queue', 'analytics'];
const levels = ['INFO', 'WARN', 'DEBUG'];
const level = Math.random() < 0.9 ? 'INFO' : (Math.random() < 0.5 ? 'WARN' : 'DEBUG');
const service = services[Math.floor(Math.random() * services.length)];
const entry = {
id: 'ENT-' + state.entries.length.toString().padStart(5, '0'),
timestamp: getTimeString(),
service: service,
level: level,
message: `Checkpoint verified via Merkle signature`
};
state.entries.unshift(entry);
if (state.entries.length > 10) state.entries.pop();
// Add visual ring
addLedgerEntry(entry);
// Update UI entries list
updateEntriesList();
// Update metrics slightly
state.metrics.chainStrength = Math.min(1, state.metrics.chainStrength + 0.01);
state.metrics.chainStrength = Math.round(state.metrics.chainStrength * 100);
// Trigger rare incident
if (Math.random() < 0.02) {
triggerIncident();
}
updateUI();
}
// Add incident
function triggerIncident() {
const types = ['Latency Spike', 'Auth Failure', 'Consensus Lag', 'Node Drop'];
const type = types[Math.floor(Math.random() * types.length)];
const incident = {
id: 'INC-' + state.incidents.length,
type: type,
status: 'Active',
detected: new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }),
severity: Math.random() > 0.5 ? 'High' : 'Medium'
};
state.incidents.push(incident);
// Visual feedback: make some nodes pulse red
state.nodes.forEach(node => {
if (Math.random() < 0.3) {
node.material.emissive.setHex(0xff4444);
node.material.emissiveIntensity = 0.8;
}
});
updateIncidentsList();
updateUI();
}
// Resolve an incident (auto-resolution after some time)
function resolveIncident(index) {
if (index < state.incidents.length) {
state.incidents.splice(index, 1);
updateIncidentsList();
updateUI();
}
}
// Update UI functions
function updateUI() {
// Times
document.getElementById('last-entry-time').textContent = state.lastEntry ? state.lastEntry.timestamp : '--:--';
document.getElementById('ledger-depth').textContent = state.ledgerDepth;
// Metrics
document.getElementById('chain-strength').textContent = state.metrics.chainStrength + '%';
document.getElementById('chain-bar').style.width = state.metrics.chainStrength + '%';
document.getElementById('node-coverage').textContent = state.metrics.nodeCoverage + '%';
document.getElementById('node-bar').style.width = state.metrics.nodeCoverage + '%';
document.getElementById('gossip-health').textContent = state.metrics.gossipHealth + '%';
document.getElementById('gossip-bar').style.width = state.metrics.gossipHealth + '%';
document.getElementById('peer-count').textContent = state.nodes.length;
document.getElementById('sync-rate').textContent = (3.5 + Math.random() * 2).toFixed(1) + '/s';
// Monitoring values
document.getElementById('latency-val').textContent = Math.round(30 + Math.random() * 20) + 'ms';
document.getElementById('error-val').textContent = (0.001 + Math.random() * 0.005).toFixed(3) + '%';
// Incident count
document.getElementById('incident-count').textContent = state.incidents.length + ' Active';
}
function updateEntriesList() {
const list = document.getElementById('entries-list');
list.innerHTML = '';
state.entries.forEach(entry => {
const levelColor = entry.level === 'INFO' ? 'text-[var(--water-3)]' :
entry.level === 'WARN' ? 'text-[var(--leaf-4)]' :
'text-[var(--stone-3)]';
list.innerHTML += `
<div class="p-3 rounded-lg bg-[var(--night-2)] border border-[var(--night-5)] flex items-start gap-3 text-sm transition-colors duration-300 hover:bg-[var(--night-3)]">
<span class="serif italic text-[var(--stone-3)] text-xs mt-0.5 min-w-[3rem]">${entry.timestamp}</span>
<div class="flex-1">
<div class="flex items-center gap-2 mb-1">
<span class="font-medium text-[var(--stone-1)] text-sm">${entry.service.toUpperCase()}</span>
<span class="text-xs px-1.5 py-0.5 rounded ${levelColor} bg-[var(--night-3)]">${entry.level}</span>
</div>
<div class="text-xs text-[var(--stone-4)]">${entry.message}</div>
</div>
</div>`;
});
}
function updateIncidentsList() {
const list = document.getElementById('incidents-list');
list.innerHTML = '';
if (state.incidents.length === 0) {
list.innerHTML = `
<div class="p-3 rounded-lg bg-[var(--night-2)] border border-[var(--night-5)] text-sm serif italic text-[var(--stone-3)] text-center">
No active incidents. The forest is calm.
</div>`;
return;
}
state.incidents.forEach((inc, idx) => {
const severityColor = inc.severity === 'High' ? 'text-red-500' : 'text-yellow-500';
list.innerHTML += `
<div class="p-3 rounded-lg bg-[var(--night-2)] border border-[var(--night-5)] flex items-center justify-between group transition-all duration-300 hover:border-[var(--clay-4)]">
<div>
<div class="font-medium text-[var(--stone-1)] serif">${inc.type}</div>
<div class="text-xs text-[var(--stone-3)] mt-1">
Detected: ${inc.detected} ·
<span class="${severityColor}"> ${inc.severity}</span>
</div>
</div>
<button onclick="resolveIncident(${idx})"
class="px-3 py-1 text-xs rounded-full bg-[var(--night-3)] border border-[var(--night-5)] text-[var(--stone-3)] hover:bg-[var(--night-4)] hover:text-[var(--stone-1)] transition-colors">
Acknowledge
</button>
</div>`;
});
}
// ============================================
// 2D Dashboard Waves (SVG)
// ============================================
function renderWaves() {
const svg = document.getElementById('waveform');
const width = 100;
const height = 50;
const numWaves = 3;
let paths = '';
const colors = ['var(--water-3)', 'var(--leaf-4)', 'var(--clay-4)'];
for (let w = 0; w < numWaves; w++) {
const baseY = height / 2;
const amplitude = 3 + w * 2;
const frequency = 0.02 + w * 0.01;
const speed = 0.05 + w * 0.02;
const phase = state.time * speed;
let pathData = `M 0 ${baseY}`;
for (let x = 0; x <= width; x++) {
const y = baseY + Math.sin(x * frequency + phase) * amplitude;
pathData += ` L ${x} ${y}`;
}
paths += `<path class="monitor-wave" d="${pathData}" style="stroke: ${colors[w]}; stroke-opacity: ${0.7 - w*0.2};" />`;
}
svg.innerHTML = paths;
}
// ============================================
// Animation Loop
// ============================================
const clock = new THREE.Clock();
const mouse = new THREE.Vector2();
const targetRotation = new THREE.Vector2();
window.addEventListener('mousemove', (e) => {
mouse.x = (e.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(e.clientY / window.innerHeight) * 2 + 1;
// Gentle rotation based on mouse
targetRotation.x = mouse.y * 0.05;
targetRotation.y = mouse.x * 0.05;
});
function animate(time) {
requestAnimationFrame(animate);
const delta = clock.getDelta();
state.time += delta;
TWEEN.update(time);
// Rotate tree group slowly
treeGroup.rotation.y += CONFIG.interactivity.rotationSpeed;
// Apply mouse influence to node group
nodeGroup.rotation.x += (targetRotation.x - nodeGroup.rotation.x) * 0.05;
nodeGroup.rotation.y += (targetRotation.y - nodeGroup.rotation.y) * 0.05;
nodeGroup.rotation.z = Math.sin(state.time * 0.2) * 0.05;
// Animate nodes (floating)
state.nodes.forEach(node => {
const u = node.userData;
node.position.y = u.basePos.y + Math.sin(state.time * u.floatSpeed + u.floatOffset) * 0.3;
node.rotation.x += 0.01;
node.rotation.y += 0.015;
// Pulse emissive (if not red from incident)
if (node.material.emissive.getHex() === CONFIG.colors.leaf4) {
node.material.emissiveIntensity = 0.2 + 0.15 * Math.sin(state.time * u.pulseSpeed + u.pulseOffset);
}
});
// Animate lines (pulse along path)
lineGroup.children.forEach(line => {
const u = line.userData;
const alpha = 0.4 + 0.3 * Math.sin(state.time * 2 + u.pulseOffset);
line.material.opacity = alpha;
// Subtle line movement
const start = u.start.clone();
const end = u.end.clone();
// Add tiny jitter
start.x += (Math.random() - 0.5) * 0.02;
start.y += (Math.random() - 0.5) * 0.02;
start.z += (Math.random() - 0.5) * 0.02;
end.x += (Math.random() - 0.5) * 0.02;
end.y += (Math.random() - 0.5) * 0.02;
end.z += (Math.random() - 0.5) * 0.02;
const positions = line.geometry.attributes.position.array;
positions[0] = start.x; positions[1] = start.y; positions[2] = start.z;
positions[3] = end.x; positions[4] = end.y; positions[5] = end.z;
line.geometry.attributes.position.needsUpdate = true;
});
// Animate rings (subtle pulse)
rings.forEach(ring => {
const u = ring.userData;
u.age += delta * 60;
// Scale emphasis when new, then settle
if (u.age < 60) {
const t = u.age / 60;
ring.material.opacity = 0.7 * t;
} else {
// Gentle breathing
const breathe = 1 + 0.02 * Math.sin(state.time * 0.5 + u.pulsePhase);
ring.scale.set(breathe, breathe, breathe);
ring.material.opacity = 0.7;
}
});
// 2D waves update
renderWaves();
renderer.render(scene, camera);
}
animate();
// ============================================
// Responsiveness
// ============================================
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
// ============================================
// Simulation Scheduler
// ============================================
// Simulate periodic activity
setInterval(() => {
// Add log entry every 2-5 seconds
const next = 2000 + Math.random() * 3000;
setTimeout(simulateLogEntry, next);
}, 0);
// Simulate gossip connections refresh every 30 seconds
setInterval(() => {
updateGossipConnections();
// Randomly slightly adjust node positions (organic movement)
state.nodes.forEach(node => {
node.userData.basePos.x += (Math.random() - 0.5) * 0.5;
node.userData.basePos.y += (Math.random() - 0.5) * 0.2;
node.userData.basePos.z += (Math.random() - 0.5) * 0.5;
});
// Randomly adjust metrics
state.metrics.nodeCoverage += (Math.random() - 0.5) * 10;
state.metrics.nodeCoverage = Math.max(80, Math.min(100, state.metrics.nodeCoverage));
state.metrics.gossipHealth += (Math.random() - 0.5) * 10;
state.metrics.gossipHealth = Math.max(70, Math.min(100, state.metrics.gossipHealth));
updateUI();
}, 30000);
// Initialize UI
updateUI();
updateEntriesList();
updateIncidentsList();
// Expose for onclick handlers
window.resolveIncident = resolveIncident;
</script>
</body>
</html>