UI 1000x upgrade: frontend/src/App.tsx
Browse files- frontend/src/App.tsx +48 -21
frontend/src/App.tsx
CHANGED
|
@@ -1,35 +1,62 @@
|
|
| 1 |
import React, { useState } from 'react';
|
| 2 |
-
import { GeneratePage } from './pages/GeneratePage';
|
| 3 |
import { LandingPage } from './pages/LandingPage';
|
|
|
|
| 4 |
import { HistoryPage } from './pages/HistoryPage';
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
export default function App() {
|
| 7 |
-
const [page, setPage] = useState<
|
| 8 |
|
| 9 |
return (
|
| 10 |
-
<div className="min-h-screen bg-[#
|
| 11 |
-
{/* Navbar */}
|
| 12 |
-
|
| 13 |
-
<
|
| 14 |
-
<
|
| 15 |
-
<
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
<div className="flex items-center gap-1">
|
| 19 |
-
<button onClick={() => setPage('generate')} className={`px-4 py-2 rounded-lg text-sm font-medium transition ${page === 'generate' ? 'bg-emerald-500/10 text-emerald-400' : 'text-gray-400 hover:text-white'}`}>
|
| 20 |
-
Generate
|
| 21 |
-
</button>
|
| 22 |
-
<button onClick={() => setPage('history')} className={`px-4 py-2 rounded-lg text-sm font-medium transition ${page === 'history' ? 'bg-emerald-500/10 text-emerald-400' : 'text-gray-400 hover:text-white'}`}>
|
| 23 |
-
History
|
| 24 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
</div>
|
| 26 |
-
</
|
| 27 |
-
|
| 28 |
|
| 29 |
{/* Pages */}
|
| 30 |
-
{page ==
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
</div>
|
| 34 |
);
|
| 35 |
}
|
|
|
|
| 1 |
import React, { useState } from 'react';
|
|
|
|
| 2 |
import { LandingPage } from './pages/LandingPage';
|
| 3 |
+
import { GeneratePage } from './pages/GeneratePage';
|
| 4 |
import { HistoryPage } from './pages/HistoryPage';
|
| 5 |
+
import { AnalyzePage } from './pages/AnalyzePage';
|
| 6 |
+
import { SettingsPage } from './pages/SettingsPage';
|
| 7 |
+
|
| 8 |
+
type Page = 'landing' | 'generate' | 'analyze' | 'history' | 'settings';
|
| 9 |
|
| 10 |
export default function App() {
|
| 11 |
+
const [page, setPage] = useState<Page>('landing');
|
| 12 |
|
| 13 |
return (
|
| 14 |
+
<div className="min-h-screen bg-[#06060b] text-white antialiased">
|
| 15 |
+
{/* Glass Navbar */}
|
| 16 |
+
{page !== 'landing' && (
|
| 17 |
+
<nav className="fixed top-0 left-0 right-0 z-50 border-b border-white/[0.04] bg-[#06060b]/70 backdrop-blur-xl">
|
| 18 |
+
<div className="max-w-[1400px] mx-auto px-6 h-[60px] flex items-center justify-between">
|
| 19 |
+
<button onClick={() => setPage('landing')} className="flex items-center gap-2.5 group">
|
| 20 |
+
<div className="w-8 h-8 rounded-lg bg-gradient-to-br from-emerald-500 to-cyan-500 flex items-center justify-center text-sm font-bold shadow-lg shadow-emerald-500/20 group-hover:shadow-emerald-500/40 transition-shadow">T</div>
|
| 21 |
+
<span className="font-semibold text-[15px] tracking-tight">TestGenius<span className="text-emerald-400">.ai</span></span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
</button>
|
| 23 |
+
|
| 24 |
+
<div className="flex items-center bg-white/[0.03] rounded-full p-1 border border-white/[0.05]">
|
| 25 |
+
{[
|
| 26 |
+
{ id: 'generate', label: 'Generate', icon: '⚡' },
|
| 27 |
+
{ id: 'analyze', label: 'Analyze', icon: '🔬' },
|
| 28 |
+
{ id: 'history', label: 'History', icon: '📋' },
|
| 29 |
+
{ id: 'settings', label: 'Settings', icon: '⚙️' },
|
| 30 |
+
].map(tab => (
|
| 31 |
+
<button key={tab.id} onClick={() => setPage(tab.id as Page)}
|
| 32 |
+
className={`px-4 py-1.5 rounded-full text-[13px] font-medium transition-all duration-200 ${
|
| 33 |
+
page === tab.id
|
| 34 |
+
? 'bg-emerald-500/15 text-emerald-300 shadow-inner shadow-emerald-500/5'
|
| 35 |
+
: 'text-gray-500 hover:text-gray-300'
|
| 36 |
+
}`}>
|
| 37 |
+
<span className="mr-1.5">{tab.icon}</span>{tab.label}
|
| 38 |
+
</button>
|
| 39 |
+
))}
|
| 40 |
+
</div>
|
| 41 |
+
|
| 42 |
+
<div className="flex items-center gap-3">
|
| 43 |
+
<div className="flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-emerald-500/10 border border-emerald-500/20">
|
| 44 |
+
<span className="w-1.5 h-1.5 bg-emerald-500 rounded-full animate-pulse" />
|
| 45 |
+
<span className="text-emerald-400 text-[11px] font-medium">AI Online</span>
|
| 46 |
+
</div>
|
| 47 |
+
</div>
|
| 48 |
</div>
|
| 49 |
+
</nav>
|
| 50 |
+
)}
|
| 51 |
|
| 52 |
{/* Pages */}
|
| 53 |
+
<div className={page !== 'landing' ? 'pt-[60px]' : ''}>
|
| 54 |
+
{page === 'landing' && <LandingPage onNavigate={setPage} />}
|
| 55 |
+
{page === 'generate' && <GeneratePage />}
|
| 56 |
+
{page === 'analyze' && <AnalyzePage />}
|
| 57 |
+
{page === 'history' && <HistoryPage />}
|
| 58 |
+
{page === 'settings' && <SettingsPage />}
|
| 59 |
+
</div>
|
| 60 |
</div>
|
| 61 |
);
|
| 62 |
}
|