BRIDGE Platform Agent commited on
Commit
195092e
·
1 Parent(s): 1955a0f

refactor(naming): modul → modules across metadata, wordmarks, headers, docs

Browse files

- metadata.json + index.html: BRIDGE Modules
- Logo wordmarks ModuleE/ModuleS; aiService X-Title migrated
- CODEBASE_MAP.md, IMPLEMENTATION_PLAN.md, QA_REPORT.md, README platform docs

CODEBASE_MAP.md ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CODEBASE_MAP.md — BRIDGE Platform (Modules E & S)
2
+
3
+ > PHASE 1 deliverable. Covers both module repositories, shared architecture, integration target.
4
+
5
+ ## 1. Repositories
6
+
7
+ | Repo | Role | Metadata name | Live target |
8
+ |------|------|---------------|-------------|
9
+ | `sitcod3lab-git/BRIDGE_Modul-E_Instantly_GREENTHEME-test` | Module E (green/mint theme, superset app, tests) | `BRIDGEModulE` | HF Space `sitcod3/BRIDGE_Modul-S_prod` |
10
+ | `sitcod3lab-git/BRIDGE_Modul-E_Instantly-prod` | **Module S (prod)** — metadata declares `BRIDGE ModulS`; the brief's URL `uranusmediaconnection-dot/BRIDGE_Modul-S_prod` does not exist (404 verified with two tokens); this repo is the actual Module S prod source | `BRIDGE ModulS` | HF Space `sitcod3/BRIDGE_Modul-S_prod` (same space) |
11
+
12
+ ⚠️ **Blocker logged (least-invasive resolution):** both repos' CI (`hf-docker-space-deploy.yml`) force-push to the **same** HF Space `sitcod3/BRIDGE_Modul-S_prod`. The Space therefore IS the BRIDGE platform. The converged platform build is delivered to **both** repos so the Space serves the complete app regardless of which pipeline runs last.
13
+
14
+ ## 2. Shared stack (identical in both repos)
15
+
16
+ - **Frontend:** React 19 + Vite 6 + TypeScript, Tailwind CSS v4 (`@tailwindcss/vite`, `@theme` tokens in `src/index.css`), `motion/react` v12, `@tanstack/react-query` v5, `react-router-dom` v7, `react-hook-form` + `zod`, `recharts` v3, `react-hot-toast`, `lucide-react`.
17
+ - **Backend:** single-file Express BFF (`server.ts`, ~1 100 lines) — Smartlead proxy (`server.smartlead.ai/api/v1`), AI research, webhook receiver, static serving; Docker on HF port 7860.
18
+ - **Data:** `ApiKeyContext` (local key vault), `supabaseClient`, Stripe billing (E only).
19
+
20
+ ## 3. Routing (current, E repo)
21
+
22
+ `/` Dashboard · `/campaigns` · `/campaigns/:id` · `/leads` · `/email-accounts` · `/warmup` · `/inbox` · `/webhooks` · `/analytics` · `/clients` · `/pricing` (E only) · `/settings` — all nested in `AppLayout` (Sidebar + TopBar + GeometricBackground + BackgroundElements).
23
+ S repo: identical minus `Pricing` (10 items, label "Dashboard" vs E "Command Center").
24
+
25
+ ## 4. Design system
26
+
27
+ ### Module E — "Bioluminescent Mint" (GREENTHEME)
28
+ - `ThemeContext.tsx`: `MINT_THEME` (id `mint`) — accent `#00e5bc`, CSS vars `--theme-accent*`, `--theme-badge*`, `--theme-btn*`, chart colors, tagline "Keep growth **healthy.**"
29
+ - `index.css` remaps Tailwind v4 vars GLOBALLY: `indigo-*`→mint, `emerald-*`→mint, `zinc-800/900/950`→`#1a1b1e/#0c0d10/#05070a`. E pages consume raw Tailwind classes that **render as mint**.
30
+ - Branding: `Logo.tsx` → `BRIDGE`+accent `ModulE`, sub "Outbound Systems OS".
31
+
32
+ ### Module S — "Prod Indigo"
33
+ - No ThemeContext; raw Tailwind indigo/emerald on real zinc. Body: `linear-gradient(180deg,#0f172a,#000)` fixed.
34
+ - Branding: `BRIDGE ModulS`.
35
+
36
+ ### Shared components (diff = 0 → reuse directly)
37
+ `StatusBadge`, `ConfirmModal`, `FormDrawer`, `CsvExportButton`, `RichTextEditor`, `Skeleton` (E), `AppLayout` (diff 0), `utils/cn`, `lib/apiClient`, `lib/supabaseClient`, `context/ApiKeyContext`.
38
+
39
+ ### Divergent components (per-module variants)
40
+ | Component | Diff | Resolution |
41
+ |---|---|---|
42
+ | `StatCard` | 41 lines | S variant `src/modules/s/components/StatCard.tsx` |
43
+ | `AnimatedLogo` | 27 | S variant |
44
+ | `GlassCard` | 6 | S variant |
45
+ | `TopBar` | 363 | superseded by platform TopBar (chrome) |
46
+ | `GeometricBackground` / `BackgroundElements` | 71 / 27 | platform chrome versions |
47
+
48
+ ## 5. Animation source primitives (real components only)
49
+
50
+ `StatCard`, `GlassCard`, `StatusBadge`, Recharts `AreaChart` frames, table/list rows (avatar dot + email + badge), `Skeleton`, ambient background layers.
51
+
52
+ ## 6. Backend API surface (merged)
53
+
54
+ Common Smartlead proxy + campaigns/leads/research/webhooks. E-only: `/api/billing*`. S-only: `/api/health` → **add to merged server**. Dead dep in S: `@google/genai` (not carried).
55
+
56
+ ## 7. Tests & tooling (E repo)
57
+
58
+ vitest + RTL + jsdom; tests render components directly (route restructure must not break contracts). Scripts: `lint = tsc --noEmit`, `test = vitest run`, `build = vite build && esbuild server.ts --bundle …`, `dev = tsx server.ts`.
59
+
60
+ ## 8. Naming audit (`modul` → `modules`, case-aware)
61
+
62
+ `metadata.json` names → `BRIDGE Modules`; `Logo.tsx` wordmark `ModulE/ModulS` → `ModuleE/ModuleS`; menu labels `Module E` / `Module S`; route namespace `/modules/e`, `/modules/s`; folders `src/modules/**`; docs/comments updated.
IMPLEMENTATION_PLAN.md ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # IMPLEMENTATION_PLAN.md — BRIDGE Platform (Modules E & S)
2
+
3
+ > PHASE 2 deliverable. Executed autonomously per the brief's guardrails ("do not pause for confirmation between phases").
4
+
5
+ ## 0. Strategy
6
+
7
+ 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`):
8
+
9
+ - **Base = E repo (GREENTHEME-test)** — superset: ThemeContext engine, tests, Skeleton, Pricing, Stripe.
10
+ - 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).
11
+ - Module E's pages stay in `src/pages/**` and mount at `/modules/e/**`.
12
+ - Platform shell (Sidebar with MODULES section, per-module nav + palette, TopBar) adapts per module via the registry.
13
+ - The identical platform build is replicated into the S repo so either pipeline produces the same Space.
14
+
15
+ ## 1. File-by-file change list
16
+
17
+ ### NEW
18
+ | File | Purpose |
19
+ |---|---|
20
+ | `src/modules/registry.tsx` | `ModuleId`, `MODULES` registry: id, label, wordmark, accent config, tagline, nav items, icon |
21
+ | `src/modules/LaunchContext.tsx` | Launch sequencer: `startLaunch(moduleId)` bumps `seq` (re-seed), controlled **exit choreography**, `useLaunch()` |
22
+ | `src/modules/ModuleLaunchAnimation.tsx` | Random-reassembly engine (§3) |
23
+ | `src/modules/ModuleShell.tsx` | Route shell `/modules/:id`: `data-module` attr + theme override, platform chrome, launch guard → animation → `<Outlet/>` |
24
+ | `src/modules/ModuleHub.tsx` | `/` platform launcher: two real-primitive module cards + Launch buttons |
25
+ | `src/modules/PlatformSidebar.tsx` | MODULES section (2 direct-launch buttons) + active module nav |
26
+ | `src/modules/PlatformTopBar.tsx` | TopBar shell per module (module-aware API-key badge) |
27
+ | `src/modules/s/components/{StatCard,AnimatedLogo,GlassCard}.tsx` | S variants (original implementations) |
28
+ | `src/modules/s/pages/*.tsx` | 11 ported S pages (imports re-pointed; StatCard → S variant) |
29
+
30
+ ### MODIFIED
31
+ | File | Change |
32
+ |---|---|
33
+ | `src/App.tsx` | New route table (§2), `LaunchProvider`, legacy redirects |
34
+ | `src/context/ThemeContext.tsx` | Add `PROD_THEME` (Module S palette); default stays mint |
35
+ | `src/index.css` | `[data-module="s"]` palette var overrides + `.bg-module-s` gradient + reduced-motion safeguard |
36
+ | `src/components/Logo.tsx` | Wordmark `ModulE`→`ModuleE`, label prop |
37
+ | `src/pages/Dashboard.tsx`, `src/pages/CampaignDetail.tsx` | 3 absolute links → `/modules/e/…` |
38
+ | `metadata.json` | name `BRIDGE Modules` + description migrated |
39
+ | `server.ts` | add `GET /api/health` |
40
+ | `README.md` | platform note |
41
+
42
+ ### Tests (new)
43
+ - `src/modules/ModuleLaunchAnimation.test.tsx` — primitives render; reduced-motion instant reveal; re-seed between launches.
44
+ - `src/modules/routing.test.tsx` — `/modules/e` + `/modules/s` index pages render in-shell; hub cards; direct menu routes; legacy `/campaigns` → `/modules/e/campaigns`.
45
+ - `src/modules/naming.test.ts` — zero `Modul` stragglers in registry; `/modules/e` + `/modules/s` routes.
46
+
47
+ ## 2. Route table
48
+
49
+ ```
50
+ / ModuleHub
51
+ /modules/e E Dashboard (index)
52
+ /modules/e/{campaigns,campaigns/:id,leads,email-accounts,warmup,inbox,webhooks,analytics,clients,pricing,settings}
53
+ /modules/s S Dashboard (index)
54
+ /modules/s/{campaigns,campaigns/:id,leads,email-accounts,warmup,inbox,webhooks,analytics,clients,settings}
55
+ Legacy: /campaigns, /leads, … → replace → /modules/e/<same> * → /
56
+ ```
57
+
58
+ ## 3. Launch-animation architecture (PHASE 4)
59
+
60
+ `<ModuleLaunchAnimation module mode="enter"|"exit" onComplete />`
61
+
62
+ 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.
63
+ 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)`.
64
+ 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.
65
+ 4. **Reduced motion:** instant reveal, zero duration.
66
+ 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.
67
+ 6. **Per-module theming:** same engine; E = mint accents, S = indigo accents on slate gradient.
68
+
69
+ ## 4. Menu integration (PHASE 5)
70
+
71
+ `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.
72
+
73
+ ## 5. Risk register & rollback
74
+
75
+ | Risk | Mitigation | Rollback |
76
+ |---|---|---|
77
+ | Tailwind v4 remap collides with S indigo | `[data-module="s"]` scoped var overrides | remove scope block |
78
+ | E absolute links break | 3 links rewritten + legacy redirects | revert pages |
79
+ | Route move breaks tests | component tests render directly; new routing tests | revert App.tsx |
80
+ | Space stale build | identical platform in both repos; 200 + bundle markers verified | HF UI rollback |
81
+ | Naming misses | naming.test + grep gate | — |
82
+
83
+ ## 6. Execution order
84
+
85
+ 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).
QA_REPORT.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # QA_REPORT.md — BRIDGE Platform (Modules E & S)
2
+
3
+ > PHASE 6 deliverable. Every gate green before deployment.
4
+
5
+ ## Automated gates
6
+
7
+ | Gate | Command | Result |
8
+ |---|---|---|
9
+ | Types | `tsc --noEmit` | ✅ 0 errors |
10
+ | Unit/Component tests | `vitest run` | ✅ 26 passed / 0 failed (9 files) |
11
+ | Production build | `npm run build` (vite + esbuild server) | ✅ built, 0 warnings after manualChunks vendor split (largest chunk 433 kB) |
12
+ | Naming migration | `naming.test.ts` + grep | ✅ zero `modul(?!e)` stragglers in src (labels, wordmarks, routes, X-Title headers, metadata, docs) |
13
+
14
+ ### Test coverage added
15
+ - `ModuleLaunchAnimation.test.tsx` — seeded PRNG determinism, re-seed difference between launches, motion budget (distance 240–720 px, rotate ±8–45°, scale 0.55–1.35, stagger, duration 2.4–3.2 s), mandated easing `[0.22, 1, 0.36, 1]`.
16
+ - `routing.test.tsx` — hub launcher cards, direct URL load of `/modules/e` + `/modules/s` with launch guard, S shell `data-module` scope, workspace reveal after assembly, cross-launch E→S from hub.
17
+ - `naming.test.ts` — registry labels/wordmarks/routes under `/modules/*`, zero stragglers.
18
+ - Pre-existing drift fixed: `Analytics.test.tsx` expected the old heading ("Outbound Analytics & Intelligence"); page was redesigned to "Outbound Analytics" — test updated to match production UI. Failure was pre-existing on the base commit (verified via `git stash`).
19
+
20
+ ## Manual QA checklist (headless Chromium via agent-browser, production build served by `node dist/server.cjs`)
21
+
22
+ | # | Checklist item | Result |
23
+ |---|---|---|
24
+ | 1 | Direct URL load `/modules/e` | ✅ launch guard + animation → workspace revealed |
25
+ | 2 | Direct URL load `/modules/s` | ✅ same, with S (prod indigo) palette restored under `[data-module="s"]` |
26
+ | 3 | Hub menu-launch flow (Module E) | ✅ hub → click Launch → animation → `/modules/e` |
27
+ | 4 | Cross-launch (E → S from sidebar) | ✅ exit scatter → S enter animation |
28
+ | 5 | Animation replay randomness (3+ launches) | ✅ re-seeded per launch (`Date.now() ^ hashModuleId ^ seq`); specs differ per seed (unit-proven) |
29
+ | 6 | Slow-motion assembly timing | ✅ sampled in-browser: x=-225→-76→-15→-3→0 px, opacity 0.03→0.66→0.93→0.98→1 over ~2.5 s, overlay holds full budget (~4.2 s incl. stagger) — cubic-bezier(0.22,1,0.36,1) ease-out visible |
30
+ | 7 | Exit choreography (module → hub) | ✅ sampled: assembled (x=0, op=1) → scatter (x=-79, op=0.36) → hub at ~910 ms |
31
+ | 8 | 60 fps budget | ✅ transform+opacity only (motion/WAAPI), `will-change` during animation only, double-rAF start, chart mounted after first frame, pages preloaded on hub mount + button hover |
32
+ | 9 | `prefers-reduced-motion` | ✅ instant-reveal path (duration 0, no transforms) + global CSS safeguard |
33
+ | 10 | Mobile 390×844 | ✅ hamburger nav, responsive dashboard, no overflow (screenshot) |
34
+ | 11 | Legacy deep links (`/campaigns`, `/leads`, …) | ✅ redirect → `/modules/e/<path>` (verified: `/campaigns` → `/modules/e/campaigns`) |
35
+ | 12 | Server API | ✅ `/api/health` 200 `{"status":"ok",...}`; SPA fallback serves all module routes |
36
+ | 13 | Console errors (hub, /modules/e, /modules/s, legacy) | ✅ none |
37
+ | 14 | Original module design preserved | ✅ E keeps mint GreenTheme; S keeps true-indigo/slate identity, original pages byte-port (imports re-pointed only) |
38
+ | 15 | Menu buttons match platform styling | ✅ active state, accent dot/glow, icons; permission model unchanged (local API-key vault) |
39
+
40
+ ## Safari / Firefox notes
41
+ - Animations use `motion` v12 → WAAPI where available with rAF fallback — supported in Safari 15.4+, Firefox 112+ (no vendor-specific APIs used).
42
+ - `background-attachment: fixed` (Module S gradient) is inert on iOS Safari by design; background remains the gradient itself (graceful).
43
+
44
+ ## Evidence
45
+ - `qa-1-hub.png` — platform hub
46
+ - `qa-2/3/4-*.png` — assembly → Module E revealed
47
+ - `qa-5-module-s.png` — Module S (prod indigo) workspace
48
+ - `qa-6/7-*.png` — return-to-hub choreography
49
+ - `qa-8-mobile-e.png` — mobile viewport
50
+ - `launch-e.webm`, `full-journey.webm`, `exit-s.webm` — full-flow recordings
README.md CHANGED
@@ -8,7 +8,17 @@ pinned: false
8
  app_port: 7860
9
  ---
10
 
11
- # Smartlead Full-Stack Dashboard
 
 
 
 
 
 
 
 
 
 
12
 
13
  This is a complete, production-ready full-stack application that wraps the Smartlead API.
14
 
 
8
  app_port: 7860
9
  ---
10
 
11
+ # BRIDGE Modules — Platform Hub
12
+
13
+ The BRIDGE platform hosts two standalone outbound workspaces as routed module pages:
14
+
15
+ - **Module E** (`/modules/e`) — mint GreenTheme build: autonomous cold outreach infrastructure, sequence management, unified inbox, email warmup, and deliverability command center.
16
+ - **Module S** (`/modules/s`) — prod build: advanced campaign management, sequences, unified inbox, email warmup, lead database, analytics, and webhook automation.
17
+
18
+ `/` is the platform hub with direct-launch buttons. Every launch plays a slow-motion
19
+ random-reassembly animation built from the platform's own dashboard primitives
20
+ (re-seeded per launch, `prefers-reduced-motion` respected). See `CODEBASE_MAP.md`,
21
+ `IMPLEMENTATION_PLAN.md` and `QA_REPORT.md`.
22
 
23
  This is a complete, production-ready full-stack application that wraps the Smartlead API.
24
 
index.html CHANGED
@@ -3,10 +3,10 @@
3
  <head>
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>BRIDGEModulE</title>
7
- <meta name="description" content="BRIDGEModulE - Autonomous Outbound & Deliverability Command Center" />
8
- <meta property="og:title" content="BRIDGEModulE" />
9
- <meta property="og:description" content="BRIDGEModulE - Autonomous Outbound & Deliverability Command Center" />
10
 
11
  <meta property="og:type" content="website" />
12
  <meta name="twitter:card" content="summary_large_image" />
 
3
  <head>
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>BRIDGE Modules</title>
7
+ <meta name="description" content="BRIDGE Modules - Autonomous Outbound & Deliverability Command Center" />
8
+ <meta property="og:title" content="BRIDGE Modules" />
9
+ <meta property="og:description" content="BRIDGE Modules - Autonomous Outbound & Deliverability Command Center" />
10
 
11
  <meta property="og:type" content="website" />
12
  <meta name="twitter:card" content="summary_large_image" />
metadata.json CHANGED
@@ -1,7 +1,8 @@
1
  {
2
- "name": "BRIDGEModulE",
3
- "description": "BRIDGEModulE - Autonomous cold outreach infrastructure, sequence management, unified inbox, email warmup, and deliverability command center.",
4
  "requestFramePermissions": [],
5
- "majorCapabilities": ["MAJOR_CAPABILITY_SERVER_SIDE_GEMINI_API"]
 
 
6
  }
7
-
 
1
  {
2
+ "name": "BRIDGE Modules",
3
+ "description": "BRIDGE Modules - the BRIDGE platform hub hosting Module E (mint GreenTheme outbound command center) and Module S (prod campaign management, sequences, unified inbox, email warmup, lead database, analytics, and webhook automation) as standalone routed workspaces.",
4
  "requestFramePermissions": [],
5
+ "majorCapabilities": [
6
+ "MAJOR_CAPABILITY_SERVER_SIDE_GEMINI_API"
7
+ ]
8
  }
 
src/lib/aiService.ts CHANGED
@@ -26,7 +26,7 @@ export async function getAiCompletion(prompt: string) {
26
  headers: {
27
  'Authorization': `Bearer ${process.env.OPENROUTER_API_KEY}`,
28
  'HTTP-Referer': process.env.APP_URL || 'http://localhost:3000',
29
- 'X-Title': 'BRIDGE ModulE Dashboard',
30
  },
31
  }
32
  );
 
26
  headers: {
27
  'Authorization': `Bearer ${process.env.OPENROUTER_API_KEY}`,
28
  'HTTP-Referer': process.env.APP_URL || 'http://localhost:3000',
29
+ 'X-Title': 'BRIDGE ModuleE Dashboard',
30
  },
31
  }
32
  );
src/lib/aiServiceServer.ts CHANGED
@@ -26,7 +26,7 @@ export async function getAiCompletionServer(prompt: string): Promise<string> {
26
  headers: {
27
  'Authorization': `Bearer ${process.env.OPENROUTER_API_KEY}`,
28
  'HTTP-Referer': process.env.APP_URL || 'http://localhost:3000',
29
- 'X-Title': 'BRIDGE ModulE Dashboard',
30
  },
31
  }
32
  );
 
26
  headers: {
27
  'Authorization': `Bearer ${process.env.OPENROUTER_API_KEY}`,
28
  'HTTP-Referer': process.env.APP_URL || 'http://localhost:3000',
29
+ 'X-Title': 'BRIDGE ModuleE Dashboard',
30
  },
31
  }
32
  );