File size: 5,362 Bytes
1d68c54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# 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 `useEffect` lifecycle
- All sections: hero, overview, simulation, architecture, metrics

### 3. **Canvas Initialization**
- βœ… Added `useRef` hooks 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:

```bash
# 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:

```css
/* 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:

```typescript
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:**

1. Find the inline `<script>` block in `index.html` (lines ~1710+)
2. Extract the two IIFE functions:
   - Hero canvas: Neural network grid
   - Sim canvas: Orchestrator network
3. Paste into `initHeroCanvas()` and `initSimCanvas()`
4. 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

1. **Update globals.css** with index.html styles (or use the CSS I provided)
2. **Keep page-landing.tsx** as new file (or rename to page.tsx if replacing)
3. **Migrate canvas logic** from index.html `<script>` section
4. **Test**: Visit `http://localhost:3000/` or `/landing` depending 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

1. **Decision**: Keep separate landing page or replace main page?
2. **CSS**: Merge index.html styles into `globals.css`
3. **Canvas**: Copy drawing logic from `index.html` `<script>` into the TODO functions
4. **Test**: Run `npm run dev` and verify visual parity

Need help with any step? πŸš€