Spaces:
Sleeping
Sleeping
File size: 5,960 Bytes
195092e | 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 | # IMPLEMENTATION_PLAN.md β BRIDGE Platform (Modules E & S)
> PHASE 2 deliverable. Executed autonomously per the brief's guardrails ("do not pause for confirmation between phases").
## 0. Strategy
Converge both sibling apps into ONE platform build (they share ~95 % of code and deploy to the same HF Space `sitcod3/BRIDGE_Modul-S_prod`):
- **Base = E repo (GREENTHEME-test)** β superset: ThemeContext engine, tests, Skeleton, Pricing, Stripe.
- Module S's real pages are **ported** into the platform under `src/modules/s/**` (design preserved 100 %: true-indigo palette, slateβblack gradient, original UX).
- Module E's pages stay in `src/pages/**` and mount at `/modules/e/**`.
- Platform shell (Sidebar with MODULES section, per-module nav + palette, TopBar) adapts per module via the registry.
- The identical platform build is replicated into the S repo so either pipeline produces the same Space.
## 1. File-by-file change list
### NEW
| File | Purpose |
|---|---|
| `src/modules/registry.tsx` | `ModuleId`, `MODULES` registry: id, label, wordmark, accent config, tagline, nav items, icon |
| `src/modules/LaunchContext.tsx` | Launch sequencer: `startLaunch(moduleId)` bumps `seq` (re-seed), controlled **exit choreography**, `useLaunch()` |
| `src/modules/ModuleLaunchAnimation.tsx` | Random-reassembly engine (Β§3) |
| `src/modules/ModuleShell.tsx` | Route shell `/modules/:id`: `data-module` attr + theme override, platform chrome, launch guard β animation β `<Outlet/>` |
| `src/modules/ModuleHub.tsx` | `/` platform launcher: two real-primitive module cards + Launch buttons |
| `src/modules/PlatformSidebar.tsx` | MODULES section (2 direct-launch buttons) + active module nav |
| `src/modules/PlatformTopBar.tsx` | TopBar shell per module (module-aware API-key badge) |
| `src/modules/s/components/{StatCard,AnimatedLogo,GlassCard}.tsx` | S variants (original implementations) |
| `src/modules/s/pages/*.tsx` | 11 ported S pages (imports re-pointed; StatCard β S variant) |
### MODIFIED
| File | Change |
|---|---|
| `src/App.tsx` | New route table (Β§2), `LaunchProvider`, legacy redirects |
| `src/context/ThemeContext.tsx` | Add `PROD_THEME` (Module S palette); default stays mint |
| `src/index.css` | `[data-module="s"]` palette var overrides + `.bg-module-s` gradient + reduced-motion safeguard |
| `src/components/Logo.tsx` | Wordmark `ModulE`β`ModuleE`, label prop |
| `src/pages/Dashboard.tsx`, `src/pages/CampaignDetail.tsx` | 3 absolute links β `/modules/e/β¦` |
| `metadata.json` | name `BRIDGE Modules` + description migrated |
| `server.ts` | add `GET /api/health` |
| `README.md` | platform note |
### Tests (new)
- `src/modules/ModuleLaunchAnimation.test.tsx` β primitives render; reduced-motion instant reveal; re-seed between launches.
- `src/modules/routing.test.tsx` β `/modules/e` + `/modules/s` index pages render in-shell; hub cards; direct menu routes; legacy `/campaigns` β `/modules/e/campaigns`.
- `src/modules/naming.test.ts` β zero `Modul` stragglers in registry; `/modules/e` + `/modules/s` routes.
## 2. Route table
```
/ ModuleHub
/modules/e E Dashboard (index)
/modules/e/{campaigns,campaigns/:id,leads,email-accounts,warmup,inbox,webhooks,analytics,clients,pricing,settings}
/modules/s S Dashboard (index)
/modules/s/{campaigns,campaigns/:id,leads,email-accounts,warmup,inbox,webhooks,analytics,clients,settings}
Legacy: /campaigns, /leads, β¦ β replace β /modules/e/<same> * β /
```
## 3. Launch-animation architecture (PHASE 4)
`<ModuleLaunchAnimation module mode="enter"|"exit" onComplete />`
1. **Real primitives only:** 4Γ `StatCard`, chart frame (GlassCard + live Recharts AreaChart), list frame (5 lead rows + StatusBadge), StatusBadge strip, KPI chips, Skeleton shimmer bar β 12 pieces in a dashboard-like grid.
2. **Random re-assembly:** `mulberry32(seed)`, `seed = Date.now() ^ hash(moduleId) ^ launchSeq` β re-seeded every launch. Per piece: off-canvas angle 0β360Β°, distance 240β720 px, rotation Β±8β45Β°, scale 0.55β1.35, stagger `i*55 ms + rand(40β90) ms`, duration 2.4β3.2 s, easing `cubic-bezier(0.22, 1, 0.36, 1)`.
3. **60 fps:** transform + opacity only (motion/react WAAPI/rAF β no setTimeout chains); `will-change` during animation only; chart renders after first frame (double-rAF); pages React.lazy-preloaded on hub mount + menu hover.
4. **Reduced motion:** instant reveal, zero duration.
5. **Exit choreography:** `startLaunch` from inside a module β `exiting` β shell swaps to primitive grid with reverse-assembly (scatter outward, 0.85 s) β navigate β target enter animation. Direct URL/back bypass controlled exit.
6. **Per-module theming:** same engine; E = mint accents, S = indigo accents on slate gradient.
## 4. Menu integration (PHASE 5)
`PlatformSidebar` gains `BRIDGE MODULES` section: **Module E** (mint dot) β `/modules/e`, **Module S** (indigo dot) β `/modules/s`; active state per namespace; click = `startLaunch` + navigate (re-seeded animation); cross-launch visible in both modules; hub cards mirror the action.
## 5. Risk register & rollback
| Risk | Mitigation | Rollback |
|---|---|---|
| Tailwind v4 remap collides with S indigo | `[data-module="s"]` scoped var overrides | remove scope block |
| E absolute links break | 3 links rewritten + legacy redirects | revert pages |
| Route move breaks tests | component tests render directly; new routing tests | revert App.tsx |
| Space stale build | identical platform in both repos; 200 + bundle markers verified | HF UI rollback |
| Naming misses | naming.test + grep gate | β |
## 6. Execution order
1. ThemeContext + index.css scopes β 2. registry/LaunchContext/animation/shell/hub/chrome β 3. port S pages β 4. App.tsx routes + links β 5. server/metadata/Logo β 6. tests + tsc + build + QA (PHASE 6) β 7. replicate to S repo, push both, verify live (PHASE 7).
|