<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SentiQ | AI-Powered Quality Assurance</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=Inter:wght@300;400;500;600&family=Playfair+Display:wght@600;700&display=swap" rel="stylesheet">
<!-- Icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- Tailwind CSS (via CDN for standalone usage) -->
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
sans: ['Inter', 'sans-serif'],
serif: ['Playfair Display', 'serif'],
},
colors: {
void: '#050505',
glass: 'rgba(255, 255, 255, 0.03)',
glassBorder: 'rgba(255, 255, 255, 0.1)',
accent: '#00f0ff', // Cyber Blue
accentDim: 'rgba(0, 240, 255, 0.1)',
risk: '#ff2a2a',
warning: '#ffaa00',
},
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
}
}
}
}
</script>
<!-- GSAP & Three.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r134/three.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js"></script>
<style>
/* Custom Base Styles */
body {
background-color: #050505;
color: #e0e0e0;
overflow-x: hidden;
-webkit-font-smoothing: antialiased;
}
/* WebGL Background */
#bg-canvas {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -2;
opacity: 0.6;
}
/* Grain Texture Overlay */
.noise-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: -1;
opacity: 0.05;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}
/* Magnetic Button Effect */
.magnetic-btn {
position: relative;
transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
/* Glass Card Styling */
.glass-card {
background: var(--glass);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid var(--glassBorder);
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
transition: border-color 0.3s ease, transform 0.3s ease;
}
.glass-card:hover {
border-color: rgba(255, 255, 255, 0.2);
transform: translateY(-2px);
}
/* SVG Chart Styling */
.progress-ring__circle {
transition: stroke-dashoffset 1s ease-in-out;
transform: rotate(-90deg);
transform-origin: 50% 50%;
}
/* Traceability Map Styles */
.node {
transition: all 0.4s ease;
cursor: pointer;
}
.node.inactive {
opacity: 0.2;
filter: grayscale(100%);
}
.node.active {
filter: drop-shadow(0 0 8px var(--accent));
}
.link {
stroke: rgba(255,255,255,0.15);
stroke-width: 1;
transition: stroke 0.4s ease, stroke-width 0.4s ease;
}
.link.active {
stroke: var(--accent);
stroke-width: 2;
stroke-dasharray: 5, 5;
animation: dash 30s linear infinite;
}
@keyframes dash {
to { stroke-dashoffset: -1000; }
}
/* Scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #0a0a0a;
}
::-webkit-scrollbar-thumb {
background: #333;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
</style>
</head>
<body class="selection:bg-accent selection:text-black">
<!-- Background WebGL -->
<canvas id="bg-canvas"></canvas>
<div class="noise-overlay"></div>
<!-- Ambient Cursor Glow -->
<div id="mouse-glow" class="fixed w-[500px] h-[500px] bg-accent rounded-full blur-[120px] pointer-events-none opacity-0 transition-opacity duration-500 -translate-x-1/2 -translate-y-1/2 z-0 mix-blend-screen"></div>
<!-- Main Content -->
<main class="relative z-10 container mx-auto px-6 py-12 max-w-7xl">
<!-- Header -->
<header class="flex flex-col md:flex-row justify-between items-end mb-16 border-b border-white/10 pb-6">
<div>
<h1 class="text-5xl md:text-6xl font-serif font-bold tracking-tight text-white mb-2">
SentiQ.<span class="text-accent">ai</span>
</h1>
<p class="text-gray-400 text-sm md:text-base tracking-widest uppercase">Intelligent Traceability & Risk Engine</p>
</div>
<div class="mt-6 md:mt-0 flex gap-4">
<button class="magnetic-btn glass-card px-8 py-3 text-sm font-medium text-white uppercase tracking-wider hover:bg-accent/10 transition-colors" onclick="runAnalysis()">
<i class="fa-solid fa-bolt mr-2"></i> Run Analysis
</button>
<button class="magnetic-btn bg-white text-black px-8 py-3 text-sm font-bold uppercase tracking-wider hover:bg-accent hover:border-accent transition-colors">
Export Report
</button>
</div>
</header>
<!-- KPI Grid (Bento Top) -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
<!-- KPI 1 -->
<div class="glass-card rounded-2xl p-8 relative overflow-hidden group">
<div class="absolute -right-4 -top-4 w-24 h-24 bg-accent/20 rounded-full blur-3xl group-hover:bg-accent/30 transition-all"></div>
<div class="flex justify-between items-start">
<div>
<p class="text-gray-400 text-xs uppercase tracking-wider mb-1">Traceability Covered</p>
<h3 class="text-4xl font-serif font-bold text-white" id="kpi-coverage">92%</h3>
</div>
<i class="fa-solid fa-network-wired text-accent text-lg"></i>
</div>
<div class="mt-4 h-1 w-full bg-white/10 rounded overflow-hidden">
<div class="h-full bg-accent w-[92%] transition-all duration-1000 ease-out" id="kpi-bar"></div>
</div>
<p class="mt-2 text-xs text-gray-500">+2.4% vs last sprint</p>
</div>
<!-- KPI 2 -->
<div class="glass-card rounded-2xl p-8 relative overflow-hidden group">
<div class="absolute -right-4 -top-4 w-24 h-24 bg-warning/20 rounded-full blur-3xl group-hover:bg-warning/30 transition-all"></div>
<div class="flex justify-between items-start">
<div>
<p class="text-gray-400 text-xs uppercase tracking-wider mb-1">High Risk Areas</p>
<h3 class="text-4xl font-serif font-bold text-warning" id="kpi-risk">3</h3>
</div>
<i class="fa-solid fa-triangle-exclamation text-warning text-lg"></i>
</div>
<p class="mt-4 text-xs text-gray-500">Requires automated regression per build</p>
</div>
<!-- KPI 3 -->
<div class="glass-card rounded-2xl p-8 relative overflow-hidden group">
<div class="absolute -right-4 -top-4 w-24 h-24 bg-risk/20 rounded-full blur-3xl group-hover:bg-risk/30 transition-all"></div>
<div class="flex justify-between items-start">
<div>
<p class="text-gray-400 text-xs uppercase tracking-wider mb-1">Unlinked Requirements</p>
<h3 class="text-4xl font-serif font-bold text-risk" id="kpi-gaps">8</h3>
</div>
<i class="fa-solid fa-link-slash text-risk text-lg"></i>
</div>
<p class="mt-4 text-xs text-gray-500">Orphaned stories needing coverage</p>
</div>
</div>
<!-- Main Workspace Grid -->
<div class="grid grid-cols-1 lg:grid-cols-12 gap-6 mb-12">
<!-- Left Column: Traceability Map (Col-span-8) -->
<div class="lg:col-span-8 glass-card rounded-2xl p-6 flex flex-col">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-white flex items-center gap-2">
<i class="fa-solid fa-sitemap text-accent"></i> Requirement Traceability Matrix (RTM)
</h2>
<div class="text-xs font-mono text-gray-400">Live Mapping</div>
</div>
<!-- Interactive SVG Container -->
<div class="relative flex-grow bg-black/20 rounded-xl overflow-hidden border border-white/5" id="trace-container">
<div class="absolute inset-0 flex items-center justify-center">
<p class="text-gray-500 text-sm font-mono">Visualizing relationship graph...</p>
</div>
<!-- SVG will be injected here via JS -->
<svg id="trace-svg" class="w-full h-full block" preserveAspectRatio="xMidYMid meet"></svg>
</div>
<div class="mt-4 flex justify-center gap-6 text-xs text-gray-400">
<div class="flex items-center gap-2">
<span class="w-3 h-3 rounded-full bg-accent/50"></span> Requirement
</div>
<div class="flex items-center gap-2">
<span class="w-3 h-3 rounded-full bg-white/50"></span> Test Case
</div>
<div class="flex items-center gap-2">
<span class="w-3 h-3 rounded-full bg-risk"></span> Defect
</div>
</div>
</div>
<!-- Right Column: Coverage Audit (Col-span-4) -->
<div class="lg:col-span-4 glass-card rounded-2xl p-6 flex flex-col">
<div class="flex justify-between items-center mb-6">
<h2 class="text-xl font-bold text-white flex items-center gap-2">
<i class="fa-solid fa-chart-pie text-accent"></i> Coverage Audit
</h2>
<button onclick="runCoverage()" class="text-xs text-accent hover:text-white transition-colors">Update</button>
</div>
<div class="flex-grow flex flex-col justify-center gap-8">
<!-- Audit Item 1 -->
<div class="flex items-center gap-4">
<div class="relative w-16 h-16">
<svg class="w-full h-full transform -rotate-90" viewBox="0 0 36 36">
<path class="text-white/10" d="M18 2.1 a 15.9 15.9 0 0 1 0 31.8" fill="none" stroke="currentColor" stroke-width="3" />
<path class="progress-ring__circle text-accent" stroke-dasharray="100, 100" d="M18 2.1 a 15.9 15.9 0 0 1 0 31.8" fill="none" stroke="currentColor" stroke-width="3" data-percent="85" />
</svg>
<div class="absolute inset-0 flex items-center justify-center text-xs font-bold text-white" data-label="85">85%</div>
</div>
<div>
<p class="text-sm font-bold text-white">Payment Flow</p>
<p class="text-xs text-gray-400">Module Coverage</p>
</div>
</div>
<!-- Audit Item 2 -->
<div class="flex items-center gap-4">
<div class="relative w-16 h-16">
<svg class="w-full h-full transform -rotate-90" viewBox="0 0 36 36">
<path class="text-white/10" d="M18 2.1 a 15.9 15.9 0 0 1 0 31.8" fill="none" stroke="currentColor" stroke-width="3" />
<path class="progress-ring__circle text-warning" stroke-dasharray="100, 100" d="M18 2.1 a 15.9 15.9 0 0 1 0 31.8" fill="none" stroke="currentColor" stroke-width="3" data-percent="62" />
</svg>
<div class="absolute inset-0 flex items-center justify-center text-xs font-bold text-white" data-label="62">62%</div>
</div>
<div>
<p class="text-sm font-bold text-white">User Onboarding</p>
<p class="text-xs text-gray-400">Needs Edge Cases</p>
</div>
</div>
<!-- Audit Item 3 -->
<div class="flex items-center gap-4">
<div class="relative w-16 h-16">
<svg class="w-full h-full transform -rotate-90" viewBox="0 0 36 36">
<path class="text-white/10" d="M18 2.1 a 15.9 15.9 0 0 1 0 31.8" fill="none" stroke="currentColor" stroke-width="3" />
<path class="progress-ring__circle text-risk" stroke-dasharray="100, 100" d="M18 2.1 a 15.9 15.9 0 0 1 0 31.8" fill="none" stroke="currentColor" stroke-width="3" data-percent="45" />
</svg>
<div class="absolute inset-0 flex items-center justify-center text-xs font-bold text-white" data-label="45">45%</div>
</div>
<div>
<p class="text-sm font-bold text-white">API Gateway</p>
<p class="text-xs text-gray-400">Critical Gap</p>
</div>
</div>
</div>
</div>
</div>
<!-- Risk Suggestions Section -->
<div class="glass-card rounded-2xl p-6 relative">
<div class="flex justify-between items-center mb-8">
<h2 class="text-2xl font-bold text-white flex items-center gap-2">
<i class="fa-solid fa-brain text-accent"></i> AI Risk Analysis & Suggestions
</h2>
<div class="flex gap-2">
<span class="px-3 py-1 rounded-full text-xs font-mono bg-accent/10 text-accent border border-accent/20">Model: GPT-4 QA-Tuned</span>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6" id="suggestion-grid">
<!-- Cards will be injected via JS -->
</div>
</div>
<!-- Footer -->
<footer class="mt-12 text-center text-xs text-gray-600 font-mono">
<p>© 2023 SentiQ Systems. Executed in browser. No data transmitted.</p>
</footer>
</main>
<!-- JavaScript Logic -->
<script>
// ==========================================
// 1. Three.js Background Shader (Mesh Gradient)
// ==========================================
const initThreeJS = () => {
const canvas = document.getElementById('bg-canvas');
const renderer = new THREE.WebGLRenderer({ canvas, alpha: true, antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
const scene = new THREE.Scene();
const camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1);
// Simple Plane covering the screen
const geometry = new THREE.PlaneGeometry(2, 2);
// Custom Shader Material for fluid effect
const vertexShader = `
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = vec4(position, 1.0);
}
`;
const fragmentShader = `
uniform float u_time;
uniform vec2 u_resolution;
varying vec2 vUv;
// Simplex noise (simplified)
vec3 permute(vec3 x) { return mod(((x*34.0)+1.0)*x, 289.0); }
float snoise(vec2 v){
const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439);
vec2 i = floor(v + dot(v, C.yy) );
vec2 x0 = v - i + dot(i, C.xx);
vec2 i1;
i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
vec4 x12 = x0.xyxy + C.xxzz;
x12.xy -= i1;
i = mod(i, 289.0);
vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 )) + i.x + vec3(0.0, i1.x, 1.0 ));
vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);
m = m*m ;
m = m*m ;
vec3 x = 2.0 * fract(p * C.www) - 1.0;
vec3 h = abs(x) - 0.5;
vec3 ox = floor(x + 0.5);
vec3 a0 = x - ox;
m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );
vec3 g;
g.x = a0.x * x0.x + h.x * x0.y;
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
return 130.0 * dot(m, g);
}
void main() {
vec2 st = vUv;
float t = u_time * 0.1;
// Create shifting dramatic gradients
vec3 color1 = vec3(0.02, 0.02, 0.05); // Near Black
vec3 color2 = vec3(0.0, 0.05, 0.1); // Dark Blue
vec3 color3 = vec3(0.1, 0.0, 0.05); // Dark Purple hint
float n1 = snoise(st * 3.0 + t);
float n2 = snoise(st * 8.0 - t * 0.5);
float mixVal = (n1 + n2) * 0.5 + 0.5;
vec3 finalColor = mix(color1, color2, smoothstep(0.3, 0.7, mixVal));
finalColor = mix(finalColor, color3, smoothstep(0.6, 0.9, n1));
// Vignette
float dist = distance(vUv, vec2(0.5));
finalColor *= smoothstep(0.8, 0.2, dist);
gl_FragColor = vec4(finalColor, 1.0);
}
`;
const material = new THREE.ShaderMaterial({
vertexShader,
fragmentShader,
uniforms: {
u_time: { value: 0 },
u_resolution: { value: new THREE.Vector2(window.innerWidth, window.innerHeight) }
}
});
const plane = new THREE.Mesh(geometry, material);
scene.add(plane);
// Handle Resize
window.addEventListener('resize', () => {
renderer.setSize(window.innerWidth, window.innerHeight);
material.uniforms.u_resolution.value.set(window.innerWidth, window.innerHeight);
});
// Animation Loop
const animate = ( time ) => {
material.uniforms.u_time.value = time * 0.001;
renderer.render(scene, camera);
requestAnimationFrame(animate);
};
animate();
};
// ==========================================
// 2. Traceability Map (SVG Graph)
// ==========================================
const data = {
nodes: [
{ id: 'R1', type: 'req', label: 'REQ-001: Auth' },
{ id: 'R2', type: 'req', label: 'REQ-002: Checkout' },
{ id: 'R3', type: 'req', label: 'REQ-003: Profile' },
{ id: 'R4', type: 'req', label: 'REQ-004: Search' },
{ id: 'T1', type: 'test', label: 'TC-Auth-01' },
{ id: 'T2', type: 'test', label: 'TC-Auth-02' },
{ id: 'T3', type: 'test', label: 'TC-Check-01' },
{ id: 'T4', type: 'test', label: 'TC-Check-02' },
{ id: 'T5', type: 'test', label: 'TC-Prof-01' },
{ id: 'D1', type: 'defect', label: 'DEF-8842' },
{ id: 'D2', type: 'defect', label: 'DEF-8850' }
],
links: [
{ source: 'R1', target: 'T1' },
{ source: 'R1', target: 'T2' },
{ source: 'R2', target: 'T3' },
{ source: 'R2', target: 'T4' },
{ source: 'R3', target: 'T5' },
{ source: 'T2', target: 'D1' },
{ source: 'T3', target: 'D2' }
]
};
const renderGraph = () => {
const svg = document.getElementById('trace-svg');
svg.innerHTML = ''; // clear
const width = svg.clientWidth;
const height = svg.clientHeight;
// Simple manual layout (circular force approximation)
const center = { x: width / 2, y: height / 2 };
const radius = Math.min(width, height) / 2 - 50;
// Position nodes in a circle, other nodes slightly inside
const positions = {};
const reqCount = data.nodes.filter(n => n.type === 'req').length;
const testCount = data.nodes.filter(n => n.type === 'test').length;
const defCount = data.nodes.filter(n => n.type === 'defect').length;
let i = 0;
// Outer: Reqs
data.nodes.filter(n => n.type === 'req').forEach(node => {
const angle = (i++ / reqCount) * 2 * Math.PI;
positions[node.id] = {
x: center.x + Math.cos(angle) * (radius * 0.8),
y: center.y + Math.sin(angle) * (radius * 0.8)
};
});
// Middle: Tests
data.nodes.filter(n => n.type === 'test').forEach(node => {
const angle = (i++ / testCount) * 2 * Math.PI + 1; // offset
positions[node.id] = {
x: center.x + Math.cos(angle) * (radius * 0.5),
y: center.y + Math.sin(angle) * (radius * 0.5)
};
});
// Inner: Defects
data.nodes.filter(n => n.type === 'defect').forEach(node => {
const angle = (i++ / defCount) * 2 * Math.PI;
positions[node.id] = {
x: center.x + Math.cos(angle) * (radius * 0.2),
y: center.y + Math.sin(angle) * (radius * 0.2)
};
});
// Draw Lines
data.links.forEach(link => {
const start = positions[link.source];
const end = positions[link.target];
if(!start || !end) return;
const line = document.createElementNS('http://www.w3.org/2000/svg', 'line');
line.setAttribute('x1', start.x);
line.setAttribute('y1', start.y);
line.setAttribute('x2', end.x);
line.setAttribute('y2', end.y);
line.setAttribute('class', 'link');
line.dataset.source = link.source;
line.dataset.target = link.target;
svg.appendChild(line);
});
// Draw Nodes
data.nodes.forEach(node => {
const pos = positions[node.id];
const g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
g.setAttribute('class', 'node');
g.dataset.id = node.id;
// Circle
const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
circle.setAttribute('cx', pos.x);
circle.setAttribute('cy', pos.y);
circle.setAttribute('r', node.type === 'req' ? 12 : (node.type === 'test' ? 8 : 6));
// Color based on type
if(node.type === 'req') circle.setAttribute('fill', 'rgba(0, 240, 255, 0.2)');
else if(node.type === 'test') circle.setAttribute('fill', 'rgba(255, 255, 255, 0.2)');
else circle.setAttribute('fill', 'rgba(255, 42, 42, 0.2)');
circle.setAttribute('stroke', node.type === 'req' ? '#00f0ff' : (node.type === 'test' ? '#fff' : '#ff2a2a'));
circle.setAttribute('stroke-width', '2');
// Text label
const text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
text.setAttribute('x', pos.x + 15);
text.setAttribute('y', pos.y + 4);
text.setAttribute('fill', '#ccc');
text.setAttribute('font-size', '10');
text.setAttribute('font-family', 'Inter');
text.textContent = node.label;
g.appendChild(circle);
g.appendChild(text);
svg.appendChild(g);
// Events
g.addEventListener('mouseenter', () => activateNode(node.id));
g.addEventListener('mouseleave', () => deactivateNode());
});
};
const activateNode = (id) => {
// Highlight node
const nodes = document.querySelectorAll('.node');
nodes.forEach(n => {
if (n.dataset.id === id) {
n.classList.add('active');
} else {
n.classList.add('inactive');
}
});
// Highlight connected links
const links = document.querySelectorAll('.link');
links.forEach(l => {
if (l.dataset.source === id || l.dataset.target === id) {
l.classList.add('active');
} else {
l.classList.remove('active');
}
});
};
const deactivateNode = () => {
const nodes = document.querySelectorAll('.node');
const links = document.querySelectorAll('.link');
nodes.forEach(n => n.classList.remove('active'));
nodes.forEach(n => n.classList.remove('inactive'));
links.forEach(l => l.classList.remove('active'));
};
// ==========================================
// 3. Interactive Traffic / Coverage
// ==========================================
const animateCoverage = () => {
const circles = document.querySelectorAll('.progress-ring__circle');
circles.forEach(circle => {
const radius = circle.r.baseVal.value;
const circumference = radius * 2 * Math.PI;
const percent = circle.getAttribute('data-percent');
const offset = circumference - (percent / 100) * circumference;
circle.style.strokeDasharray = `${circumference} ${circumference}`;
circle.style.strokeDashoffset = circumference; // start empty
// Trigger animation
setTimeout(() => {
circle.style.strokeDashoffset = offset;
}, 100);
});
};
const runCoverage = () => {
const circles = document.querySelectorAll('.progress-ring__circle');
const labels = document.querySelectorAll('[data-label]');
// Simulate random re-audit
circles.forEach((c, i) => {
// Reset to empty
c.style.strokeDashoffset = c.getAttribute('data-percent') ? (2 * Math.PI * c.r.baseVal.value) : 0;
const label = labels[i];
let random = Math.floor(Math.random() * 30) + 60; // 60-90%
if (label) label.textContent = random + '%';
setTimeout(() => {
const offset = 2 * Math.PI * c.r.baseVal.value - (random / 100) * (2 * Math.PI * c.r.baseVal.value);
c.style.strokeDashoffset = offset;
c.setAttribute('data-percent', random);
}, i * 150);
});
};
// ==========================================
// 4. AI Suggestions Feed
// ==========================================
const suggestions = [
{
title: "Payment Gateway Timeout",
risk: "High",
desc: "Analyses of commit 92f22 indicate a 300ms delay added to checkoutAPI. Suggests adding timeout resilience tests.",
type: "automation"
},
{
title: "Orphaned Req-004",
risk: "Medium",
desc: "Search feature requirement has no direct test linkage. Suggest creating GUI heatmap tests.",
type: "manual"
},
{
title: "Flaky Auth Flow",
risk: "Critical",
desc: "DEF-8842 is recurring. AI suggests isolating token refresh logic into unit tests.",
type: "critical"
}
];
const renderSuggestions = () => {
const container = document.getElementById('suggestion-grid');
container.innerHTML = suggestions.map(s => `
<div class="glass-card p-6 rounded-xl border-l-4 border-accent hover:bg-white/5 transition-all duration-300 cursor-pointer group relative overflow-hidden">
<div class="absolute -right-4 -bottom-4 w-20 h-20 bg-accent/5 rounded-full blur-xl group-hover:bg-accent/10 transition-all"></div>
<div class="flex justify-between items-start mb-3">
<span class="text-xs font-mono px-2 py-1 rounded bg-white/5 text-accent border border-accent/20">${s.type.toUpperCase()}</span>
<span class="text-xs font-bold text-${s.risk === 'High' || s.risk === 'Critical' ? 'risk' : 'warning'}">${s.risk}</span>
</div>
<h3 class="text-lg font-bold text-white mb-2 group-hover:text-accent transition-colors">${s.title}</h3>
<p class="text-sm text-gray-400 leading-relaxed">${s.desc}</p>
<div class="mt-4 flex gap-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300">
<button class="text-xs text-accent hover:underline">Assign Test Case</button>
<span class="text-gray-600">|</span>
<button class="text-xs text-accent hover:underline">View Code Diff</button>
</div>
</div>
`).join('');
};
// ==========================================
// 5. General UI Interactions & Magnetic Buttons
// ==========================================
const initInteractions = () => {
// Mouse Glow
const glow = document.getElementById('mouse-glow');
let mouseX = 0, mouseY = 0;
document.addEventListener('mousemove', (e) => {
mouseX = e.clientX;
mouseY = e.clientY;
glow.style.left = mouseX + 'px';
glow.style.top = mouseY + 'px';
glow.style.opacity = '0.6';
});
// Magnetic effect for buttons
document.querySelectorAll('.magnetic-btn').forEach(btn => {
btn.addEventListener('mousemove', (e) => {
const rect = btn.getBoundingClientRect();
const x = e.clientX - rect.left - rect.width / 2;
const y = e.clientY - rect.top - rect.height / 2;
btn.style.transform = `translate(${x * 0.3}px, ${y * 0.5}px)`;
});
btn.addEventListener('mouseleave', () => {
btn.style.transform = 'translate(0px, 0px)';
});
});
// GSAP Scroll Animations
gsap.registerPlugin(ScrollTrigger);
// Stagger cards on load
gsap.from('.glass-card', {
y: 50,
opacity: 0,
duration: 0.8,
stagger: 0.1,
ease: 'power3.out'
});
gsap.from('.node', {
scale: 0,
duration: 1,
stagger: 0.02,
delay: 0.5,
ease: 'back.out(1.7)'
});
};
// ==========================================
// 6. Simulation Logic (The "AI" Brain)
// ==========================================
function runAnalysis() {
const btn = document.querySelector('button:has(.fa-bolt)');
const originalText = btn.innerHTML;
// Visual feedback
btn.innerHTML = '<i class="fa-solid fa-circle-notch fa-spin mr-2"></i> Processing...';
btn.classList.add('bg-accent', 'text-black', 'border-accent');
// Simulate API latency
setTimeout(() => {
// Update KPIs with new numbers
const newCoverage = Math.floor(Math.random() * 5) + 90; // 90-95%
document.getElementById('kpi-coverage').textContent = newCoverage + '%';
document.getElementById('kpi-bar').style.width = newCoverage + '%';
const newRisk = Math.floor(Math.random() * 2) + 2; // 2-3
document.getElementById('kpi-risk').textContent = newRisk;
// Regenerate suggestions
renderSuggestions();
// Re-animate coverage rings
runCoverage();
// Re-render graph to simulate new links
// Perturb layout slightly
renderGraph();
gsap.from('.node', { scale: 0, duration: 0.5, stagger: 0.01, ease: 'back.out(1.7)' });
// Reset button
btn.innerHTML = originalText;
btn.classList.remove('bg-accent', 'text-black', 'border-accent');
// Flash effect on canvas
const flash = document.createElement('div');
flash.style.position = 'fixed';
flash.style.inset = '0';
flash.style.background = 'white';
flash.style.opacity = '0.1';
flash.style.pointerEvents = 'none';
flash.style.zIndex = '9999';
document.body.appendChild(flash);
gsap.to(flash, { opacity: 0, duration: 0.5, onComplete: () => flash.remove() });
}, 1500);
}
// ==========================================
// Initialization
// ==========================================
window.addEventListener('DOMContentLoaded', () => {
initThreeJS();
renderGraph();
animateCoverage();
renderSuggestions();
initInteractions();
});
</script>
</body>
</html>