🎨 Full UI: White + Light Blue theme across ALL pages (CODE-NARRATIVE style)
#7
by muthuk2 - opened
- frontend/src/App.tsx +15 -40
- frontend/src/index.css +197 -13
- frontend/src/pages/AnalyzePage.tsx +57 -66
- frontend/src/pages/GeneratePage.tsx +68 -123
- frontend/src/pages/HistoryPage.tsx +35 -38
- frontend/src/pages/LandingPage.tsx +101 -120
- frontend/src/pages/SettingsPage.tsx +82 -26
- frontend/tailwind.config.js +24 -6
frontend/src/App.tsx
CHANGED
|
@@ -30,29 +30,29 @@ function useHashRouter(): [Page, (p: Page) => void] {
|
|
| 30 |
function Navbar({ page, onNavigate }: { page: Page; onNavigate: (p: Page) => void }) {
|
| 31 |
if (page === 'landing') return null;
|
| 32 |
|
| 33 |
-
const links: { id: Page; label: string
|
| 34 |
-
{ id: 'generate', label: 'Generate'
|
| 35 |
-
{ id: 'analyze', label: 'Analyze'
|
| 36 |
-
{ id: 'history', label: 'History'
|
| 37 |
-
{ id: 'settings', label: 'Settings'
|
| 38 |
];
|
| 39 |
|
| 40 |
return (
|
| 41 |
-
<nav className="sticky top-0 z-50
|
| 42 |
-
<div className="max-w-
|
| 43 |
-
<button onClick={() => onNavigate('landing')} className="flex items-center gap-2
|
| 44 |
-
<div className="w-8 h-8 rounded-lg bg-
|
| 45 |
-
<span className="font-bold text-sm tracking-tight">TestGenius
|
| 46 |
</button>
|
| 47 |
<div className="flex gap-1">
|
| 48 |
{links.map(l => (
|
| 49 |
<button key={l.id} onClick={() => onNavigate(l.id)}
|
| 50 |
-
className={`px-
|
| 51 |
page === l.id
|
| 52 |
-
? 'bg-
|
| 53 |
-
: 'text-
|
| 54 |
}`}>
|
| 55 |
-
|
| 56 |
</button>
|
| 57 |
))}
|
| 58 |
</div>
|
|
@@ -61,36 +61,11 @@ function Navbar({ page, onNavigate }: { page: Page; onNavigate: (p: Page) => voi
|
|
| 61 |
);
|
| 62 |
}
|
| 63 |
|
| 64 |
-
function ErrorFallback({ error, onReset }: { error: string; onReset: () => void }) {
|
| 65 |
-
return (
|
| 66 |
-
<div className="min-h-screen bg-[#0a0a0f] flex items-center justify-center p-8">
|
| 67 |
-
<div className="bg-red-500/5 border border-red-500/20 rounded-2xl p-10 max-w-md text-center">
|
| 68 |
-
<div className="text-4xl mb-5">⚠️</div>
|
| 69 |
-
<h2 className="text-lg font-bold text-white mb-2">Something went wrong</h2>
|
| 70 |
-
<p className="text-sm text-red-300/80 mb-6">{error}</p>
|
| 71 |
-
<button onClick={onReset}
|
| 72 |
-
className="px-6 py-2.5 bg-white/[0.05] hover:bg-white/[0.08] border border-white/[0.08] rounded-xl text-sm font-medium transition">
|
| 73 |
-
Try Again
|
| 74 |
-
</button>
|
| 75 |
-
</div>
|
| 76 |
-
</div>
|
| 77 |
-
);
|
| 78 |
-
}
|
| 79 |
-
|
| 80 |
export default function App() {
|
| 81 |
const [page, navigate] = useHashRouter();
|
| 82 |
-
const [error, setError] = useState<string | null>(null);
|
| 83 |
-
|
| 84 |
-
useEffect(() => {
|
| 85 |
-
const handler = (e: ErrorEvent) => { setError(e.message); e.preventDefault(); };
|
| 86 |
-
window.addEventListener('error', handler);
|
| 87 |
-
return () => window.removeEventListener('error', handler);
|
| 88 |
-
}, []);
|
| 89 |
-
|
| 90 |
-
if (error) return <ErrorFallback error={error} onReset={() => { setError(null); navigate('landing'); }} />;
|
| 91 |
|
| 92 |
return (
|
| 93 |
-
<div className="min-h-screen
|
| 94 |
<Navbar page={page} onNavigate={navigate} />
|
| 95 |
<main className="animate-fade-in">
|
| 96 |
{page === 'landing' && <LandingPage onNavigate={navigate} />}
|
|
|
|
| 30 |
function Navbar({ page, onNavigate }: { page: Page; onNavigate: (p: Page) => void }) {
|
| 31 |
if (page === 'landing') return null;
|
| 32 |
|
| 33 |
+
const links: { id: Page; label: string }[] = [
|
| 34 |
+
{ id: 'generate', label: 'Generate' },
|
| 35 |
+
{ id: 'analyze', label: 'Analyze' },
|
| 36 |
+
{ id: 'history', label: 'History' },
|
| 37 |
+
{ id: 'settings', label: 'Settings' },
|
| 38 |
];
|
| 39 |
|
| 40 |
return (
|
| 41 |
+
<nav className="sticky top-0 z-50 glass-nav">
|
| 42 |
+
<div className="max-w-7xl mx-auto px-6 py-3 flex items-center justify-between">
|
| 43 |
+
<button onClick={() => onNavigate('landing')} className="flex items-center gap-2 hover:opacity-80 transition">
|
| 44 |
+
<div className="w-8 h-8 rounded-lg bg-blue-50 flex items-center justify-center text-blue-600 text-lg">🧪</div>
|
| 45 |
+
<span className="font-bold text-slate-900 text-sm tracking-tight">TestGenius AI</span>
|
| 46 |
</button>
|
| 47 |
<div className="flex gap-1">
|
| 48 |
{links.map(l => (
|
| 49 |
<button key={l.id} onClick={() => onNavigate(l.id)}
|
| 50 |
+
className={`px-4 py-2 rounded-lg text-sm font-medium transition-all ${
|
| 51 |
page === l.id
|
| 52 |
+
? 'bg-blue-50 text-blue-700 border border-blue-100'
|
| 53 |
+
: 'text-slate-500 hover:text-slate-900 hover:bg-slate-50 border border-transparent'
|
| 54 |
}`}>
|
| 55 |
+
{l.label}
|
| 56 |
</button>
|
| 57 |
))}
|
| 58 |
</div>
|
|
|
|
| 61 |
);
|
| 62 |
}
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
export default function App() {
|
| 65 |
const [page, navigate] = useHashRouter();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
return (
|
| 68 |
+
<div className="min-h-screen" style={{ backgroundColor: 'var(--cn-bg)', color: 'var(--cn-text)' }}>
|
| 69 |
<Navbar page={page} onNavigate={navigate} />
|
| 70 |
<main className="animate-fade-in">
|
| 71 |
{page === 'landing' && <LandingPage onNavigate={navigate} />}
|
frontend/src/index.css
CHANGED
|
@@ -1,37 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
@tailwind base;
|
| 2 |
@tailwind components;
|
| 3 |
@tailwind utilities;
|
| 4 |
|
| 5 |
-
*
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
body {
|
| 9 |
-
|
|
|
|
|
|
|
| 10 |
-webkit-font-smoothing: antialiased;
|
| 11 |
-moz-osx-font-smoothing: grayscale;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
}
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
::-webkit-scrollbar { width: 6px; height: 6px; }
|
| 17 |
::-webkit-scrollbar-track { background: transparent; }
|
| 18 |
-
::-webkit-scrollbar-thumb { background:
|
| 19 |
-
::-webkit-scrollbar-thumb:hover { background:
|
| 20 |
-
|
| 21 |
-
pre { tab-size: 2; }
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
@keyframes fadeIn {
|
| 24 |
-
from { opacity: 0; transform: translateY(
|
| 25 |
to { opacity: 1; transform: translateY(0); }
|
| 26 |
}
|
| 27 |
-
.animate-fade-in { animation: fadeIn 0.
|
| 28 |
|
| 29 |
@keyframes shimmer {
|
| 30 |
0% { background-position: -200% 0; }
|
| 31 |
100% { background-position: 200% 0; }
|
| 32 |
}
|
| 33 |
-
.
|
| 34 |
-
background: linear-gradient(90deg,
|
| 35 |
background-size: 200% 100%;
|
| 36 |
-
animation: shimmer
|
|
|
|
| 37 |
}
|
|
|
|
| 1 |
+
/* ── Fonts ── */
|
| 2 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400&display=swap');
|
| 3 |
+
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');
|
| 4 |
+
|
| 5 |
@tailwind base;
|
| 6 |
@tailwind components;
|
| 7 |
@tailwind utilities;
|
| 8 |
|
| 9 |
+
/* ══════════════════════════════════════════════
|
| 10 |
+
LIGHT MODE (default — white + light blue)
|
| 11 |
+
══════════════════════════════════════════════ */
|
| 12 |
+
:root {
|
| 13 |
+
--cn-bg: #f8fafc;
|
| 14 |
+
--cn-surface: #ffffff;
|
| 15 |
+
--cn-surface-elevated: #f1f5f9;
|
| 16 |
+
--cn-surface-glass: rgba(255,255,255,0.85);
|
| 17 |
+
--cn-border: #e2e8f0;
|
| 18 |
+
--cn-border-strong: #cbd5e1;
|
| 19 |
+
--cn-text: #0f172a;
|
| 20 |
+
--cn-muted: #64748b;
|
| 21 |
+
--cn-accent: #2563eb;
|
| 22 |
+
--cn-accent-hover: #1d4ed8;
|
| 23 |
+
--cn-success: #16a34a;
|
| 24 |
+
--cn-success-bg: rgba(22,163,74,0.08);
|
| 25 |
+
--cn-info: #0891b2;
|
| 26 |
+
--cn-info-bg: rgba(8,145,178,0.08);
|
| 27 |
+
--cn-danger: #dc2626;
|
| 28 |
+
--cn-danger-bg: rgba(220,38,38,0.08);
|
| 29 |
+
--cn-warn: #d97706;
|
| 30 |
+
--cn-warn-bg: rgba(217,119,6,0.08);
|
| 31 |
+
--cn-purple: #7c3aed;
|
| 32 |
+
--cn-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
|
| 33 |
+
--cn-shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
|
| 34 |
+
--cn-shadow-lg: 0 10px 30px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.05);
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
/* ══════════════════════════════════════════════
|
| 38 |
+
DARK MODE
|
| 39 |
+
══════════════════════════════════════════════ */
|
| 40 |
+
.dark {
|
| 41 |
+
--cn-bg: #0a0f1e;
|
| 42 |
+
--cn-surface: #111827;
|
| 43 |
+
--cn-surface-elevated: #1e2a3d;
|
| 44 |
+
--cn-surface-glass: rgba(17,24,39,0.9);
|
| 45 |
+
--cn-border: #1f3050;
|
| 46 |
+
--cn-border-strong: #2d4470;
|
| 47 |
+
--cn-text: #e2e8f0;
|
| 48 |
+
--cn-muted: #8b9dc3;
|
| 49 |
+
--cn-accent: #3b82f6;
|
| 50 |
+
--cn-accent-hover: #60a5fa;
|
| 51 |
+
--cn-success: #22c55e;
|
| 52 |
+
--cn-success-bg: rgba(34,197,94,0.1);
|
| 53 |
+
--cn-info: #22d3ee;
|
| 54 |
+
--cn-info-bg: rgba(34,211,238,0.1);
|
| 55 |
+
--cn-danger: #f87171;
|
| 56 |
+
--cn-danger-bg: rgba(248,113,113,0.1);
|
| 57 |
+
--cn-warn: #fbbf24;
|
| 58 |
+
--cn-warn-bg: rgba(251,191,36,0.1);
|
| 59 |
+
--cn-purple: #a78bfa;
|
| 60 |
+
--cn-shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
|
| 61 |
+
--cn-shadow-md: 0 4px 12px rgba(0,0,0,0.35), 0 2px 4px rgba(0,0,0,0.2);
|
| 62 |
+
--cn-shadow-lg: 0 10px 30px rgba(0,0,0,0.4), 0 4px 10px rgba(0,0,0,0.25);
|
| 63 |
+
}
|
| 64 |
|
| 65 |
+
/* ══════════════════════════════════════════════
|
| 66 |
+
BASE
|
| 67 |
+
══════════════════════════════════════════════ */
|
| 68 |
body {
|
| 69 |
+
background-color: var(--cn-bg);
|
| 70 |
+
color: var(--cn-text);
|
| 71 |
+
font-family: 'Inter', sans-serif;
|
| 72 |
-webkit-font-smoothing: antialiased;
|
| 73 |
-moz-osx-font-smoothing: grayscale;
|
| 74 |
+
overflow-x: hidden;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
::selection { background: rgba(37,99,235,0.15); color: inherit; }
|
| 78 |
+
|
| 79 |
+
/* ══════════════════════════════════════════════
|
| 80 |
+
COMPONENTS
|
| 81 |
+
══════════════════════════════════════════════ */
|
| 82 |
+
.card {
|
| 83 |
+
background: var(--cn-surface);
|
| 84 |
+
border: 1px solid var(--cn-border);
|
| 85 |
+
border-radius: 0.875rem;
|
| 86 |
+
box-shadow: var(--cn-shadow);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
.card-glass {
|
| 90 |
+
background: var(--cn-surface-glass);
|
| 91 |
+
backdrop-filter: blur(16px);
|
| 92 |
+
border: 1px solid var(--cn-border);
|
| 93 |
+
border-radius: 0.875rem;
|
| 94 |
+
box-shadow: var(--cn-shadow);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
.input-base {
|
| 98 |
+
width: 100%;
|
| 99 |
+
border-radius: 0.5rem;
|
| 100 |
+
border: 1px solid var(--cn-border);
|
| 101 |
+
background: var(--cn-surface);
|
| 102 |
+
padding: 0.625rem 0.875rem;
|
| 103 |
+
font-size: 0.875rem;
|
| 104 |
+
color: var(--cn-text);
|
| 105 |
+
outline: none;
|
| 106 |
+
transition: border-color 0.15s, box-shadow 0.15s;
|
| 107 |
+
}
|
| 108 |
+
.input-base::placeholder { color: var(--cn-muted); }
|
| 109 |
+
.input-base:focus {
|
| 110 |
+
border-color: var(--cn-accent);
|
| 111 |
+
box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.btn-primary {
|
| 115 |
+
display: inline-flex;
|
| 116 |
+
align-items: center;
|
| 117 |
+
justify-content: center;
|
| 118 |
+
border-radius: 9999px;
|
| 119 |
+
padding: 0.625rem 1.5rem;
|
| 120 |
+
font-size: 0.875rem;
|
| 121 |
+
font-weight: 600;
|
| 122 |
+
background: var(--cn-accent);
|
| 123 |
+
color: white;
|
| 124 |
+
border: none;
|
| 125 |
+
cursor: pointer;
|
| 126 |
+
transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
|
| 127 |
+
box-shadow: 0 2px 8px rgba(37,99,235,0.25);
|
| 128 |
+
}
|
| 129 |
+
.btn-primary:hover {
|
| 130 |
+
background: var(--cn-accent-hover);
|
| 131 |
+
transform: translateY(-1px);
|
| 132 |
+
box-shadow: 0 4px 16px rgba(37,99,235,0.3);
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
.btn-secondary {
|
| 136 |
+
display: inline-flex;
|
| 137 |
+
align-items: center;
|
| 138 |
+
justify-content: center;
|
| 139 |
+
border-radius: 9999px;
|
| 140 |
+
padding: 0.625rem 1.5rem;
|
| 141 |
+
font-size: 0.875rem;
|
| 142 |
+
font-weight: 600;
|
| 143 |
+
background: var(--cn-surface);
|
| 144 |
+
color: var(--cn-text);
|
| 145 |
+
border: 1px solid var(--cn-border);
|
| 146 |
+
cursor: pointer;
|
| 147 |
+
transition: border-color 0.15s, background 0.15s;
|
| 148 |
+
}
|
| 149 |
+
.btn-secondary:hover {
|
| 150 |
+
border-color: var(--cn-border-strong);
|
| 151 |
+
background: var(--cn-surface-elevated);
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
/* ══════════════════════════════════════════════
|
| 155 |
+
LANDING PAGE HELPERS
|
| 156 |
+
══════════════════════════════════════════════ */
|
| 157 |
+
.glass-nav {
|
| 158 |
+
background: rgba(255,255,255,0.92);
|
| 159 |
+
backdrop-filter: blur(16px);
|
| 160 |
+
border-bottom: 1px solid rgba(0,0,0,0.05);
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
.stripe-hero-bg {
|
| 164 |
+
position: absolute; inset: 0;
|
| 165 |
+
background:
|
| 166 |
+
radial-gradient(circle at 100% 0%, #eef2ff 0%, transparent 40%),
|
| 167 |
+
radial-gradient(circle at 0% 100%, #f0fdf4 0%, transparent 30%);
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
.linear-grid {
|
| 171 |
+
background-size: 40px 40px;
|
| 172 |
+
background-image:
|
| 173 |
+
linear-gradient(to right, rgba(0,0,0,0.03) 1px, transparent 1px),
|
| 174 |
+
linear-gradient(to bottom, rgba(0,0,0,0.03) 1px, transparent 1px);
|
| 175 |
}
|
| 176 |
|
| 177 |
+
.code-window {
|
| 178 |
+
background: #1e1e1e;
|
| 179 |
+
border-radius: 12px;
|
| 180 |
+
box-shadow: 0 20px 50px rgba(0,0,0,0.25);
|
| 181 |
+
border: 1px solid #333;
|
| 182 |
+
font-family: 'JetBrains Mono', monospace;
|
| 183 |
+
overflow: hidden;
|
| 184 |
+
}
|
| 185 |
|
| 186 |
+
.code-header {
|
| 187 |
+
background: #2d2d2d;
|
| 188 |
+
padding: 10px 14px;
|
| 189 |
+
display: flex;
|
| 190 |
+
align-items: center;
|
| 191 |
+
gap: 6px;
|
| 192 |
+
border-bottom: 1px solid #3a3a3a;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
/* ══════════════════════════════════════════════
|
| 196 |
+
SCROLLBAR
|
| 197 |
+
══════════════════════════════════════════════ */
|
| 198 |
::-webkit-scrollbar { width: 6px; height: 6px; }
|
| 199 |
::-webkit-scrollbar-track { background: transparent; }
|
| 200 |
+
::-webkit-scrollbar-thumb { background: var(--cn-border-strong); border-radius: 9999px; }
|
| 201 |
+
::-webkit-scrollbar-thumb:hover { background: var(--cn-muted); }
|
|
|
|
|
|
|
| 202 |
|
| 203 |
+
/* ══════════════════════════════════════════════
|
| 204 |
+
ANIMATIONS
|
| 205 |
+
══════════════════════════════════════════════ */
|
| 206 |
@keyframes fadeIn {
|
| 207 |
+
from { opacity: 0; transform: translateY(6px); }
|
| 208 |
to { opacity: 1; transform: translateY(0); }
|
| 209 |
}
|
| 210 |
+
.animate-fade-in { animation: fadeIn 0.3s ease-out; }
|
| 211 |
|
| 212 |
@keyframes shimmer {
|
| 213 |
0% { background-position: -200% 0; }
|
| 214 |
100% { background-position: 200% 0; }
|
| 215 |
}
|
| 216 |
+
.skeleton {
|
| 217 |
+
background: linear-gradient(90deg, var(--cn-surface-elevated) 25%, var(--cn-border) 50%, var(--cn-surface-elevated) 75%);
|
| 218 |
background-size: 200% 100%;
|
| 219 |
+
animation: shimmer 1.6s infinite;
|
| 220 |
+
border-radius: 0.5rem;
|
| 221 |
}
|
frontend/src/pages/AnalyzePage.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import
|
| 2 |
|
| 3 |
const API = import.meta.env.VITE_API_URL || 'http://localhost:8000';
|
| 4 |
|
|
@@ -6,7 +6,7 @@ export function AnalyzePage() {
|
|
| 6 |
const [code, setCode] = useState('');
|
| 7 |
const [result, setResult] = useState<any>(null);
|
| 8 |
const [loading, setLoading] = useState(false);
|
| 9 |
-
const [activeView, setActiveView] = useState<'complexity' | 'behaviors' | 'gaps' | 'mutations'
|
| 10 |
|
| 11 |
const analyze = async () => {
|
| 12 |
if (!code.trim()) return;
|
|
@@ -14,7 +14,7 @@ export function AnalyzePage() {
|
|
| 14 |
try {
|
| 15 |
const res = await fetch(`${API}/api/v1/generate/multi-agent`, {
|
| 16 |
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
| 17 |
-
body: JSON.stringify({ source_code: code, framework: 'pytest', language: 'python', test_types: ['unit'], max_iterations:
|
| 18 |
});
|
| 19 |
if (res.ok) setResult(await res.json());
|
| 20 |
} catch {} finally { setLoading(false); }
|
|
@@ -22,122 +22,113 @@ export function AnalyzePage() {
|
|
| 22 |
|
| 23 |
const complexity = result?.analysis?.complexity;
|
| 24 |
const gaps = result?.analysis?.gaps;
|
| 25 |
-
const mutations = result?.
|
| 26 |
const behaviors = result?.behavior_coverage;
|
| 27 |
|
| 28 |
return (
|
| 29 |
-
<div className="max-w-
|
| 30 |
<div className="mb-6">
|
| 31 |
-
<h1 className="text-
|
| 32 |
-
<p className="text-
|
| 33 |
</div>
|
| 34 |
|
| 35 |
-
<div className="grid lg:grid-cols-[1fr_1.5fr] gap-
|
| 36 |
{/* Input */}
|
| 37 |
-
<div className="flex flex-col gap-
|
| 38 |
-
<textarea value={code} onChange={e => setCode(e.target.value)}
|
| 39 |
-
|
|
|
|
| 40 |
<button onClick={analyze} disabled={loading || !code.trim()}
|
| 41 |
-
className=
|
| 42 |
{loading ? '🔬 Analyzing...' : '🔬 Run Deep Analysis'}
|
| 43 |
</button>
|
| 44 |
</div>
|
| 45 |
|
| 46 |
{/* Results */}
|
| 47 |
-
<div className="
|
| 48 |
{result ? (
|
| 49 |
<>
|
| 50 |
-
{/*
|
| 51 |
-
<div className="flex border-b border-
|
| 52 |
{[
|
| 53 |
{ id: 'complexity', label: '🧠 Complexity', count: complexity?.functions?.length },
|
| 54 |
{ id: 'behaviors', label: '📊 Behaviors', count: behaviors?.total_behaviors },
|
| 55 |
{ id: 'gaps', label: '🔍 Gaps', count: gaps?.total_gaps },
|
| 56 |
-
{ id: 'mutations', label: '🧬 Mutations', count: mutations?.
|
| 57 |
].map(v => (
|
| 58 |
<button key={v.id} onClick={() => setActiveView(v.id as any)}
|
| 59 |
-
className={`px-3 py-1.5 rounded-lg text-
|
| 60 |
-
activeView === v.id ? 'bg-blue-
|
| 61 |
-
{v.label} {v.count !== undefined && <span className="ml-1 text-
|
| 62 |
</button>
|
| 63 |
))}
|
| 64 |
</div>
|
| 65 |
|
| 66 |
-
<div className="p-
|
| 67 |
-
{/* Complexity View */}
|
| 68 |
{activeView === 'complexity' && complexity && (
|
| 69 |
<div className="space-y-3">
|
| 70 |
-
<div className="flex items-center gap-3 mb-
|
| 71 |
<div className={`w-12 h-12 rounded-xl flex items-center justify-center text-lg font-bold ${
|
| 72 |
-
complexity.grade === 'A' ? 'bg-
|
| 73 |
-
{complexity.grade}
|
| 74 |
-
</div>
|
| 75 |
<div>
|
| 76 |
-
<div className="text-sm font-semibold text-
|
| 77 |
-
<div className="text-xs text-
|
| 78 |
</div>
|
| 79 |
</div>
|
| 80 |
{complexity.functions?.map((f: any, i: number) => (
|
| 81 |
-
<div key={i} className="flex items-center justify-between p-
|
| 82 |
-
<div>
|
| 83 |
-
<span className="text-xs font-mono text-white">{f.name}()</span>
|
| 84 |
-
<span className="text-[10px] text-gray-500 ml-2">complexity: {f.complexity}</span>
|
| 85 |
-
</div>
|
| 86 |
<div className="flex items-center gap-2">
|
| 87 |
-
<span className={`text-[10px] px-2 py-0.5 rounded-full font-
|
| 88 |
-
|
| 89 |
-
{f.priority}
|
| 90 |
-
</span>
|
| 91 |
-
<span className="text-[10px] text-gray-500">{f.suggested_tests} tests</span>
|
| 92 |
</div>
|
| 93 |
</div>
|
| 94 |
))}
|
| 95 |
</div>
|
| 96 |
)}
|
| 97 |
|
| 98 |
-
{/* Behaviors View */}
|
| 99 |
{activeView === 'behaviors' && behaviors && (
|
| 100 |
-
<div className="space-y-
|
| 101 |
<div className="flex items-center gap-3 mb-4">
|
| 102 |
-
<div className="flex-1 h-2 rounded-full bg-
|
| 103 |
-
|
| 104 |
-
</div>
|
| 105 |
-
<span className="text-sm font-medium text-white">{behaviors.coverage_pct}%</span>
|
| 106 |
</div>
|
| 107 |
-
<
|
| 108 |
{behaviors.uncovered_behaviors?.map((b: any, i: number) => (
|
| 109 |
-
<div key={i} className="flex items-center gap-2 p-
|
| 110 |
-
<span className="text-red-
|
| 111 |
-
<span className="text-
|
| 112 |
-
<span className={`text-[10px] px-
|
| 113 |
</div>
|
| 114 |
))}
|
| 115 |
</div>
|
| 116 |
)}
|
| 117 |
|
| 118 |
-
{/* Gaps View */}
|
| 119 |
{activeView === 'gaps' && gaps && (
|
| 120 |
<div className="space-y-2">
|
| 121 |
-
<
|
| 122 |
{gaps.gaps?.map((g: any, i: number) => (
|
| 123 |
-
<div key={i} className="flex items-center gap-
|
| 124 |
-
<span className={`w-
|
| 125 |
-
<span className="text-
|
| 126 |
-
<span className="text-[10px] px-
|
| 127 |
</div>
|
| 128 |
))}
|
| 129 |
</div>
|
| 130 |
)}
|
| 131 |
|
| 132 |
-
{/* Mutations View */}
|
| 133 |
{activeView === 'mutations' && mutations && (
|
| 134 |
-
<div className="space-y-
|
| 135 |
-
<div className="
|
| 136 |
-
|
| 137 |
-
<div
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
</div>
|
| 142 |
))}
|
| 143 |
</div>
|
|
@@ -145,10 +136,10 @@ export function AnalyzePage() {
|
|
| 145 |
</div>
|
| 146 |
</>
|
| 147 |
) : (
|
| 148 |
-
<div className="flex items-center justify-center
|
| 149 |
-
<div>
|
| 150 |
-
<div className="text-4xl mb-4 opacity-
|
| 151 |
-
<p className="text-sm text-
|
| 152 |
</div>
|
| 153 |
</div>
|
| 154 |
)}
|
|
|
|
| 1 |
+
import { useState } from 'react';
|
| 2 |
|
| 3 |
const API = import.meta.env.VITE_API_URL || 'http://localhost:8000';
|
| 4 |
|
|
|
|
| 6 |
const [code, setCode] = useState('');
|
| 7 |
const [result, setResult] = useState<any>(null);
|
| 8 |
const [loading, setLoading] = useState(false);
|
| 9 |
+
const [activeView, setActiveView] = useState<'complexity' | 'behaviors' | 'gaps' | 'mutations'>('complexity');
|
| 10 |
|
| 11 |
const analyze = async () => {
|
| 12 |
if (!code.trim()) return;
|
|
|
|
| 14 |
try {
|
| 15 |
const res = await fetch(`${API}/api/v1/generate/multi-agent`, {
|
| 16 |
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
| 17 |
+
body: JSON.stringify({ source_code: code, framework: 'pytest', language: 'python', test_types: ['unit'], max_iterations: 1 }),
|
| 18 |
});
|
| 19 |
if (res.ok) setResult(await res.json());
|
| 20 |
} catch {} finally { setLoading(false); }
|
|
|
|
| 22 |
|
| 23 |
const complexity = result?.analysis?.complexity;
|
| 24 |
const gaps = result?.analysis?.gaps;
|
| 25 |
+
const mutations = result?.mutation_testing;
|
| 26 |
const behaviors = result?.behavior_coverage;
|
| 27 |
|
| 28 |
return (
|
| 29 |
+
<div className="max-w-7xl mx-auto px-6 py-8">
|
| 30 |
<div className="mb-6">
|
| 31 |
+
<h1 className="text-2xl font-bold text-slate-900">Code Analysis Studio</h1>
|
| 32 |
+
<p className="text-slate-500 text-sm mt-1">Deep-dive into complexity, behaviors, gaps, and mutations</p>
|
| 33 |
</div>
|
| 34 |
|
| 35 |
+
<div className="grid lg:grid-cols-[1fr_1.5fr] gap-6">
|
| 36 |
{/* Input */}
|
| 37 |
+
<div className="flex flex-col gap-4">
|
| 38 |
+
<textarea value={code} onChange={e => setCode(e.target.value)}
|
| 39 |
+
placeholder="Paste source code here for deep analysis..."
|
| 40 |
+
className="input-base min-h-[400px] resize-none font-mono text-sm" />
|
| 41 |
<button onClick={analyze} disabled={loading || !code.trim()}
|
| 42 |
+
className={`btn-primary h-11 text-sm w-full ${loading ? 'opacity-60' : ''}`}>
|
| 43 |
{loading ? '🔬 Analyzing...' : '🔬 Run Deep Analysis'}
|
| 44 |
</button>
|
| 45 |
</div>
|
| 46 |
|
| 47 |
{/* Results */}
|
| 48 |
+
<div className="card overflow-hidden min-h-[460px] flex flex-col">
|
| 49 |
{result ? (
|
| 50 |
<>
|
| 51 |
+
{/* Tabs */}
|
| 52 |
+
<div className="flex border-b border-slate-100 px-4 py-2 gap-1">
|
| 53 |
{[
|
| 54 |
{ id: 'complexity', label: '🧠 Complexity', count: complexity?.functions?.length },
|
| 55 |
{ id: 'behaviors', label: '📊 Behaviors', count: behaviors?.total_behaviors },
|
| 56 |
{ id: 'gaps', label: '🔍 Gaps', count: gaps?.total_gaps },
|
| 57 |
+
{ id: 'mutations', label: '🧬 Mutations', count: mutations?.total_mutants },
|
| 58 |
].map(v => (
|
| 59 |
<button key={v.id} onClick={() => setActiveView(v.id as any)}
|
| 60 |
+
className={`px-3 py-1.5 rounded-lg text-xs font-medium transition ${
|
| 61 |
+
activeView === v.id ? 'bg-blue-50 text-blue-700 border border-blue-100' : 'text-slate-500 hover:text-slate-700'}`}>
|
| 62 |
+
{v.label} {v.count !== undefined && <span className="ml-1 text-slate-400">({v.count})</span>}
|
| 63 |
</button>
|
| 64 |
))}
|
| 65 |
</div>
|
| 66 |
|
| 67 |
+
<div className="p-5 overflow-auto flex-1">
|
|
|
|
| 68 |
{activeView === 'complexity' && complexity && (
|
| 69 |
<div className="space-y-3">
|
| 70 |
+
<div className="flex items-center gap-3 mb-5">
|
| 71 |
<div className={`w-12 h-12 rounded-xl flex items-center justify-center text-lg font-bold ${
|
| 72 |
+
complexity.grade === 'A' ? 'bg-green-50 text-green-700' : complexity.grade === 'B' ? 'bg-blue-50 text-blue-700' : 'bg-amber-50 text-amber-700'}`}>{complexity.grade}</div>
|
|
|
|
|
|
|
| 73 |
<div>
|
| 74 |
+
<div className="text-sm font-semibold text-slate-900">Complexity Grade: {complexity.grade}</div>
|
| 75 |
+
<div className="text-xs text-slate-500">Average: {complexity.average} | Suggested: {complexity.suggested_total_tests} tests</div>
|
| 76 |
</div>
|
| 77 |
</div>
|
| 78 |
{complexity.functions?.map((f: any, i: number) => (
|
| 79 |
+
<div key={i} className="flex items-center justify-between p-3 rounded-lg border border-slate-100 bg-slate-50/50">
|
| 80 |
+
<div><span className="text-sm font-mono text-slate-800">{f.name}()</span><span className="text-xs text-slate-400 ml-2">complexity: {f.complexity}</span></div>
|
|
|
|
|
|
|
|
|
|
| 81 |
<div className="flex items-center gap-2">
|
| 82 |
+
<span className={`text-[10px] px-2 py-0.5 rounded-full font-semibold ${f.priority === 'HIGH' ? 'bg-red-50 text-red-700' : f.priority === 'MEDIUM' ? 'bg-amber-50 text-amber-700' : 'bg-green-50 text-green-700'}`}>{f.priority}</span>
|
| 83 |
+
<span className="text-xs text-slate-400">{f.suggested_tests} tests</span>
|
|
|
|
|
|
|
|
|
|
| 84 |
</div>
|
| 85 |
</div>
|
| 86 |
))}
|
| 87 |
</div>
|
| 88 |
)}
|
| 89 |
|
|
|
|
| 90 |
{activeView === 'behaviors' && behaviors && (
|
| 91 |
+
<div className="space-y-3">
|
| 92 |
<div className="flex items-center gap-3 mb-4">
|
| 93 |
+
<div className="flex-1 h-2 rounded-full bg-slate-100 overflow-hidden"><div className="h-full bg-blue-600 rounded-full" style={{ width: `${behaviors.coverage_pct}%` }} /></div>
|
| 94 |
+
<span className="text-sm font-semibold text-slate-900">{behaviors.coverage_pct}%</span>
|
|
|
|
|
|
|
| 95 |
</div>
|
| 96 |
+
<p className="text-xs text-slate-500 mb-3">{behaviors.covered}/{behaviors.total_behaviors} behaviors covered</p>
|
| 97 |
{behaviors.uncovered_behaviors?.map((b: any, i: number) => (
|
| 98 |
+
<div key={i} className="flex items-center gap-2 p-3 rounded-lg border border-red-100 bg-red-50/50">
|
| 99 |
+
<span className="text-red-600 text-xs">⚠️</span>
|
| 100 |
+
<span className="text-sm text-slate-700 flex-1">{b.description}</span>
|
| 101 |
+
<span className={`text-[10px] px-2 py-0.5 rounded-full font-semibold ${b.priority === 'critical' ? 'bg-red-100 text-red-700' : 'bg-amber-100 text-amber-700'}`}>{b.priority}</span>
|
| 102 |
</div>
|
| 103 |
))}
|
| 104 |
</div>
|
| 105 |
)}
|
| 106 |
|
|
|
|
| 107 |
{activeView === 'gaps' && gaps && (
|
| 108 |
<div className="space-y-2">
|
| 109 |
+
<p className="text-xs text-slate-500 mb-3">Coverage estimate: {gaps.coverage_estimate}% | {gaps.high_priority} high-priority gaps</p>
|
| 110 |
{gaps.gaps?.map((g: any, i: number) => (
|
| 111 |
+
<div key={i} className="flex items-center gap-3 p-3 rounded-lg border border-slate-100">
|
| 112 |
+
<span className={`w-2 h-2 rounded-full ${g.priority === 'HIGH' ? 'bg-red-500' : 'bg-amber-500'}`} />
|
| 113 |
+
<span className="text-sm text-slate-700 flex-1 font-mono">{g.desc}</span>
|
| 114 |
+
<span className="text-[10px] px-2 py-0.5 rounded bg-slate-100 text-slate-500">{g.type}</span>
|
| 115 |
</div>
|
| 116 |
))}
|
| 117 |
</div>
|
| 118 |
)}
|
| 119 |
|
|
|
|
| 120 |
{activeView === 'mutations' && mutations && (
|
| 121 |
+
<div className="space-y-3">
|
| 122 |
+
<div className="grid grid-cols-3 gap-3 mb-4">
|
| 123 |
+
<div className="p-3 rounded-lg bg-green-50 border border-green-100 text-center"><div className="text-xl font-bold text-green-700">{mutations.killed}</div><div className="text-[10px] text-green-600">Killed</div></div>
|
| 124 |
+
<div className="p-3 rounded-lg bg-red-50 border border-red-100 text-center"><div className="text-xl font-bold text-red-700">{mutations.survived}</div><div className="text-[10px] text-red-600">Survived</div></div>
|
| 125 |
+
<div className="p-3 rounded-lg bg-blue-50 border border-blue-100 text-center"><div className="text-xl font-bold text-blue-700">{mutations.mutation_score}%</div><div className="text-[10px] text-blue-600">Score</div></div>
|
| 126 |
+
</div>
|
| 127 |
+
{mutations.surviving_mutants?.map((m: any, i: number) => (
|
| 128 |
+
<div key={i} className="flex items-center gap-3 p-3 rounded-lg border border-slate-100">
|
| 129 |
+
<span className="text-xs text-slate-400 font-mono w-8">L{m.line}</span>
|
| 130 |
+
<span className="text-sm text-slate-700 flex-1">{m.description}</span>
|
| 131 |
+
<span className="text-[10px] px-2 py-0.5 rounded bg-purple-50 text-purple-700">{m.type}</span>
|
| 132 |
</div>
|
| 133 |
))}
|
| 134 |
</div>
|
|
|
|
| 136 |
</div>
|
| 137 |
</>
|
| 138 |
) : (
|
| 139 |
+
<div className="flex-1 flex items-center justify-center">
|
| 140 |
+
<div className="text-center px-8">
|
| 141 |
+
<div className="text-4xl mb-4 opacity-30">🔬</div>
|
| 142 |
+
<p className="text-sm text-slate-500">Paste code and run analysis to see complexity, behaviors, gaps, and mutations.</p>
|
| 143 |
</div>
|
| 144 |
</div>
|
| 145 |
)}
|
frontend/src/pages/GeneratePage.tsx
CHANGED
|
@@ -1,23 +1,22 @@
|
|
| 1 |
-
import
|
| 2 |
|
| 3 |
const API = import.meta.env.VITE_API_URL || 'http://localhost:8000';
|
| 4 |
|
| 5 |
const TABS = [
|
| 6 |
-
{ id: 'requirements', label: 'Requirements', icon: '📝'
|
| 7 |
-
{ id: 'api', label: 'API Spec', icon: '🔌'
|
| 8 |
-
{ id: 'code', label: 'Source Code', icon: '💻'
|
| 9 |
-
{ id: 'flow', label: 'User Flow', icon: '🖥️'
|
| 10 |
];
|
| 11 |
|
| 12 |
const FRAMEWORKS: Record<string, string[]> = {
|
| 13 |
python: ['pytest', 'unittest'],
|
| 14 |
javascript: ['jest', 'mocha', 'cypress', 'playwright'],
|
| 15 |
typescript: ['jest', 'vitest', 'playwright'],
|
| 16 |
-
go: ['go_testing'],
|
| 17 |
};
|
| 18 |
|
| 19 |
export function GeneratePage() {
|
| 20 |
-
const [tab, setTab] = useState('
|
| 21 |
const [input, setInput] = useState('');
|
| 22 |
const [lang, setLang] = useState('python');
|
| 23 |
const [framework, setFramework] = useState('pytest');
|
|
@@ -27,191 +26,137 @@ export function GeneratePage() {
|
|
| 27 |
const [loading, setLoading] = useState(false);
|
| 28 |
const [error, setError] = useState('');
|
| 29 |
const [activeFile, setActiveFile] = useState(0);
|
| 30 |
-
const [stage, setStage] = useState('');
|
| 31 |
|
| 32 |
const generate = async () => {
|
| 33 |
if (!input.trim()) return;
|
| 34 |
-
setLoading(true); setError(''); setResult(null);
|
| 35 |
-
|
| 36 |
try {
|
| 37 |
-
const endpoint = useMultiAgent ? '/api/v1/generate/multi-agent' : `/api/v1/generate/from-${tab === 'api' ? 'api-spec' : tab === 'flow' ? 'flow' : tab}`;
|
| 38 |
-
|
| 39 |
let body: any = { framework, language: lang, test_types: testTypes };
|
| 40 |
if (useMultiAgent) {
|
| 41 |
-
body
|
| 42 |
if (tab === 'requirements') body.requirements = input;
|
| 43 |
else if (tab === 'api') body.openapi_spec = JSON.parse(input);
|
| 44 |
else if (tab === 'code') body.source_code = input;
|
| 45 |
-
else body.requirements = input;
|
| 46 |
} else {
|
| 47 |
if (tab === 'requirements') body.requirements = input;
|
| 48 |
else if (tab === 'api') body.openapi_spec = JSON.parse(input);
|
| 49 |
-
else if (tab === 'code') { body.source_code = input; body.filename =
|
| 50 |
else body.flow_description = input;
|
| 51 |
}
|
| 52 |
-
|
| 53 |
-
setStage(useMultiAgent ? 'Running 5-agent pipeline...' : 'Generating tests...');
|
| 54 |
const res = await fetch(`${API}${endpoint}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
| 55 |
-
|
| 56 |
if (!res.ok) throw new Error((await res.json()).detail || `Error ${res.status}`);
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
// Save history
|
| 61 |
-
const h = JSON.parse(localStorage.getItem('tg_history') || '[]');
|
| 62 |
-
h.unshift({ ...data, _input: input.slice(0, 150), _tab: tab, _time: Date.now() });
|
| 63 |
-
localStorage.setItem('tg_history', JSON.stringify(h.slice(0, 30)));
|
| 64 |
-
} catch (e: any) { setError(e.message); } finally { setLoading(false); setStage(''); }
|
| 65 |
};
|
| 66 |
|
| 67 |
-
const currentTab = TABS.find(t => t.id === tab)!;
|
| 68 |
const testFiles = result?.test_files || [];
|
| 69 |
const quality = result?.quality;
|
| 70 |
const coverage = result?.behavior_coverage;
|
| 71 |
|
| 72 |
return (
|
| 73 |
-
<div className="max-w-
|
| 74 |
-
{/*
|
| 75 |
-
<div className="
|
| 76 |
-
<
|
| 77 |
-
|
| 78 |
-
<p className="text-xs text-gray-500 mt-0.5">Multi-agent AI pipeline • Iterative refinement • Behavior coverage</p>
|
| 79 |
-
</div>
|
| 80 |
-
<div className="flex items-center gap-3">
|
| 81 |
-
{/* Multi-agent toggle */}
|
| 82 |
-
<label className="flex items-center gap-2 cursor-pointer">
|
| 83 |
-
<input type="checkbox" checked={useMultiAgent} onChange={e => setUseMultiAgent(e.target.checked)}
|
| 84 |
-
className="w-4 h-4 rounded bg-white/5 border-white/10 text-emerald-500 focus:ring-emerald-500/20" />
|
| 85 |
-
<span className="text-xs text-gray-400">🧠 Multi-Agent Mode</span>
|
| 86 |
-
</label>
|
| 87 |
-
{/* Language */}
|
| 88 |
-
<select value={lang} onChange={e => { setLang(e.target.value); setFramework(FRAMEWORKS[e.target.value][0]); }}
|
| 89 |
-
className="bg-white/[0.03] border border-white/[0.06] rounded-lg px-3 py-1.5 text-xs text-white focus:border-emerald-500/40 focus:outline-none">
|
| 90 |
-
{Object.keys(FRAMEWORKS).map(l => <option key={l} value={l}>{l}</option>)}
|
| 91 |
-
</select>
|
| 92 |
-
{/* Framework */}
|
| 93 |
-
<select value={framework} onChange={e => setFramework(e.target.value)}
|
| 94 |
-
className="bg-white/[0.03] border border-white/[0.06] rounded-lg px-3 py-1.5 text-xs text-white focus:border-emerald-500/40 focus:outline-none">
|
| 95 |
-
{(FRAMEWORKS[lang] || []).map(f => <option key={f} value={f}>{f}</option>)}
|
| 96 |
-
</select>
|
| 97 |
-
</div>
|
| 98 |
</div>
|
| 99 |
|
| 100 |
-
|
| 101 |
-
<div className="grid lg:grid-cols-[1fr_1.2fr] gap-4 h-[calc(100vh-160px)]">
|
| 102 |
{/* LEFT: Input */}
|
| 103 |
-
<div className="flex flex-col
|
| 104 |
-
{/*
|
| 105 |
-
<div className="flex gap-
|
| 106 |
{TABS.map(t => (
|
| 107 |
<button key={t.id} onClick={() => { setTab(t.id); setInput(''); }}
|
| 108 |
-
className={`
|
| 109 |
-
tab === t.id ? 'bg-
|
| 110 |
-
|
| 111 |
-
</button>
|
| 112 |
))}
|
| 113 |
</div>
|
| 114 |
|
| 115 |
-
{/*
|
| 116 |
-
<div className="flex
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
{['unit', 'integration', 'edge_case', 'security', 'e2e'].map(t => (
|
| 118 |
<button key={t} onClick={() => setTestTypes(testTypes.includes(t) ? testTypes.filter(x => x !== t) : [...testTypes, t])}
|
| 119 |
-
className={`px-
|
| 120 |
-
testTypes.includes(t) ? 'bg-
|
| 121 |
-
{t.replace('_', ' ')}
|
| 122 |
-
</button>
|
| 123 |
))}
|
| 124 |
</div>
|
| 125 |
|
| 126 |
{/* Textarea */}
|
| 127 |
-
<textarea value={input} onChange={e => setInput(e.target.value)}
|
| 128 |
-
|
|
|
|
| 129 |
|
| 130 |
-
{/* Generate
|
| 131 |
<button onClick={generate} disabled={loading || !input.trim()}
|
| 132 |
-
className={`
|
| 133 |
-
|
| 134 |
-
'bg-gradient-to-r from-emerald-600 to-cyan-600 text-white shadow-lg shadow-emerald-500/20 hover:shadow-emerald-500/30 hover:scale-[1.01]'}`}>
|
| 135 |
-
{loading ? `⏳ ${stage}` : useMultiAgent ? '🧠 Run Multi-Agent Pipeline' : '⚡ Generate Tests'}
|
| 136 |
</button>
|
| 137 |
-
{error && <p className="
|
| 138 |
</div>
|
| 139 |
|
| 140 |
{/* RIGHT: Output */}
|
| 141 |
-
<div className="
|
| 142 |
{result ? (
|
| 143 |
<>
|
| 144 |
-
{/*
|
| 145 |
-
<div className="flex items-center justify-between px-
|
| 146 |
<div className="flex items-center gap-4">
|
| 147 |
{quality && (
|
| 148 |
<div className="flex items-center gap-2">
|
| 149 |
-
<div className={`w-
|
| 150 |
-
quality.grade === 'A' ? 'bg-
|
| 151 |
-
|
| 152 |
-
quality.grade === 'C' ? 'bg-amber-500/20 text-amber-300' : 'bg-red-500/20 text-red-300'}`}>
|
| 153 |
-
{quality.grade}
|
| 154 |
-
</div>
|
| 155 |
-
<span className="text-[11px] text-gray-500">Quality {quality.overall}%</span>
|
| 156 |
</div>
|
| 157 |
)}
|
| 158 |
-
{coverage &&
|
| 159 |
-
<div className="flex items-center gap-2">
|
| 160 |
-
<div className="w-16 h-1.5 rounded-full bg-white/[0.05] overflow-hidden">
|
| 161 |
-
<div className="h-full bg-gradient-to-r from-emerald-500 to-cyan-500 rounded-full" style={{ width: `${coverage.coverage_pct}%` }} />
|
| 162 |
-
</div>
|
| 163 |
-
<span className="text-[11px] text-gray-500">{coverage.coverage_pct}% behaviors</span>
|
| 164 |
-
</div>
|
| 165 |
-
)}
|
| 166 |
-
<span className="text-[11px] text-gray-600">{result.processing_time_ms?.toFixed(0)}ms</span>
|
| 167 |
</div>
|
| 168 |
<button onClick={() => navigator.clipboard.writeText(testFiles[activeFile]?.code || '')}
|
| 169 |
-
className="px-3 py-1 rounded-lg bg-
|
| 170 |
-
Copy Code
|
| 171 |
-
</button>
|
| 172 |
</div>
|
| 173 |
|
| 174 |
-
{/*
|
| 175 |
-
{result.iterations_performed > 0 && (
|
| 176 |
-
<div className="px-4 py-1.5 border-b border-white/[0.03] flex items-center gap-2">
|
| 177 |
-
<span className="text-[10px] px-2 py-0.5 rounded-full bg-purple-500/10 text-purple-300 border border-purple-500/20">
|
| 178 |
-
🔄 {result.iterations_performed} refinement iterations
|
| 179 |
-
</span>
|
| 180 |
-
{coverage?.uncovered_behaviors?.length > 0 && (
|
| 181 |
-
<span className="text-[10px] px-2 py-0.5 rounded-full bg-amber-500/10 text-amber-300 border border-amber-500/20">
|
| 182 |
-
⚠️ {coverage.uncovered} untested behaviors
|
| 183 |
-
</span>
|
| 184 |
-
)}
|
| 185 |
-
</div>
|
| 186 |
-
)}
|
| 187 |
-
|
| 188 |
-
{/* File Tabs */}
|
| 189 |
{testFiles.length > 1 && (
|
| 190 |
-
<div className="flex px-
|
| 191 |
{testFiles.map((f: any, i: number) => (
|
| 192 |
<button key={i} onClick={() => setActiveFile(i)}
|
| 193 |
-
className={`px-
|
| 194 |
-
|
| 195 |
-
{f.filename} <span className="text-gray-600 ml-1">({f.num_tests})</span>
|
| 196 |
</button>
|
| 197 |
))}
|
| 198 |
</div>
|
| 199 |
)}
|
| 200 |
|
| 201 |
{/* Code */}
|
| 202 |
-
<pre className="flex-1 overflow-auto p-
|
| 203 |
{testFiles[activeFile]?.code || result.test_code || 'No code generated'}
|
| 204 |
</pre>
|
| 205 |
</>
|
| 206 |
) : (
|
| 207 |
<div className="flex-1 flex items-center justify-center">
|
| 208 |
<div className="text-center px-8">
|
| 209 |
-
<div className="text-5xl mb-5 opacity-
|
| 210 |
-
<h3 className="text-
|
| 211 |
-
<p className="text-
|
| 212 |
-
Paste your input, select test types, and click generate.
|
| 213 |
-
{useMultiAgent && <span className="block mt-1 text-emerald-400/60">Multi-agent mode: tests will be iteratively refined for higher quality.</span>}
|
| 214 |
-
</p>
|
| 215 |
</div>
|
| 216 |
</div>
|
| 217 |
)}
|
|
|
|
| 1 |
+
import { useState } from 'react';
|
| 2 |
|
| 3 |
const API = import.meta.env.VITE_API_URL || 'http://localhost:8000';
|
| 4 |
|
| 5 |
const TABS = [
|
| 6 |
+
{ id: 'requirements', label: 'Requirements', icon: '📝' },
|
| 7 |
+
{ id: 'api', label: 'API Spec', icon: '🔌' },
|
| 8 |
+
{ id: 'code', label: 'Source Code', icon: '💻' },
|
| 9 |
+
{ id: 'flow', label: 'User Flow', icon: '🖥️' },
|
| 10 |
];
|
| 11 |
|
| 12 |
const FRAMEWORKS: Record<string, string[]> = {
|
| 13 |
python: ['pytest', 'unittest'],
|
| 14 |
javascript: ['jest', 'mocha', 'cypress', 'playwright'],
|
| 15 |
typescript: ['jest', 'vitest', 'playwright'],
|
|
|
|
| 16 |
};
|
| 17 |
|
| 18 |
export function GeneratePage() {
|
| 19 |
+
const [tab, setTab] = useState('code');
|
| 20 |
const [input, setInput] = useState('');
|
| 21 |
const [lang, setLang] = useState('python');
|
| 22 |
const [framework, setFramework] = useState('pytest');
|
|
|
|
| 26 |
const [loading, setLoading] = useState(false);
|
| 27 |
const [error, setError] = useState('');
|
| 28 |
const [activeFile, setActiveFile] = useState(0);
|
|
|
|
| 29 |
|
| 30 |
const generate = async () => {
|
| 31 |
if (!input.trim()) return;
|
| 32 |
+
setLoading(true); setError(''); setResult(null);
|
|
|
|
| 33 |
try {
|
| 34 |
+
const endpoint = useMultiAgent ? '/api/v1/generate/multi-agent' : `/api/v1/generate/from-${tab === 'api' ? 'api-spec' : tab === 'flow' ? 'flow' : tab === 'requirements' ? 'requirements' : 'code'}`;
|
|
|
|
| 35 |
let body: any = { framework, language: lang, test_types: testTypes };
|
| 36 |
if (useMultiAgent) {
|
| 37 |
+
body.max_iterations = 3;
|
| 38 |
if (tab === 'requirements') body.requirements = input;
|
| 39 |
else if (tab === 'api') body.openapi_spec = JSON.parse(input);
|
| 40 |
else if (tab === 'code') body.source_code = input;
|
| 41 |
+
else body.requirements = input;
|
| 42 |
} else {
|
| 43 |
if (tab === 'requirements') body.requirements = input;
|
| 44 |
else if (tab === 'api') body.openapi_spec = JSON.parse(input);
|
| 45 |
+
else if (tab === 'code') { body.source_code = input; body.filename = 'source.py'; }
|
| 46 |
else body.flow_description = input;
|
| 47 |
}
|
|
|
|
|
|
|
| 48 |
const res = await fetch(`${API}${endpoint}`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
|
|
|
| 49 |
if (!res.ok) throw new Error((await res.json()).detail || `Error ${res.status}`);
|
| 50 |
+
setResult(await res.json()); setActiveFile(0);
|
| 51 |
+
} catch (e: any) { setError(e.message); } finally { setLoading(false); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
};
|
| 53 |
|
|
|
|
| 54 |
const testFiles = result?.test_files || [];
|
| 55 |
const quality = result?.quality;
|
| 56 |
const coverage = result?.behavior_coverage;
|
| 57 |
|
| 58 |
return (
|
| 59 |
+
<div className="max-w-7xl mx-auto px-6 py-8">
|
| 60 |
+
{/* Header */}
|
| 61 |
+
<div className="mb-6">
|
| 62 |
+
<h1 className="text-2xl font-bold text-slate-900">Test Generation Studio</h1>
|
| 63 |
+
<p className="text-slate-500 text-sm mt-1">Multi-agent AI pipeline • Iterative refinement • Behavior coverage</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
</div>
|
| 65 |
|
| 66 |
+
<div className="grid lg:grid-cols-[1fr_1.2fr] gap-6">
|
|
|
|
| 67 |
{/* LEFT: Input */}
|
| 68 |
+
<div className="flex flex-col gap-4">
|
| 69 |
+
{/* Tabs */}
|
| 70 |
+
<div className="flex gap-2">
|
| 71 |
{TABS.map(t => (
|
| 72 |
<button key={t.id} onClick={() => { setTab(t.id); setInput(''); }}
|
| 73 |
+
className={`px-3 py-2 rounded-lg text-sm font-medium transition-all ${
|
| 74 |
+
tab === t.id ? 'bg-blue-50 text-blue-700 border border-blue-100' : 'text-slate-500 hover:text-slate-900 hover:bg-slate-50 border border-transparent'
|
| 75 |
+
}`}>{t.icon} {t.label}</button>
|
|
|
|
| 76 |
))}
|
| 77 |
</div>
|
| 78 |
|
| 79 |
+
{/* Config row */}
|
| 80 |
+
<div className="flex items-center gap-3 flex-wrap">
|
| 81 |
+
<select value={lang} onChange={e => { setLang(e.target.value); setFramework(FRAMEWORKS[e.target.value]?.[0] || 'pytest'); }}
|
| 82 |
+
className="input-base w-auto">
|
| 83 |
+
{Object.keys(FRAMEWORKS).map(l => <option key={l} value={l}>{l}</option>)}
|
| 84 |
+
</select>
|
| 85 |
+
<select value={framework} onChange={e => setFramework(e.target.value)} className="input-base w-auto">
|
| 86 |
+
{(FRAMEWORKS[lang] || []).map(f => <option key={f} value={f}>{f}</option>)}
|
| 87 |
+
</select>
|
| 88 |
+
<label className="flex items-center gap-2 text-sm text-slate-600 cursor-pointer ml-auto">
|
| 89 |
+
<input type="checkbox" checked={useMultiAgent} onChange={e => setUseMultiAgent(e.target.checked)} className="w-4 h-4 rounded border-slate-300 text-blue-600 focus:ring-blue-500" />
|
| 90 |
+
🧠 Multi-Agent
|
| 91 |
+
</label>
|
| 92 |
+
</div>
|
| 93 |
+
|
| 94 |
+
{/* Test type pills */}
|
| 95 |
+
<div className="flex flex-wrap gap-2">
|
| 96 |
{['unit', 'integration', 'edge_case', 'security', 'e2e'].map(t => (
|
| 97 |
<button key={t} onClick={() => setTestTypes(testTypes.includes(t) ? testTypes.filter(x => x !== t) : [...testTypes, t])}
|
| 98 |
+
className={`px-3 py-1 rounded-full text-xs font-medium border transition-all ${
|
| 99 |
+
testTypes.includes(t) ? 'bg-blue-50 text-blue-700 border-blue-200' : 'bg-white text-slate-500 border-slate-200 hover:border-slate-300'
|
| 100 |
+
}`}>{t.replace('_', ' ')}</button>
|
|
|
|
| 101 |
))}
|
| 102 |
</div>
|
| 103 |
|
| 104 |
{/* Textarea */}
|
| 105 |
+
<textarea value={input} onChange={e => setInput(e.target.value)}
|
| 106 |
+
placeholder={tab === 'code' ? 'Paste source code here...' : tab === 'api' ? 'Paste OpenAPI JSON spec...' : tab === 'flow' ? 'Describe user flow...' : 'Paste requirements...'}
|
| 107 |
+
className="input-base flex-1 min-h-[300px] resize-none font-mono text-sm leading-relaxed" />
|
| 108 |
|
| 109 |
+
{/* Generate button */}
|
| 110 |
<button onClick={generate} disabled={loading || !input.trim()}
|
| 111 |
+
className={`btn-primary h-12 text-base w-full ${loading ? 'opacity-60 cursor-wait' : ''}`}>
|
| 112 |
+
{loading ? '⏳ Generating...' : useMultiAgent ? '🧠 Run Multi-Agent Pipeline' : '⚡ Generate Tests'}
|
|
|
|
|
|
|
| 113 |
</button>
|
| 114 |
+
{error && <p className="text-red-600 text-sm bg-red-50 px-4 py-2 rounded-lg border border-red-100">{error}</p>}
|
| 115 |
</div>
|
| 116 |
|
| 117 |
{/* RIGHT: Output */}
|
| 118 |
+
<div className="card min-h-[500px] flex flex-col overflow-hidden">
|
| 119 |
{result ? (
|
| 120 |
<>
|
| 121 |
+
{/* Top bar */}
|
| 122 |
+
<div className="flex items-center justify-between px-5 py-3 border-b border-slate-100 bg-slate-50/50">
|
| 123 |
<div className="flex items-center gap-4">
|
| 124 |
{quality && (
|
| 125 |
<div className="flex items-center gap-2">
|
| 126 |
+
<div className={`w-8 h-8 rounded-lg flex items-center justify-center text-sm font-bold ${
|
| 127 |
+
quality.grade === 'A' ? 'bg-green-50 text-green-700' : quality.grade === 'B' ? 'bg-blue-50 text-blue-700' : 'bg-amber-50 text-amber-700'}`}>{quality.grade}</div>
|
| 128 |
+
<span className="text-xs text-slate-500">{quality.overall}%</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
</div>
|
| 130 |
)}
|
| 131 |
+
{coverage && <span className="text-xs text-slate-500">{coverage.coverage_pct}% behaviors covered</span>}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
</div>
|
| 133 |
<button onClick={() => navigator.clipboard.writeText(testFiles[activeFile]?.code || '')}
|
| 134 |
+
className="px-3 py-1.5 rounded-lg bg-blue-50 text-blue-700 text-xs font-medium hover:bg-blue-100 transition">Copy</button>
|
|
|
|
|
|
|
| 135 |
</div>
|
| 136 |
|
| 137 |
+
{/* File tabs */}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
{testFiles.length > 1 && (
|
| 139 |
+
<div className="flex px-4 py-2 border-b border-slate-100 gap-1 overflow-x-auto">
|
| 140 |
{testFiles.map((f: any, i: number) => (
|
| 141 |
<button key={i} onClick={() => setActiveFile(i)}
|
| 142 |
+
className={`px-3 py-1 rounded text-xs font-medium transition ${i === activeFile ? 'bg-blue-50 text-blue-700' : 'text-slate-500 hover:text-slate-700'}`}>
|
| 143 |
+
{f.filename} ({f.num_tests})
|
|
|
|
| 144 |
</button>
|
| 145 |
))}
|
| 146 |
</div>
|
| 147 |
)}
|
| 148 |
|
| 149 |
{/* Code */}
|
| 150 |
+
<pre className="flex-1 overflow-auto p-5 text-sm text-slate-800 font-mono leading-[1.7] bg-white">
|
| 151 |
{testFiles[activeFile]?.code || result.test_code || 'No code generated'}
|
| 152 |
</pre>
|
| 153 |
</>
|
| 154 |
) : (
|
| 155 |
<div className="flex-1 flex items-center justify-center">
|
| 156 |
<div className="text-center px-8">
|
| 157 |
+
<div className="text-5xl mb-5 opacity-30">🧪</div>
|
| 158 |
+
<h3 className="text-lg font-semibold text-slate-700 mb-2">Ready to Generate</h3>
|
| 159 |
+
<p className="text-sm text-slate-500 max-w-sm">Paste your input and click generate. {useMultiAgent && <span className="text-blue-600">Multi-agent mode will iteratively refine for higher quality.</span>}</p>
|
|
|
|
|
|
|
|
|
|
| 160 |
</div>
|
| 161 |
</div>
|
| 162 |
)}
|
frontend/src/pages/HistoryPage.tsx
CHANGED
|
@@ -1,66 +1,63 @@
|
|
| 1 |
-
import
|
| 2 |
|
| 3 |
export function HistoryPage() {
|
| 4 |
const [history, setHistory] = useState<any[]>([]);
|
| 5 |
const [selected, setSelected] = useState<any>(null);
|
| 6 |
|
| 7 |
-
useEffect(() => {
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
if (d < 3600000) return `${Math.floor(d/60000)}m ago`;
|
| 13 |
-
if (d < 86400000) return `${Math.floor(d/3600000)}h ago`;
|
| 14 |
-
return `${Math.floor(d/86400000)}d ago`;
|
| 15 |
-
};
|
| 16 |
|
| 17 |
return (
|
| 18 |
-
<div className="max-w-
|
| 19 |
-
<div className="
|
| 20 |
-
<
|
| 21 |
-
|
| 22 |
</div>
|
| 23 |
|
| 24 |
{history.length === 0 ? (
|
| 25 |
-
<div className="
|
|
|
|
|
|
|
|
|
|
| 26 |
) : (
|
| 27 |
-
<div className="grid lg:grid-cols-[280px_1fr] gap-
|
| 28 |
-
|
|
|
|
| 29 |
{history.map((item, i) => (
|
| 30 |
<button key={i} onClick={() => setSelected(item)}
|
| 31 |
-
className={`w-full text-left p-3 rounded-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
</div>
|
| 36 |
-
<div className="
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
</div>
|
| 42 |
</button>
|
| 43 |
))}
|
| 44 |
</div>
|
| 45 |
|
| 46 |
-
|
|
|
|
| 47 |
{selected ? (
|
| 48 |
<>
|
| 49 |
-
<div className="
|
| 50 |
-
<
|
| 51 |
-
{selected.quality && <span className={`text-xs font-bold px-2 py-0.5 rounded ${selected.quality.grade === 'A' ? 'bg-emerald-500/10 text-emerald-300' : 'bg-blue-500/10 text-blue-300'}`}>Grade {selected.quality.grade}</span>}
|
| 52 |
-
<span className="text-[11px] text-gray-500">{selected.processing_time_ms?.toFixed(0)}ms</span>
|
| 53 |
-
{selected.iterations_performed > 0 && <span className="text-[11px] text-purple-400">🔄 {selected.iterations_performed} iterations</span>}
|
| 54 |
-
</div>
|
| 55 |
<button onClick={() => navigator.clipboard.writeText(selected.test_files?.[0]?.code || selected.test_code || '')}
|
| 56 |
-
className="px-3 py-1
|
| 57 |
</div>
|
| 58 |
-
<pre className="flex-1 overflow-auto p-
|
| 59 |
-
{selected.test_files?.[0]?.code || selected.test_code || 'No code
|
| 60 |
</pre>
|
| 61 |
</>
|
| 62 |
) : (
|
| 63 |
-
<div className="flex-1 flex items-center justify-center text-
|
| 64 |
)}
|
| 65 |
</div>
|
| 66 |
</div>
|
|
|
|
| 1 |
+
import { useState, useEffect } from 'react';
|
| 2 |
|
| 3 |
export function HistoryPage() {
|
| 4 |
const [history, setHistory] = useState<any[]>([]);
|
| 5 |
const [selected, setSelected] = useState<any>(null);
|
| 6 |
|
| 7 |
+
useEffect(() => {
|
| 8 |
+
const h = JSON.parse(localStorage.getItem('tg_history') || '[]');
|
| 9 |
+
setHistory(h);
|
| 10 |
+
if (h.length) setSelected(h[0]);
|
| 11 |
+
}, []);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
return (
|
| 14 |
+
<div className="max-w-7xl mx-auto px-6 py-8">
|
| 15 |
+
<div className="mb-6">
|
| 16 |
+
<h1 className="text-2xl font-bold text-slate-900">Generation History</h1>
|
| 17 |
+
<p className="text-slate-500 text-sm mt-1">Previous test generation runs (stored locally)</p>
|
| 18 |
</div>
|
| 19 |
|
| 20 |
{history.length === 0 ? (
|
| 21 |
+
<div className="card p-12 text-center">
|
| 22 |
+
<div className="text-4xl mb-4 opacity-30">📋</div>
|
| 23 |
+
<p className="text-slate-500">No history yet. Generate some tests first!</p>
|
| 24 |
+
</div>
|
| 25 |
) : (
|
| 26 |
+
<div className="grid lg:grid-cols-[280px_1fr] gap-6">
|
| 27 |
+
{/* List */}
|
| 28 |
+
<div className="space-y-2 max-h-[600px] overflow-y-auto">
|
| 29 |
{history.map((item, i) => (
|
| 30 |
<button key={i} onClick={() => setSelected(item)}
|
| 31 |
+
className={`w-full text-left p-3 rounded-lg border transition-all ${
|
| 32 |
+
selected === item ? 'bg-blue-50 border-blue-200' : 'bg-white border-slate-200 hover:border-slate-300'
|
| 33 |
+
}`}>
|
| 34 |
+
<div className="text-sm font-medium text-slate-900 truncate">{item.run_id || `Run ${i + 1}`}</div>
|
| 35 |
+
<div className="text-xs text-slate-500 mt-1">{item._input?.slice(0, 60) || 'No description'}</div>
|
| 36 |
+
<div className="flex items-center gap-2 mt-2">
|
| 37 |
+
{item.quality && <span className={`text-[10px] px-2 py-0.5 rounded-full font-semibold ${
|
| 38 |
+
item.quality.grade === 'A' ? 'bg-green-50 text-green-700' : 'bg-blue-50 text-blue-700'
|
| 39 |
+
}`}>Grade {item.quality.grade}</span>}
|
| 40 |
+
<span className="text-[10px] text-slate-400">{item.processing_time_ms?.toFixed(0)}ms</span>
|
| 41 |
</div>
|
| 42 |
</button>
|
| 43 |
))}
|
| 44 |
</div>
|
| 45 |
|
| 46 |
+
{/* Detail */}
|
| 47 |
+
<div className="card overflow-hidden flex flex-col">
|
| 48 |
{selected ? (
|
| 49 |
<>
|
| 50 |
+
<div className="px-5 py-3 border-b border-slate-100 bg-slate-50/50 flex items-center justify-between">
|
| 51 |
+
<span className="text-sm font-medium text-slate-900">{selected.run_id}</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
<button onClick={() => navigator.clipboard.writeText(selected.test_files?.[0]?.code || selected.test_code || '')}
|
| 53 |
+
className="px-3 py-1 rounded-lg bg-blue-50 text-blue-700 text-xs font-medium hover:bg-blue-100">Copy Code</button>
|
| 54 |
</div>
|
| 55 |
+
<pre className="flex-1 overflow-auto p-5 text-sm text-slate-800 font-mono leading-[1.7]">
|
| 56 |
+
{selected.test_files?.[0]?.code || selected.test_code || 'No code'}
|
| 57 |
</pre>
|
| 58 |
</>
|
| 59 |
) : (
|
| 60 |
+
<div className="flex-1 flex items-center justify-center text-slate-500 text-sm">Select a run to view</div>
|
| 61 |
)}
|
| 62 |
</div>
|
| 63 |
</div>
|
frontend/src/pages/LandingPage.tsx
CHANGED
|
@@ -2,58 +2,34 @@ import { useState } from "react";
|
|
| 2 |
|
| 3 |
interface Props { onNavigate: (page: any) => void; }
|
| 4 |
|
| 5 |
-
function GithubIcon() {
|
| 6 |
-
return (
|
| 7 |
-
<svg className="h-5 w-5" fill="currentColor" viewBox="0 0 24 24">
|
| 8 |
-
<path fillRule="evenodd" clipRule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" />
|
| 9 |
-
</svg>
|
| 10 |
-
);
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
function TwitterIcon() {
|
| 14 |
-
return (
|
| 15 |
-
<svg className="h-5 w-5" fill="currentColor" viewBox="0 0 24 24">
|
| 16 |
-
<path d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84" />
|
| 17 |
-
</svg>
|
| 18 |
-
);
|
| 19 |
-
}
|
| 20 |
-
|
| 21 |
const FEATURES = [
|
| 22 |
-
{ icon: "🔬", title: "Code Analysis", desc: "
|
| 23 |
-
{ icon: "🧬", title: "Mutation Testing", desc: "Real mutation execution — mutates
|
| 24 |
-
{ icon: "📊", title: "Behavior Coverage", desc: "Semantic AST-based mapping of
|
| 25 |
-
{ icon: "🔄", title: "Iterative Refinement", desc: "MuTAP
|
| 26 |
-
{ icon: "🔐", title: "Security Scanner", desc: "OWASP
|
| 27 |
-
{ icon: "⚡", title: "Multi-Agent Pipeline", desc: "5
|
| 28 |
];
|
| 29 |
|
| 30 |
export function LandingPage({ onNavigate }: Props) {
|
| 31 |
-
const [isDark, setIsDark] = useState(true);
|
| 32 |
-
const toggle = () => setIsDark(!isDark);
|
| 33 |
-
|
| 34 |
return (
|
| 35 |
-
<div className=
|
| 36 |
|
| 37 |
{/* Nav */}
|
| 38 |
-
<header className=
|
| 39 |
<div className="max-w-7xl mx-auto px-6 py-4 flex items-center justify-between">
|
| 40 |
<div className="flex items-center gap-2">
|
| 41 |
-
<div className=
|
| 42 |
-
<h2 className=
|
| 43 |
</div>
|
| 44 |
<nav className="hidden md:flex items-center gap-8">
|
| 45 |
-
{["Features", "Pipeline", "Research"
|
| 46 |
-
<a key={item} href={`#${item.toLowerCase()}`} className=
|
| 47 |
))}
|
| 48 |
</nav>
|
| 49 |
-
<
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
</button>
|
| 53 |
-
<button onClick={() => onNavigate('generate')} className={`flex items-center justify-center rounded-full h-9 px-5 text-sm font-medium transition-all hover:shadow-lg ${isDark ? 'bg-white hover:bg-slate-100 text-slate-900' : 'bg-slate-900 hover:bg-slate-800 text-white'}`}>
|
| 54 |
-
Start Building →
|
| 55 |
-
</button>
|
| 56 |
-
</div>
|
| 57 |
</div>
|
| 58 |
</header>
|
| 59 |
|
|
@@ -61,64 +37,71 @@ export function LandingPage({ onNavigate }: Props) {
|
|
| 61 |
|
| 62 |
{/* Hero */}
|
| 63 |
<section className="relative pt-20 pb-32 lg:pt-32 lg:pb-40 overflow-hidden">
|
| 64 |
-
<div className=
|
| 65 |
-
<div className=
|
|
|
|
| 66 |
</div>
|
|
|
|
| 67 |
<div className="max-w-7xl mx-auto px-6 grid lg:grid-cols-2 gap-16 items-center relative z-10">
|
|
|
|
| 68 |
<div className="flex flex-col gap-8 max-w-2xl">
|
| 69 |
-
<div className=
|
| 70 |
-
<span className="flex h-2 w-2 rounded-full bg-
|
| 71 |
-
<span className=
|
| 72 |
</div>
|
| 73 |
-
|
| 74 |
-
|
|
|
|
| 75 |
</h1>
|
| 76 |
-
|
| 77 |
-
|
|
|
|
| 78 |
</p>
|
|
|
|
| 79 |
<div className="flex flex-wrap gap-4 pt-2">
|
| 80 |
-
<button onClick={() => onNavigate('generate')} className="
|
| 81 |
Start Generating Tests →
|
| 82 |
</button>
|
| 83 |
-
<button onClick={() => onNavigate('analyze')} className=
|
| 84 |
Analyze Code First
|
| 85 |
</button>
|
| 86 |
</div>
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
<div className="flex items-center gap-2"><span className="text-green-
|
|
|
|
| 90 |
</div>
|
| 91 |
</div>
|
| 92 |
|
| 93 |
-
{/* Mock
|
| 94 |
<div className="relative w-full group hidden lg:block">
|
| 95 |
-
<div className="absolute -inset-4 bg-gradient-to-r from-
|
| 96 |
-
<div className=
|
| 97 |
-
<div className=
|
| 98 |
-
<div className="flex gap-1.5"><div className="w-3 h-3 rounded-full bg-
|
| 99 |
-
<div className=
|
| 100 |
</div>
|
| 101 |
-
<div className=
|
| 102 |
<div className="flex gap-6">
|
| 103 |
<div className="flex-1 space-y-3">
|
| 104 |
-
<div className=
|
| 105 |
-
<div className=
|
| 106 |
-
<div className=
|
| 107 |
-
<div className=
|
| 108 |
-
<div className=
|
| 109 |
</div>
|
| 110 |
<div className="w-48 bg-slate-900 rounded-lg p-4 shadow-xl text-white transform translate-y-4 border border-slate-700 shrink-0">
|
| 111 |
-
<div className="flex items-center gap-2 mb-2"><span className="w-2 h-2 rounded-full bg-
|
| 112 |
<div className="text-3xl font-black mb-1">A</div>
|
| 113 |
<div className="text-xs text-slate-400">85/100 • 18 tests</div>
|
| 114 |
-
<div className="mt-3 h-1.5 w-full bg-slate-800 rounded-full overflow-hidden"><div className="h-full bg-gradient-to-r from-
|
| 115 |
</div>
|
| 116 |
</div>
|
| 117 |
-
<div className=
|
| 118 |
-
<span className=
|
| 119 |
<div>
|
| 120 |
-
<div className=
|
| 121 |
-
<div className=
|
| 122 |
</div>
|
| 123 |
</div>
|
| 124 |
</div>
|
|
@@ -127,20 +110,20 @@ export function LandingPage({ onNavigate }: Props) {
|
|
| 127 |
</div>
|
| 128 |
</section>
|
| 129 |
|
| 130 |
-
{/* Features
|
| 131 |
-
<section id="features" className=
|
| 132 |
-
<div className=
|
| 133 |
<div className="max-w-7xl mx-auto px-6 relative z-10">
|
| 134 |
<div className="text-center max-w-3xl mx-auto mb-20">
|
| 135 |
-
<h2 className=
|
| 136 |
-
<p className=
|
| 137 |
</div>
|
| 138 |
-
<div className=
|
| 139 |
{FEATURES.map(({ icon, title, desc }) => (
|
| 140 |
-
<div key={title} className=
|
| 141 |
-
<div className=
|
| 142 |
-
<h3 className=
|
| 143 |
-
<p className=
|
| 144 |
</div>
|
| 145 |
))}
|
| 146 |
</div>
|
|
@@ -148,31 +131,33 @@ export function LandingPage({ onNavigate }: Props) {
|
|
| 148 |
</section>
|
| 149 |
|
| 150 |
{/* Code Demo */}
|
| 151 |
-
<section id="pipeline" className=
|
| 152 |
<div className="max-w-6xl mx-auto px-6">
|
| 153 |
-
<div className="mb-12
|
| 154 |
-
<h2 className=
|
| 155 |
-
<p className=
|
| 156 |
</div>
|
| 157 |
-
<div className="max-w-4xl mx-auto
|
| 158 |
-
<div className="
|
| 159 |
-
<div className="w-
|
| 160 |
-
<
|
|
|
|
|
|
|
| 161 |
</div>
|
| 162 |
<div className="grid md:grid-cols-2">
|
| 163 |
<div className="bg-[#1e1e1e] p-6 border-r border-[#333]">
|
| 164 |
-
<div className="text-[10px] font-mono text-slate-500 uppercase mb-3">Input
|
| 165 |
-
<pre className="text-sm leading-6
|
| 166 |
-
<span className="text-[#569cd6]">def </span><span className="text-[#dcdcaa]">calculate_discount</span>(price, type):{"\n"}{" "}<span className="text-[#c586c0]">if</span> price {"<="} <span className="text-[#b5cea8]">0</span>:{"\n"}{" "}<span className="text-[#c586c0]">raise</span> <span className="text-[#4ec9b0]">ValueError</span>(
|
| 167 |
</pre>
|
| 168 |
</div>
|
| 169 |
<div className="bg-[#252526] p-6 relative">
|
| 170 |
-
<div className="absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-
|
| 171 |
-
<div className="flex items-center gap-2 mb-4"><span className="text-
|
| 172 |
<div className="space-y-3">
|
| 173 |
-
<div className="bg-[#333] p-3 rounded border-l-2 border-
|
| 174 |
-
<div className="bg-[#333] p-3 rounded border-l-2 border-purple-500"><p className="text-xs text-[#999]
|
| 175 |
-
<div className="bg-[#333] p-3 rounded border-l-2 border-cyan-500"><p className="text-xs text-[#999]
|
| 176 |
</div>
|
| 177 |
</div>
|
| 178 |
</div>
|
|
@@ -181,13 +166,13 @@ export function LandingPage({ onNavigate }: Props) {
|
|
| 181 |
</section>
|
| 182 |
|
| 183 |
{/* Stats */}
|
| 184 |
-
<section className=
|
| 185 |
<div className="max-w-7xl mx-auto px-6">
|
| 186 |
<div className="grid md:grid-cols-4 gap-12 text-center">
|
| 187 |
-
{[{ stat: "85%+", label: "Quality Score" }, { stat: "5", label: "AI Agents" }, { stat: "<4s", label: "
|
| 188 |
-
<div key={label} className={`flex flex-col gap-1 items-center ${i < 3 ?
|
| 189 |
-
<p className=
|
| 190 |
-
<p className=
|
| 191 |
</div>
|
| 192 |
))}
|
| 193 |
</div>
|
|
@@ -196,40 +181,36 @@ export function LandingPage({ onNavigate }: Props) {
|
|
| 196 |
|
| 197 |
{/* CTA */}
|
| 198 |
<section className="bg-slate-900 py-24 relative overflow-hidden">
|
| 199 |
-
<div className="absolute top-0 right-0 w-[500px] h-[500px] bg-
|
| 200 |
-
<div className="absolute bottom-0 left-0 w-[400px] h-[400px] bg-
|
| 201 |
<div className="max-w-3xl mx-auto px-6 text-center relative z-10">
|
| 202 |
<h2 className="text-3xl md:text-4xl font-bold text-white mb-6 tracking-tight">Ready to generate better tests?</h2>
|
| 203 |
-
<p className="text-slate-400 mb-10 text-lg">Join QA teams who transformed
|
| 204 |
<div className="flex flex-col sm:flex-row items-center justify-center gap-4">
|
| 205 |
-
<button onClick={() => onNavigate('generate')} className="w-full sm:w-auto
|
| 206 |
-
<button onClick={() => onNavigate('settings')} className="w-full sm:w-auto
|
| 207 |
</div>
|
| 208 |
</div>
|
| 209 |
</section>
|
| 210 |
</main>
|
| 211 |
|
| 212 |
{/* Footer */}
|
| 213 |
-
<footer className=
|
| 214 |
<div className="max-w-7xl mx-auto px-6">
|
| 215 |
<div className="grid grid-cols-2 md:grid-cols-5 gap-8 mb-16">
|
| 216 |
<div className="col-span-2">
|
| 217 |
-
<div className=
|
| 218 |
-
<p className=
|
| 219 |
</div>
|
| 220 |
-
{[{
|
| 221 |
-
<div key={
|
| 222 |
-
<h4 className=
|
| 223 |
-
{
|
| 224 |
</div>
|
| 225 |
))}
|
| 226 |
</div>
|
| 227 |
-
<div className=
|
| 228 |
-
<
|
| 229 |
-
<div className="flex gap-6">
|
| 230 |
-
<a href="https://github.com/MUTHUKUMARAN-K-1" target="_blank" rel="noopener noreferrer" className={`transition-colors ${isDark ? 'text-slate-500 hover:text-white' : 'text-slate-400 hover:text-slate-900'}`}><GithubIcon /></a>
|
| 231 |
-
<a href="#" className={`transition-colors ${isDark ? 'text-slate-500 hover:text-white' : 'text-slate-400 hover:text-slate-900'}`}><TwitterIcon /></a>
|
| 232 |
-
</div>
|
| 233 |
</div>
|
| 234 |
</div>
|
| 235 |
</footer>
|
|
|
|
| 2 |
|
| 3 |
interface Props { onNavigate: (page: any) => void; }
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
const FEATURES = [
|
| 6 |
+
{ icon: "🔬", title: "Code Analysis", desc: "AST-based complexity scoring, behavior extraction, and coverage gap detection." },
|
| 7 |
+
{ icon: "🧬", title: "Mutation Testing", desc: "Real mutation execution — mutates code, runs tests, identifies survivors." },
|
| 8 |
+
{ icon: "📊", title: "Behavior Coverage", desc: "Semantic AST-based mapping of tested vs untested behaviors." },
|
| 9 |
+
{ icon: "🔄", title: "Iterative Refinement", desc: "MuTAP loop: generate → validate → improve until Grade A." },
|
| 10 |
+
{ icon: "🔐", title: "Security Scanner", desc: "OWASP: IDOR, injection, mass assignment, missing auth detection." },
|
| 11 |
+
{ icon: "⚡", title: "Multi-Agent Pipeline", desc: "5 AI agents: Analyzer, Generator, Validator, Refiner, Mapper." },
|
| 12 |
];
|
| 13 |
|
| 14 |
export function LandingPage({ onNavigate }: Props) {
|
|
|
|
|
|
|
|
|
|
| 15 |
return (
|
| 16 |
+
<div className="relative flex min-h-screen w-full flex-col bg-white text-slate-900 antialiased overflow-x-hidden">
|
| 17 |
|
| 18 |
{/* Nav */}
|
| 19 |
+
<header className="sticky top-0 z-50 glass-nav w-full">
|
| 20 |
<div className="max-w-7xl mx-auto px-6 py-4 flex items-center justify-between">
|
| 21 |
<div className="flex items-center gap-2">
|
| 22 |
+
<div className="w-8 h-8 flex items-center justify-center rounded-lg bg-blue-50 text-blue-600 text-lg">🧪</div>
|
| 23 |
+
<h2 className="text-slate-900 text-lg font-bold tracking-tight">TestGenius AI</h2>
|
| 24 |
</div>
|
| 25 |
<nav className="hidden md:flex items-center gap-8">
|
| 26 |
+
{["Features", "Pipeline", "Research"].map((item) => (
|
| 27 |
+
<a key={item} href={`#${item.toLowerCase()}`} className="text-slate-500 hover:text-blue-600 text-sm font-medium transition-colors">{item}</a>
|
| 28 |
))}
|
| 29 |
</nav>
|
| 30 |
+
<button onClick={() => onNavigate('generate')} className="flex items-center justify-center rounded-full h-9 px-5 bg-slate-900 hover:bg-slate-800 text-white text-sm font-medium transition-all hover:shadow-lg">
|
| 31 |
+
Start Building →
|
| 32 |
+
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
</div>
|
| 34 |
</header>
|
| 35 |
|
|
|
|
| 37 |
|
| 38 |
{/* Hero */}
|
| 39 |
<section className="relative pt-20 pb-32 lg:pt-32 lg:pb-40 overflow-hidden">
|
| 40 |
+
<div className="absolute inset-0 z-0">
|
| 41 |
+
<div className="stripe-hero-bg opacity-60" />
|
| 42 |
+
<div className="linear-grid absolute inset-0 opacity-40" />
|
| 43 |
</div>
|
| 44 |
+
|
| 45 |
<div className="max-w-7xl mx-auto px-6 grid lg:grid-cols-2 gap-16 items-center relative z-10">
|
| 46 |
+
{/* Left */}
|
| 47 |
<div className="flex flex-col gap-8 max-w-2xl">
|
| 48 |
+
<div className="inline-flex items-center gap-2 px-3 py-1.5 rounded-full bg-blue-50 border border-blue-100 w-fit shadow-sm">
|
| 49 |
+
<span className="flex h-2 w-2 rounded-full bg-blue-600 relative"><span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-blue-600 opacity-75" /></span>
|
| 50 |
+
<span className="text-blue-700 text-xs font-semibold uppercase tracking-wide">v2.0 — Multi-Agent Pipeline</span>
|
| 51 |
</div>
|
| 52 |
+
|
| 53 |
+
<h1 className="text-slate-900 text-5xl lg:text-[4rem] font-extrabold leading-[1.1] tracking-tight">
|
| 54 |
+
AI-Powered Test<br /><span className="text-blue-600">Generation Agent</span>
|
| 55 |
</h1>
|
| 56 |
+
|
| 57 |
+
<p className="text-slate-600 text-lg leading-relaxed max-w-lg">
|
| 58 |
+
5 AI agents analyze your code, generate comprehensive tests, validate quality, and iteratively refine using mutation testing feedback — achieving Grade A automatically.
|
| 59 |
</p>
|
| 60 |
+
|
| 61 |
<div className="flex flex-wrap gap-4 pt-2">
|
| 62 |
+
<button onClick={() => onNavigate('generate')} className="btn-primary h-12 px-8 text-base shadow-lg shadow-blue-600/30 hover:-translate-y-0.5">
|
| 63 |
Start Generating Tests →
|
| 64 |
</button>
|
| 65 |
+
<button onClick={() => onNavigate('analyze')} className="btn-secondary h-12 px-8 text-base">
|
| 66 |
Analyze Code First
|
| 67 |
</button>
|
| 68 |
</div>
|
| 69 |
+
|
| 70 |
+
<div className="flex items-center gap-6 pt-4 text-sm text-slate-500 font-mono">
|
| 71 |
+
<div className="flex items-center gap-2"><span className="text-green-600">✓</span> Real Mutation Execution</div>
|
| 72 |
+
<div className="flex items-center gap-2"><span className="text-green-600">✓</span> Any LLM Provider</div>
|
| 73 |
</div>
|
| 74 |
</div>
|
| 75 |
|
| 76 |
+
{/* Right: Mock Card */}
|
| 77 |
<div className="relative w-full group hidden lg:block">
|
| 78 |
+
<div className="absolute -inset-4 bg-gradient-to-r from-blue-400 to-purple-500 rounded-xl blur-2xl opacity-15 group-hover:opacity-25 transition duration-1000" />
|
| 79 |
+
<div className="relative bg-white rounded-xl shadow-cn-lg border border-slate-200/60 overflow-hidden">
|
| 80 |
+
<div className="h-10 border-b border-slate-100 bg-slate-50/50 flex items-center px-4 justify-between">
|
| 81 |
+
<div className="flex gap-1.5"><div className="w-3 h-3 rounded-full bg-slate-200" /><div className="w-3 h-3 rounded-full bg-slate-200" /><div className="w-3 h-3 rounded-full bg-slate-200" /></div>
|
| 82 |
+
<div className="text-[10px] font-mono text-slate-400 bg-white px-2 py-0.5 rounded border border-slate-100">multi-agent / output</div>
|
| 83 |
</div>
|
| 84 |
+
<div className="p-6 min-h-[320px] relative">
|
| 85 |
<div className="flex gap-6">
|
| 86 |
<div className="flex-1 space-y-3">
|
| 87 |
+
<div className="h-3 bg-slate-100 rounded w-3/4" />
|
| 88 |
+
<div className="h-3 bg-slate-100 rounded w-1/2" />
|
| 89 |
+
<div className="h-3 bg-slate-100 rounded w-5/6" />
|
| 90 |
+
<div className="h-3 bg-blue-50 rounded w-full mt-4" />
|
| 91 |
+
<div className="h-3 bg-blue-50 rounded w-11/12" />
|
| 92 |
</div>
|
| 93 |
<div className="w-48 bg-slate-900 rounded-lg p-4 shadow-xl text-white transform translate-y-4 border border-slate-700 shrink-0">
|
| 94 |
+
<div className="flex items-center gap-2 mb-2"><span className="w-2 h-2 rounded-full bg-green-400 animate-pulse" /><span className="text-[10px] font-mono text-slate-400 uppercase">Quality</span></div>
|
| 95 |
<div className="text-3xl font-black mb-1">A</div>
|
| 96 |
<div className="text-xs text-slate-400">85/100 • 18 tests</div>
|
| 97 |
+
<div className="mt-3 h-1.5 w-full bg-slate-800 rounded-full overflow-hidden"><div className="h-full bg-gradient-to-r from-blue-500 to-purple-500 w-[85%]" /></div>
|
| 98 |
</div>
|
| 99 |
</div>
|
| 100 |
+
<div className="absolute bottom-6 left-6 right-6 p-3 bg-blue-50 rounded border border-blue-100 flex items-start gap-3">
|
| 101 |
+
<span className="text-blue-600 text-sm mt-0.5">🧬</span>
|
| 102 |
<div>
|
| 103 |
+
<div className="text-xs font-semibold text-slate-900">Mutation Result</div>
|
| 104 |
+
<div className="text-[10px] text-slate-600 mt-1">3 mutants survived — adding tests to kill them.</div>
|
| 105 |
</div>
|
| 106 |
</div>
|
| 107 |
</div>
|
|
|
|
| 110 |
</div>
|
| 111 |
</section>
|
| 112 |
|
| 113 |
+
{/* Features */}
|
| 114 |
+
<section id="features" className="bg-white py-24 relative overflow-hidden">
|
| 115 |
+
<div className="absolute inset-0 bg-[radial-gradient(#e5e7eb_1px,transparent_1px)] [background-size:16px_16px] [mask-image:radial-gradient(ellipse_50%_50%_at_50%_50%,#000_70%,transparent_100%)] opacity-30" />
|
| 116 |
<div className="max-w-7xl mx-auto px-6 relative z-10">
|
| 117 |
<div className="text-center max-w-3xl mx-auto mb-20">
|
| 118 |
+
<h2 className="text-slate-900 text-3xl font-bold mb-4 tracking-tight">Designed for QA velocity</h2>
|
| 119 |
+
<p className="text-slate-500 text-lg">Research-backed tools built with the precision of a compiler.</p>
|
| 120 |
</div>
|
| 121 |
+
<div className="grid md:grid-cols-3 gap-0 border-t border-l border-slate-200">
|
| 122 |
{FEATURES.map(({ icon, title, desc }) => (
|
| 123 |
+
<div key={title} className="p-10 border-r border-b border-slate-200 bg-white hover:bg-slate-50 transition-colors group">
|
| 124 |
+
<div className="w-10 h-10 mb-6 flex items-center justify-center rounded-lg bg-slate-100 text-lg group-hover:bg-slate-900 group-hover:text-white transition-colors">{icon}</div>
|
| 125 |
+
<h3 className="text-slate-900 text-lg font-semibold mb-3">{title}</h3>
|
| 126 |
+
<p className="text-slate-500 text-sm leading-relaxed">{desc}</p>
|
| 127 |
</div>
|
| 128 |
))}
|
| 129 |
</div>
|
|
|
|
| 131 |
</section>
|
| 132 |
|
| 133 |
{/* Code Demo */}
|
| 134 |
+
<section id="pipeline" className="py-24 bg-slate-50 border-y border-slate-200">
|
| 135 |
<div className="max-w-6xl mx-auto px-6">
|
| 136 |
+
<div className="mb-12 text-center">
|
| 137 |
+
<h2 className="text-3xl font-bold text-slate-900">See the pipeline in action</h2>
|
| 138 |
+
<p className="text-slate-500 mt-2 text-lg">From raw code to Grade A tests in one API call.</p>
|
| 139 |
</div>
|
| 140 |
+
<div className="code-window max-w-4xl mx-auto">
|
| 141 |
+
<div className="code-header">
|
| 142 |
+
<div className="w-2.5 h-2.5 rounded-full bg-[#ff5f56]" />
|
| 143 |
+
<div className="w-2.5 h-2.5 rounded-full bg-[#ffbd2e]" />
|
| 144 |
+
<div className="w-2.5 h-2.5 rounded-full bg-[#27c93f]" />
|
| 145 |
+
<span className="ml-4 text-xs text-slate-400 font-mono">🧪 testgenius-pipeline / demo</span>
|
| 146 |
</div>
|
| 147 |
<div className="grid md:grid-cols-2">
|
| 148 |
<div className="bg-[#1e1e1e] p-6 border-r border-[#333]">
|
| 149 |
+
<div className="text-[10px] font-mono text-slate-500 uppercase mb-3">Input</div>
|
| 150 |
+
<pre className="text-sm leading-6">
|
| 151 |
+
<span className="text-[#569cd6]">def </span><span className="text-[#dcdcaa]">calculate_discount</span>(price, type):{"\n"}{" "}<span className="text-[#c586c0]">if</span> price {"<="} <span className="text-[#b5cea8]">0</span>:{"\n"}{" "}<span className="text-[#c586c0]">raise</span> <span className="text-[#4ec9b0]">ValueError</span>(){"\n"}{" "}<span className="text-[#c586c0]">if</span> type == <span className="text-[#ce9178]">"premium"</span>:{"\n"}{" "}<span className="text-[#c586c0]">return</span> price * <span className="text-[#b5cea8]">0.2</span>{"\n"}{" "}<span className="text-[#c586c0]">return</span> <span className="text-[#b5cea8]">0</span>
|
| 152 |
</pre>
|
| 153 |
</div>
|
| 154 |
<div className="bg-[#252526] p-6 relative">
|
| 155 |
+
<div className="absolute top-0 left-0 w-full h-1 bg-gradient-to-r from-blue-500 to-purple-500" />
|
| 156 |
+
<div className="flex items-center gap-2 mb-4"><span className="text-purple-400 text-sm">🤖</span><span className="text-xs font-bold uppercase tracking-wider text-[#ccc]">Generated (Grade A)</span></div>
|
| 157 |
<div className="space-y-3">
|
| 158 |
+
<div className="bg-[#333] p-3 rounded border-l-2 border-blue-500"><p className="text-xs text-[#999]">✅ 18 tests • happy path + edge + error</p></div>
|
| 159 |
+
<div className="bg-[#333] p-3 rounded border-l-2 border-purple-500"><p className="text-xs text-[#999]">🧬 Mutation: 87% killed (13/15)</p></div>
|
| 160 |
+
<div className="bg-[#333] p-3 rounded border-l-2 border-cyan-500"><p className="text-xs text-[#999]">📊 Coverage: 92% behaviors tested</p></div>
|
| 161 |
</div>
|
| 162 |
</div>
|
| 163 |
</div>
|
|
|
|
| 166 |
</section>
|
| 167 |
|
| 168 |
{/* Stats */}
|
| 169 |
+
<section className="bg-white py-20">
|
| 170 |
<div className="max-w-7xl mx-auto px-6">
|
| 171 |
<div className="grid md:grid-cols-4 gap-12 text-center">
|
| 172 |
+
{[{ stat: "85%+", label: "Quality Score" }, { stat: "5", label: "AI Agents" }, { stat: "<4s", label: "Per Run" }, { stat: "87%", label: "Mutation Kill" }].map(({ stat, label }, i) => (
|
| 173 |
+
<div key={label} className={`flex flex-col gap-1 items-center ${i < 3 ? 'md:border-r border-slate-100' : ''}`}>
|
| 174 |
+
<p className="text-5xl font-extrabold tracking-tight text-transparent bg-clip-text bg-gradient-to-b from-slate-900 to-slate-600">{stat}</p>
|
| 175 |
+
<p className="text-slate-500 font-medium mt-2">{label}</p>
|
| 176 |
</div>
|
| 177 |
))}
|
| 178 |
</div>
|
|
|
|
| 181 |
|
| 182 |
{/* CTA */}
|
| 183 |
<section className="bg-slate-900 py-24 relative overflow-hidden">
|
| 184 |
+
<div className="absolute top-0 right-0 w-[500px] h-[500px] bg-blue-500/20 rounded-full blur-[100px] pointer-events-none" />
|
| 185 |
+
<div className="absolute bottom-0 left-0 w-[400px] h-[400px] bg-purple-600/15 rounded-full blur-[80px] pointer-events-none" />
|
| 186 |
<div className="max-w-3xl mx-auto px-6 text-center relative z-10">
|
| 187 |
<h2 className="text-3xl md:text-4xl font-bold text-white mb-6 tracking-tight">Ready to generate better tests?</h2>
|
| 188 |
+
<p className="text-slate-400 mb-10 text-lg">Join QA teams who transformed testing with AI-powered iterative generation.</p>
|
| 189 |
<div className="flex flex-col sm:flex-row items-center justify-center gap-4">
|
| 190 |
+
<button onClick={() => onNavigate('generate')} className="w-full sm:w-auto rounded-full h-12 px-8 bg-white hover:bg-slate-100 text-slate-900 text-base font-bold shadow-lg transition-all">Get Started Free</button>
|
| 191 |
+
<button onClick={() => onNavigate('settings')} className="w-full sm:w-auto rounded-full h-12 px-8 bg-slate-800 border border-slate-700 hover:border-slate-600 text-white text-base font-bold transition-all">Configure LLM</button>
|
| 192 |
</div>
|
| 193 |
</div>
|
| 194 |
</section>
|
| 195 |
</main>
|
| 196 |
|
| 197 |
{/* Footer */}
|
| 198 |
+
<footer className="bg-white border-t border-slate-100 pt-16 pb-12">
|
| 199 |
<div className="max-w-7xl mx-auto px-6">
|
| 200 |
<div className="grid grid-cols-2 md:grid-cols-5 gap-8 mb-16">
|
| 201 |
<div className="col-span-2">
|
| 202 |
+
<div className="flex items-center gap-2 text-slate-900 mb-6"><span className="text-xl">🧪</span><span className="font-bold text-base">TestGenius AI</span></div>
|
| 203 |
+
<p className="text-slate-500 text-sm max-w-xs">AI-powered test generation for QA teams. Multi-agent iterative refinement inspired by MuTAP research (ISSTA 2023).</p>
|
| 204 |
</div>
|
| 205 |
+
{[{ h: "Product", l: ["Pipeline", "Analysis", "Mutations", "Security"] }, { h: "Resources", l: ["API Docs", "Papers", "Providers", "Changelog"] }, { h: "Company", l: ["About", "GitHub", "License", "Contact"] }].map(({ h, l }) => (
|
| 206 |
+
<div key={h} className="flex flex-col gap-3">
|
| 207 |
+
<h4 className="text-slate-900 font-semibold text-sm">{h}</h4>
|
| 208 |
+
{l.map(x => <a key={x} href="#" className="text-slate-500 hover:text-slate-900 text-sm transition-colors">{x}</a>)}
|
| 209 |
</div>
|
| 210 |
))}
|
| 211 |
</div>
|
| 212 |
+
<div className="flex justify-between items-center pt-8 border-t border-slate-100">
|
| 213 |
+
<p className="text-slate-400 text-sm">© {new Date().getFullYear()} TestGenius AI</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
</div>
|
| 215 |
</div>
|
| 216 |
</footer>
|
frontend/src/pages/SettingsPage.tsx
CHANGED
|
@@ -1,38 +1,94 @@
|
|
| 1 |
-
import
|
|
|
|
|
|
|
| 2 |
|
| 3 |
export function SettingsPage() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
return (
|
| 5 |
<div className="max-w-3xl mx-auto px-6 py-8">
|
| 6 |
-
<
|
| 7 |
-
|
| 8 |
-
<
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
</div>
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
<
|
| 22 |
-
|
| 23 |
-
<div className="flex justify-between
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
</div>
|
| 27 |
</div>
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
<
|
| 32 |
-
|
| 33 |
-
<div className="flex justify-between
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
</div>
|
| 37 |
</div>
|
| 38 |
</div>
|
|
|
|
| 1 |
+
import { useState, useEffect } from 'react';
|
| 2 |
+
|
| 3 |
+
const API = import.meta.env.VITE_API_URL || 'http://localhost:8000';
|
| 4 |
|
| 5 |
export function SettingsPage() {
|
| 6 |
+
const [provider, setProvider] = useState<any>(null);
|
| 7 |
+
|
| 8 |
+
useEffect(() => {
|
| 9 |
+
fetch(`${API}/api/v1/provider`).then(r => r.json()).then(setProvider).catch(() => {});
|
| 10 |
+
}, []);
|
| 11 |
+
|
| 12 |
return (
|
| 13 |
<div className="max-w-3xl mx-auto px-6 py-8">
|
| 14 |
+
<div className="mb-6">
|
| 15 |
+
<h1 className="text-2xl font-bold text-slate-900">Settings</h1>
|
| 16 |
+
<p className="text-slate-500 text-sm mt-1">LLM provider configuration and system info</p>
|
| 17 |
+
</div>
|
| 18 |
+
|
| 19 |
+
<div className="space-y-5">
|
| 20 |
+
{/* LLM Provider */}
|
| 21 |
+
<div className="card p-6">
|
| 22 |
+
<h3 className="text-base font-semibold text-slate-900 mb-4">🤖 LLM Provider</h3>
|
| 23 |
+
{provider ? (
|
| 24 |
+
<div className="space-y-3">
|
| 25 |
+
<div className="flex justify-between py-2 border-b border-slate-100">
|
| 26 |
+
<span className="text-sm text-slate-500">Provider</span>
|
| 27 |
+
<span className="text-sm font-medium text-slate-900">{provider.provider}</span>
|
| 28 |
+
</div>
|
| 29 |
+
<div className="flex justify-between py-2 border-b border-slate-100">
|
| 30 |
+
<span className="text-sm text-slate-500">Model</span>
|
| 31 |
+
<span className="text-sm font-mono text-slate-900">{provider.model}</span>
|
| 32 |
+
</div>
|
| 33 |
+
<div className="flex justify-between py-2 border-b border-slate-100">
|
| 34 |
+
<span className="text-sm text-slate-500">Base URL</span>
|
| 35 |
+
<span className="text-sm font-mono text-slate-600 truncate max-w-[250px]">{provider.base_url}</span>
|
| 36 |
+
</div>
|
| 37 |
+
<div className="flex justify-between py-2 border-b border-slate-100">
|
| 38 |
+
<span className="text-sm text-slate-500">Max Tokens</span>
|
| 39 |
+
<span className="text-sm text-slate-900">{provider.max_tokens}</span>
|
| 40 |
+
</div>
|
| 41 |
+
<div className="flex justify-between py-2">
|
| 42 |
+
<span className="text-sm text-slate-500">Status</span>
|
| 43 |
+
<span className={`text-sm font-medium ${provider.configured ? 'text-green-600' : 'text-red-600'}`}>
|
| 44 |
+
{provider.configured ? '✓ Connected' : '✗ Not configured'}
|
| 45 |
+
</span>
|
| 46 |
+
</div>
|
| 47 |
+
</div>
|
| 48 |
+
) : (
|
| 49 |
+
<div className="skeleton h-32" />
|
| 50 |
+
)}
|
| 51 |
</div>
|
| 52 |
|
| 53 |
+
{/* Pipeline */}
|
| 54 |
+
<div className="card p-6">
|
| 55 |
+
<h3 className="text-base font-semibold text-slate-900 mb-4">⚙️ Pipeline Settings</h3>
|
| 56 |
+
<div className="space-y-3">
|
| 57 |
+
<div className="flex justify-between py-2 border-b border-slate-100">
|
| 58 |
+
<span className="text-sm text-slate-500">Max Iterations</span>
|
| 59 |
+
<span className="text-sm text-slate-900">5</span>
|
| 60 |
+
</div>
|
| 61 |
+
<div className="flex justify-between py-2 border-b border-slate-100">
|
| 62 |
+
<span className="text-sm text-slate-500">Quality Threshold</span>
|
| 63 |
+
<span className="text-sm text-slate-900">Grade A (85%+)</span>
|
| 64 |
+
</div>
|
| 65 |
+
<div className="flex justify-between py-2 border-b border-slate-100">
|
| 66 |
+
<span className="text-sm text-slate-500">Mutation Testing</span>
|
| 67 |
+
<span className="text-sm text-green-600 font-medium">Enabled (real execution)</span>
|
| 68 |
+
</div>
|
| 69 |
+
<div className="flex justify-between py-2">
|
| 70 |
+
<span className="text-sm text-slate-500">Syntax Validation</span>
|
| 71 |
+
<span className="text-sm text-green-600 font-medium">Enabled (AST parse)</span>
|
| 72 |
+
</div>
|
| 73 |
</div>
|
| 74 |
</div>
|
| 75 |
|
| 76 |
+
{/* Info */}
|
| 77 |
+
<div className="card p-6">
|
| 78 |
+
<h3 className="text-base font-semibold text-slate-900 mb-4">ℹ️ System</h3>
|
| 79 |
+
<div className="space-y-3">
|
| 80 |
+
<div className="flex justify-between py-2 border-b border-slate-100">
|
| 81 |
+
<span className="text-sm text-slate-500">Version</span>
|
| 82 |
+
<span className="text-sm text-slate-900">v2.0.0</span>
|
| 83 |
+
</div>
|
| 84 |
+
<div className="flex justify-between py-2 border-b border-slate-100">
|
| 85 |
+
<span className="text-sm text-slate-500">Research Basis</span>
|
| 86 |
+
<span className="text-sm text-slate-900">MuTAP (ISSTA'23) + HITS (ASE'24)</span>
|
| 87 |
+
</div>
|
| 88 |
+
<div className="flex justify-between py-2">
|
| 89 |
+
<span className="text-sm text-slate-500">API Docs</span>
|
| 90 |
+
<a href={`${API}/docs`} target="_blank" className="text-sm text-blue-600 hover:underline">{API}/docs</a>
|
| 91 |
+
</div>
|
| 92 |
</div>
|
| 93 |
</div>
|
| 94 |
</div>
|
frontend/tailwind.config.js
CHANGED
|
@@ -5,15 +5,33 @@ export default {
|
|
| 5 |
theme: {
|
| 6 |
extend: {
|
| 7 |
colors: {
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
},
|
| 10 |
fontFamily: {
|
| 11 |
-
sans: ['-apple-system', 'BlinkMacSystemFont', '
|
| 12 |
-
mono: ['JetBrains Mono', 'Fira Code', '
|
| 13 |
},
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
},
|
| 18 |
},
|
| 19 |
},
|
|
|
|
| 5 |
theme: {
|
| 6 |
extend: {
|
| 7 |
colors: {
|
| 8 |
+
cn: {
|
| 9 |
+
bg: 'var(--cn-bg)',
|
| 10 |
+
surface: 'var(--cn-surface)',
|
| 11 |
+
'surface-elevated': 'var(--cn-surface-elevated)',
|
| 12 |
+
border: 'var(--cn-border)',
|
| 13 |
+
'border-strong': 'var(--cn-border-strong)',
|
| 14 |
+
text: 'var(--cn-text)',
|
| 15 |
+
muted: 'var(--cn-muted)',
|
| 16 |
+
accent: 'var(--cn-accent)',
|
| 17 |
+
'accent-hover': 'var(--cn-accent-hover)',
|
| 18 |
+
success: 'var(--cn-success)',
|
| 19 |
+
danger: 'var(--cn-danger)',
|
| 20 |
+
warn: 'var(--cn-warn)',
|
| 21 |
+
info: 'var(--cn-info)',
|
| 22 |
+
purple: 'var(--cn-purple)',
|
| 23 |
+
},
|
| 24 |
+
primary: { DEFAULT: '#2563eb', dark: '#1d4ed8' },
|
| 25 |
},
|
| 26 |
fontFamily: {
|
| 27 |
+
sans: ['Inter', '-apple-system', 'BlinkMacSystemFont', 'sans-serif'],
|
| 28 |
+
mono: ['JetBrains Mono', 'Fira Code', 'monospace'],
|
| 29 |
},
|
| 30 |
+
borderRadius: { cn: '0.875rem' },
|
| 31 |
+
boxShadow: {
|
| 32 |
+
cn: 'var(--cn-shadow)',
|
| 33 |
+
'cn-md': 'var(--cn-shadow-md)',
|
| 34 |
+
'cn-lg': 'var(--cn-shadow-lg)',
|
| 35 |
},
|
| 36 |
},
|
| 37 |
},
|