Spaces:
Running
Running
UI Migration Guide: index.html β Next.js
β COMPLETED
1. CSS Design Tokens
- β
Created design token mapping in
globals.css - All color variables, fonts, and spacing preserved
- Ready for selective integration
2. JSX Conversion
- β
Created
/ui/app/page-landing.tsx - Converted HTML β React JSX components
classβclassName- Canvas refs with
useEffectlifecycle - All sections: hero, overview, simulation, architecture, metrics
3. Canvas Initialization
- β
Added
useRefhooks for canvas elements - β
Wrapped canvas logic in
useEffect - β TODO placeholders for actual drawing logic
π INTEGRATION STEPS
Step 1: Apply index.html CSS to globals.css
Your globals.css has old styles. Update it with index.html theme:
# Option A: Keep existing structure, add index.html CSS as override
# Option B: Replace entire globals.css with index.html styles (RECOMMENDED)
The page-landing.tsx expects these CSS classes:
- Layout:
nav,section,footer - Components:
card,btn-primary,btn-secondary,metric-block - Utilities:
anim-1,divider,hero-stats
Step 2: Choose Integration Strategy
Option A: Use Landing Page Separately β (SIMPLEST)
/app/page.tsx β Your existing interactive app
/app/landing.tsx β New static landing (page-landing.tsx)
/app/layout.tsx β Wrap both
Option B: Replace page.tsx Completely (if landing is the main page)
/app/page.tsx β Replace with page-landing.tsx
/app/mission/page.tsx β Move existing components to subfolder
Option C: Hybrid (recommended)
/app/page.tsx β Dynamic switcher (landing vs mission)
/app/landing.tsx β page-landing.tsx
/app/components/* β Existing components
π¨ CSS INTEGRATION
Required Classes from index.html:
/* Navigation */
nav, .nav-logo, .nav-links, .nav-badge
/* Hero Section */
#hero, .hero-content, .hero-tag, .hero-ctas
.btn-primary, .btn-secondary
/* Cards */
.cards-grid, .card, .card-id, .card-title, .card-footer
/* Simulation */
.sim-wrapper, .sim-topbar, .sim-body, .sim-panel
.agent-row, .trust-bar-bg, .trust-bar-fill
.metric-block, .metric-value
/* Architecture */
.arch-node, .arch-flow
/* Metrics */
.metric-block, .metric-grid
/* Footer */
footer, .footer-left, .footer-right
/* Animations */
@keyframes pulse-dot, fadeInUp
.anim-1, .anim-2, .anim-3, .anim-4, .anim-5
πΌοΈ CANVAS MIGRATION
The new page-landing.tsx has placeholders:
function initHeroCanvas(canvas: HTMLCanvasElement) {
// TODO: Copy canvas.js logic from index.html
// The neural network grid visualization
}
function initSimCanvas(canvas: HTMLCanvasElement) {
// TODO: Copy canvas.js logic from index.html
// The orchestrator network visualization
}
To migrate canvas logic:
- Find the inline
<script>block inindex.html(lines ~1710+) - Extract the two IIFE functions:
- Hero canvas: Neural network grid
- Sim canvas: Orchestrator network
- Paste into
initHeroCanvas()andinitSimCanvas() - Update canvas size handling for React
β¨ FEATURES NOT YET IMPLEMENTED
These are hooks for future work - marked with TODO:
- Canvas drawing logic (detailed in "Canvas Migration" above)
- Button click handlers (Launch Mission, Read Docs)
- Live metrics updates (currently static)
- Specialist status animation
- Episode log scrolling (right panel)
π FILE STRUCTURE AFTER MIGRATION
/ui
βββ app/
β βββ layout.tsx (unchanged)
β βββ page.tsx (existing - interactive mode)
β βββ page-landing.tsx (NEW - landing page)
β βββ globals.css (UPDATED with index.html styles)
β βββ components/
β β βββ Landing.tsx
β β βββ MissionControl.tsx
β β βββ ...
β βββ hooks/
β βββ useSentinel.ts
βββ index.html (ARCHIVE - no longer needed after migration)
βββ .env (unchanged)
βββ package.json (unchanged)
π QUICK START
- Update globals.css with index.html styles (or use the CSS I provided)
- Keep page-landing.tsx as new file (or rename to page.tsx if replacing)
- Migrate canvas logic from index.html
<script>section - Test: Visit
http://localhost:3000/or/landingdepending on routing
β DONE vs π§ TODO
| Part | Status | Notes |
|---|---|---|
| HTML β JSX | β | page-landing.tsx ready |
| CSS Variables | β | Design tokens extracted |
| Layout/Structure | β | All sections preserved |
| Canvas Setup | β | useRef + useEffect ready |
| Canvas Drawing | π§ | TODO - copy from index.html |
| Button Handlers | π§ | TODO - implement event handlers |
| Live Updates | π§ | TODO - connect to API/state |
| Animations | β | @keyframes preserved in CSS |
NEXT: What You Need to Do
- Decision: Keep separate landing page or replace main page?
- CSS: Merge index.html styles into
globals.css - Canvas: Copy drawing logic from
index.html<script>into the TODO functions - Test: Run
npm run devand verify visual parity
Need help with any step? π