- Removed the separate `igny8_sites` service from Docker Compose, integrating its functionality into the main app. - Updated the Site Builder components to enhance user experience, including improved loading states and error handling. - Refactored routing and navigation in the Site Builder Wizard and Preview components for better clarity and usability. - Adjusted test files to reflect changes in import paths and ensure compatibility with the new structure.
8.2 KiB
Site Builder Wizard Integration Plan
Overview
Integrate the Site Builder wizard directly into the main frontend app (frontend/src/pages/Sites/Builder/), using the same UI kit, state stores, and API helpers as the rest of the dashboard. The legacy sites/src/builder + sites/src/renderer code has been removed, so the only viable implementation path is the unified Sites module.
Current State
✅ What's Done
- Legacy builder/renderer folders removed from Sites container (no more parallel UI)
- Type definitions created in
frontend/src/types/siteBuilder.ts - API helper created in
frontend/src/services/siteBuilder.api.ts
⚠️ What's Missing
- Builder store not yet created in the main app
- Wizard steps/page still placeholder in
frontend/src/pages/Sites/Builder/ - No Tailwind/CX styling hooked into shared UI kit
- Routes/menu point to placeholder
- Tests/docs still reference old structure
- Sites container still contains stale references (needs cleanup after integration)
Integration Plan
Phase 1: Create API Service Layer ✅
Location: frontend/src/services/siteBuilder.api.ts
Tasks:
- Create
siteBuilderApiusingfetchAPIpattern (not axios) - Functions needed:
listBlueprints()createBlueprint(payload)generateStructure(blueprintId, payload)listPages(blueprintId)generateAllPages(blueprintId, options)createTasksForPages(blueprintId, pageIds)
API Endpoints (already exist in backend):
GET /api/v1/site-builder/blueprints/POST /api/v1/site-builder/blueprints/POST /api/v1/site-builder/blueprints/{id}/generate_structure/GET /api/v1/site-builder/pages/?site_blueprint={id}POST /api/v1/site-builder/blueprints/{id}/generate_all_pages/POST /api/v1/site-builder/blueprints/{id}/create_tasks/
Phase 2: Create Zustand Store ⏳
Location: frontend/src/store/builderStore.ts
Tasks:
- Copy
builderStore.tsfromsites/src/builder/state/ - Adapt to use
siteBuilderApiinstead ofbuilderApi - Integrate with
useSiteStoreanduseSectorStore:- Auto-populate
siteIdfromuseSiteStore().activeSite - Auto-populate
sectorIdfromuseSectorStore().activeSector - Show site/sector selector if not set
- Auto-populate
Store State:
form: BuilderFormData- Wizard form datacurrentStep: number- Current wizard step (0-3)isSubmitting: boolean- Generation in progressactiveBlueprint: SiteBlueprint | null- Latest blueprintpages: PageBlueprint[]- Generated pageserror: string | null- Error message
Phase 3: Create Type Definitions ✅
Location: frontend/src/types/siteBuilder.ts
Tasks:
- Copy types from
sites/src/builder/types/siteBuilder.ts - Ensure compatibility with frontend's existing types
Types Needed:
HostingTypeStylePreferencesBuilderFormDataSiteBlueprintPageBlueprintPageBlockSiteStructure
Phase 4: Create Wizard Step Components ⏳
Location: frontend/src/pages/Sites/Builder/steps/
Tasks:
- Copy step components from
sites/src/builder/pages/wizard/steps/ - Adapt to use frontend's UI components:
- Replace
Cardwithfrontend/src/components/ui/card/Card - Replace custom inputs with Tailwind-styled inputs
- Use frontend's
Buttoncomponent
- Replace
- Adapt styles to Tailwind CSS:
- Remove
.sb-field,.sb-grid,.sb-pillclasses - Use Tailwind utility classes instead
- Remove
Step Components:
BusinessDetailsStep.tsx- Site/sector selection, business infoBriefStep.tsx- Business brief textareaObjectivesStep.tsx- Objectives list with add/removeStyleStep.tsx- Style preferences (palette, typography, personality)
Phase 5: Create Main Wizard Page ⏳
Location: frontend/src/pages/Sites/Builder/Wizard.tsx
Tasks:
- Copy
WizardPage.tsxfromsites/src/builder/pages/wizard/ - Adapt to frontend patterns:
- Use
PageMetacomponent - Use frontend's
Cardcomponent - Use frontend's
Buttoncomponent - Use Tailwind CSS for styling
- Use
- Integrate with stores:
- Auto-load active site/sector
- Show site/sector selector if needed
- Navigate to sites list on completion
Features:
- 4-step wizard with progress indicators
- Step navigation (Back/Next buttons)
- Form validation
- Blueprint generation on submit
- Error handling
- Loading states
Phase 6: Create Site Definition Store (Optional) ⏳
Location: frontend/src/store/siteDefinitionStore.ts
Tasks:
- Copy
siteDefinitionStore.tsfromsites/src/builder/state/ - Use for preview functionality (if needed)
Phase 7: Update Routing & Navigation ✅
Location: frontend/src/App.tsx
Tasks:
- Ensure
/sites/builderroute points to newWizard.tsx - Update navigation to show wizard in Sites section
Phase 8: Fix Test File ✅
Location: frontend/src/__tests__/sites/BulkGeneration.test.tsx
Tasks:
- Update import path from
site-builder/src/api/builder.apitoservices/siteBuilder.api - Update mock path accordingly
Phase 9: Testing ⏳ (blocked by vitest not installed in dev env)
Tasks:
- Test wizard flow:
- Site selection
- Sector selection
- All 4 wizard steps
- Blueprint generation
- Error handling
- Test integration:
- Site/sector auto-population
- Navigation
- API calls
Phase 10: Cleanup ⏳
Tasks:
- Stop
igny8_site_buildercontainer - Remove Docker image
- Remove
/site-builderfolder - Update documentation
File Structure After Integration
frontend/src/
├── pages/Sites/Builder/
│ ├── Wizard.tsx # Main wizard page (UPDATED)
│ ├── Preview.tsx # Preview page (keep placeholder for now)
│ ├── Blueprints.tsx # Blueprints list (already exists)
│ └── steps/ # NEW
│ ├── BusinessDetailsStep.tsx
│ ├── BriefStep.tsx
│ ├── ObjectivesStep.tsx
│ └── StyleStep.tsx
├── services/
│ └── siteBuilder.api.ts # NEW - API service
├── store/
│ ├── builderStore.ts # NEW - Builder state
│ └── siteDefinitionStore.ts # NEW - Site definition state (optional)
└── types/
└── siteBuilder.ts # NEW - Type definitions
Key Adaptations Needed
1. API Client Pattern
From (sites container):
import axios from 'axios';
const client = axios.create({ baseURL: BASE_PATH });
To (frontend):
import { fetchAPI } from '../services/api';
// Use fetchAPI directly, no axios
2. Component Library
From (sites container):
import { Card } from '../../components/common/Card';
To (frontend):
import { Card } from '../../../components/ui/card/Card';
3. Styling
From (sites container):
.sb-field { ... }
.sb-grid { ... }
To (frontend):
className="flex flex-col gap-2"
className="grid grid-cols-2 gap-4"
4. Store Integration
From (sites container):
// Manual siteId/sectorId input
To (frontend):
import { useSiteStore } from '../../../store/siteStore';
import { useSectorStore } from '../../../store/sectorStore';
// Auto-populate from stores
Implementation Order
- ✅ Create types (
types/siteBuilder.ts) - ✅ Create API service (
services/siteBuilder.api.ts) - ⏳ Create builder store (
store/builderStore.ts) - ⏳ Create step components (
pages/Sites/Builder/steps/) - ⏳ Create main wizard page (
pages/Sites/Builder/Wizard.tsx) - ⏳ Fix test file(s)
- ⏳ Test integration
- ⏳ Cleanup site-builder container/image/docs
Success Criteria
- ✅ Wizard loads in main app at
/sites/builder - ✅ Site/sector auto-populated from stores
- ✅ All 4 steps work correctly
- ✅ Blueprint generation works
- ✅ Error handling works
- ✅ Navigation works
- ✅ No references to
site-builder/folder in code - ✅ Test file updated
- ✅ Sites container removed or marked deprecated in compose
Notes
- Sites container will be deprecated once the wizard lives entirely inside the main app.
- Only integrate wizard into main frontend app (no parallel codepaths).
- Use frontend's existing patterns/components/stores for absolute consistency.