rearr
This commit is contained in:
84
part2-dev/site-builder-docs-to-remove/DEPLOYMENT_GUIDE.md
Normal file
84
part2-dev/site-builder-docs-to-remove/DEPLOYMENT_GUIDE.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# Site Deployment Guide
|
||||
|
||||
## How Site Deployment Works
|
||||
|
||||
### Overview
|
||||
When you deploy a site blueprint, the system:
|
||||
1. Builds a site definition (merging Content from Writer into PageBlueprint blocks)
|
||||
2. Writes it to the filesystem at `/data/app/sites-data/clients/{site_id}/v{version}/`
|
||||
3. The Sites Renderer reads from this filesystem to serve the public site
|
||||
|
||||
### Deployment Process
|
||||
|
||||
#### Step 1: Prepare Your Site
|
||||
1. **Generate Structure**: Create site blueprint with pages (has placeholder blocks)
|
||||
2. **Generate Content**: Pages → Tasks → Content (Writer generates real content)
|
||||
3. **Publish Content**: In Content Manager, set Content status to `'publish'` for each page
|
||||
4. **Publish Pages**: In Page Manager, set Page status to `'published'` (for navigation)
|
||||
|
||||
#### Step 2: Deploy the Blueprint
|
||||
**API Endpoint**: `POST /api/v1/publisher/deploy/{blueprint_id}/`
|
||||
|
||||
**What Happens**:
|
||||
- `SitesRendererAdapter.deploy()` is called
|
||||
- For each page, it finds the associated Writer Task
|
||||
- If Content exists and is published, it uses `Content.json_blocks` instead of blueprint placeholders
|
||||
- Builds complete site definition with all pages
|
||||
- Writes to filesystem: `/data/app/sites-data/clients/{site_id}/v{version}/site.json`
|
||||
- Creates deployment record
|
||||
|
||||
#### Step 3: Access Your Site
|
||||
**Public URL**: `https://sites.igny8.com/{siteSlug}`
|
||||
|
||||
**How It Works**:
|
||||
- Sites Renderer loads site definition from filesystem (or API fallback)
|
||||
- Shows navigation menu with all published pages
|
||||
- Home route (`/siteSlug`) shows only home page content
|
||||
- Page routes (`/siteSlug/pageSlug`) show specific page content
|
||||
|
||||
### Navigation Menu
|
||||
|
||||
The navigation menu automatically includes:
|
||||
- **Home** link (always shown)
|
||||
- All pages with status `'published'` or `'ready'` (excluding home)
|
||||
- Pages are sorted by their `order` field
|
||||
|
||||
### Page Routing
|
||||
|
||||
- **Homepage**: `https://sites.igny8.com/{siteSlug}` → Shows home page only
|
||||
- **Individual Pages**: `https://sites.igny8.com/{siteSlug}/{pageSlug}` → Shows that specific page
|
||||
- Example: `https://sites.igny8.com/auto-g8/products`
|
||||
- Example: `https://sites.igny8.com/auto-g8/blog`
|
||||
|
||||
### Content Merging
|
||||
|
||||
When deploying:
|
||||
- **If Content is published**: Uses `Content.json_blocks` (actual written content)
|
||||
- **If Content not published**: Uses `PageBlueprint.blocks_json` (placeholder blocks)
|
||||
- **Content takes precedence**: Published Content always replaces blueprint placeholders
|
||||
|
||||
### Important Notes
|
||||
|
||||
1. **Two Statuses**:
|
||||
- `PageBlueprint.status = 'published'` → Controls page visibility in navigation
|
||||
- `Content.status = 'publish'` → Controls which content is used (real vs placeholder)
|
||||
|
||||
2. **Redeploy Required**: After publishing Content, you must **redeploy** the site for changes to appear
|
||||
|
||||
3. **All Pages Deployed**: The deployment includes ALL pages from the blueprint, but only published pages show in navigation
|
||||
|
||||
4. **Navigation Auto-Generated**: If no explicit navigation is set in blueprint, it auto-generates from published pages
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
**Problem**: Navigation only shows "Home"
|
||||
- **Solution**: Make sure other pages have status `'published'` or `'ready'` in Page Manager
|
||||
|
||||
**Problem**: Pages show placeholder content instead of real content
|
||||
- **Solution**:
|
||||
1. Check Content status is `'publish'` in Content Manager
|
||||
2. Redeploy the site blueprint
|
||||
|
||||
**Problem**: Pages not accessible via URL
|
||||
- **Solution**: Make sure pages have status `'published'` or `'ready'` and the site is deployed
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
# Site Builder & AI Functions - Comprehensive Audit Report
|
||||
|
||||
## Executive Summary
|
||||
This audit identifies all requirements, dependencies, and gaps for the Site Builder functionality and related AI generation features. The primary issues are:
|
||||
1. **Database migrations not applied** - Site builder tables don't exist
|
||||
2. **Redis/Celery not running** - AI tasks can't execute asynchronously
|
||||
3. All code components are present and properly configured
|
||||
|
||||
---
|
||||
|
||||
## Requirements Audit Table
|
||||
|
||||
| Category | Component | Requirement | Status | Location/Notes | Action Required |
|
||||
|----------|-----------|-------------|--------|----------------|-----------------|
|
||||
| **Database** | Migrations | `0001_initial.py` - SiteBlueprint, PageBlueprint tables | ✅ EXISTS | `backend/igny8_core/business/site_building/migrations/0001_initial.py` | ❌ **NOT APPLIED** - Run migrations |
|
||||
| **Database** | Migrations | `0002_sitebuilder_metadata.py` - BusinessType, AudienceProfile, BrandPersonality, HeroImageryDirection | ✅ EXISTS | `backend/igny8_core/business/site_building/migrations/0002_sitebuilder_metadata.py` | ❌ **NOT APPLIED** - Run migrations |
|
||||
| **Database** | Table | `igny8_site_blueprints` | ❌ MISSING | Should be created by 0001_initial.py | Run `python manage.py migrate site_building` |
|
||||
| **Database** | Table | `igny8_page_blueprints` | ❌ MISSING | Should be created by 0001_initial.py | Run `python manage.py migrate site_building` |
|
||||
| **Database** | Table | `igny8_site_builder_business_types` | ❌ MISSING | Should be created by 0002_sitebuilder_metadata.py | Run `python manage.py migrate site_building` |
|
||||
| **Database** | Table | `igny8_site_builder_audience_profiles` | ❌ MISSING | Should be created by 0002_sitebuilder_metadata.py | Run `python manage.py migrate site_building` |
|
||||
| **Database** | Table | `igny8_site_builder_brand_personalities` | ❌ MISSING | Should be created by 0002_sitebuilder_metadata.py | Run `python manage.py migrate site_building` |
|
||||
| **Database** | Table | `igny8_site_builder_hero_imagery` | ❌ MISSING | Should be created by 0002_sitebuilder_metadata.py | Run `python manage.py migrate site_building` |
|
||||
| **Database** | Seed Data | Business types, audience profiles, brand personalities, hero imagery | ✅ DEFINED | Migration 0002 includes `seed_site_builder_metadata()` function | Will seed automatically when migration runs |
|
||||
| **App Config** | Django App | `igny8_core.business.site_building.apps.SiteBuildingConfig` | ✅ REGISTERED | `backend/igny8_core/settings.py:55` | No action needed |
|
||||
| **App Config** | Django App | `igny8_core.modules.site_builder.apps.SiteBuilderConfig` | ✅ REGISTERED | `backend/igny8_core/settings.py:59` | No action needed |
|
||||
| **Models** | SiteBlueprint | Model with all fields (name, description, config_json, structure_json, status, hosting_type, version) | ✅ EXISTS | `backend/igny8_core/business/site_building/models.py:10-83` | No action needed |
|
||||
| **Models** | PageBlueprint | Model with all fields (site_blueprint, slug, title, type, blocks_json, status, order) | ✅ EXISTS | `backend/igny8_core/business/site_building/models.py:85-166` | No action needed |
|
||||
| **Models** | BusinessType | Model extending SiteBuilderOption | ✅ EXISTS | `backend/igny8_core/business/site_building/models.py:189-194` | No action needed |
|
||||
| **Models** | AudienceProfile | Model extending SiteBuilderOption | ✅ EXISTS | `backend/igny8_core/business/site_building/models.py:197-202` | No action needed |
|
||||
| **Models** | BrandPersonality | Model extending SiteBuilderOption | ✅ EXISTS | `backend/igny8_core/business/site_building/models.py:205-210` | No action needed |
|
||||
| **Models** | HeroImageryDirection | Model extending SiteBuilderOption | ✅ EXISTS | `backend/igny8_core/business/site_building/models.py:213-218` | No action needed |
|
||||
| **Services** | StructureGenerationService | Service to trigger AI structure generation | ✅ EXISTS | `backend/igny8_core/business/site_building/services/structure_generation_service.py` | No action needed |
|
||||
| **Services** | PageGenerationService | Service to generate page content via Writer | ✅ EXISTS | `backend/igny8_core/business/site_building/services/page_generation_service.py` | No action needed |
|
||||
| **Services** | SiteBuilderFileService | File management service | ✅ EXISTS | `backend/igny8_core/business/site_building/services/file_management_service.py` | No action needed |
|
||||
| **AI Functions** | GenerateSiteStructureFunction | AI function class | ✅ EXISTS | `backend/igny8_core/ai/functions/generate_site_structure.py` | No action needed |
|
||||
| **AI Functions** | Function Registration | `generate_site_structure` registered in registry | ✅ REGISTERED | `backend/igny8_core/ai/registry.py:97-112` | No action needed |
|
||||
| **AI Functions** | AI Task Dispatch | `run_ai_task` Celery task | ✅ EXISTS | `backend/igny8_core/ai/tasks.py:12-147` | No action needed |
|
||||
| **AI Functions** | Prompt Template | `site_structure_generation` prompt | ✅ EXISTS | `backend/igny8_core/ai/prompts.py:242-307` | No action needed |
|
||||
| **AI Functions** | Prompt Mapping | Function name → prompt type mapping | ✅ CONFIGURED | `backend/igny8_core/ai/prompts.py:599` | No action needed |
|
||||
| **API Endpoints** | SiteBlueprintViewSet | CRUD + generate_structure action | ✅ EXISTS | `backend/igny8_core/modules/site_builder/views.py:32-81` | No action needed |
|
||||
| **API Endpoints** | PageBlueprintViewSet | CRUD + generate_content action | ✅ EXISTS | `backend/igny8_core/modules/site_builder/views.py:141-172` | No action needed |
|
||||
| **API Endpoints** | SiteBuilderMetadataView | Metadata endpoint for dropdowns | ✅ EXISTS | `backend/igny8_core/modules/site_builder/views.py:216-250` | ❌ **FAILS** - Needs DB tables |
|
||||
| **API Endpoints** | SiteAssetView | File upload/download | ✅ EXISTS | `backend/igny8_core/modules/site_builder/views.py:175-213` | No action needed |
|
||||
| **API URLs** | Site Builder URLs | `/api/v1/site-builder/` routes | ✅ CONFIGURED | `backend/igny8_core/modules/site_builder/urls.py` | No action needed |
|
||||
| **API URLs** | URL Registration | Included in main urls.py | ✅ REGISTERED | `backend/igny8_core/urls.py:30` | No action needed |
|
||||
| **Billing** | Credit Cost | `site_structure_generation: 50 credits` | ✅ DEFINED | `backend/igny8_core/business/billing/constants.py:13` | No action needed |
|
||||
| **Billing** | Credit Cost | `site_page_generation: 20 credits` | ✅ DEFINED | `backend/igny8_core/business/billing/constants.py:14` | No action needed |
|
||||
| **Billing** | Credit Check | CreditService.check_credits() called | ✅ IMPLEMENTED | `backend/igny8_core/business/site_building/services/structure_generation_service.py:57` | No action needed |
|
||||
| **Celery** | Configuration | Celery app configured | ✅ CONFIGURED | `backend/igny8_core/celery.py` | No action needed |
|
||||
| **Celery** | Settings | CELERY_BROKER_URL, CELERY_RESULT_BACKEND | ✅ CONFIGURED | `backend/igny8_core/settings.py:497-508` | No action needed |
|
||||
| **Celery** | Worker Container | `igny8_celery_worker` in docker-compose | ✅ DEFINED | `docker-compose.app.yml:105-128` | ❌ **NOT RUNNING** - Start container |
|
||||
| **Celery** | Beat Container | `igny8_celery_beat` in docker-compose | ✅ DEFINED | `docker-compose.app.yml:130-153` | ❌ **NOT RUNNING** - Start container |
|
||||
| **Redis** | Configuration | REDIS_HOST, REDIS_PORT env vars | ✅ CONFIGURED | `docker-compose.app.yml:38-39, 115-116, 140-141` | No action needed |
|
||||
| **Redis** | Redis Service | External Redis service | ❌ **NOT ACCESSIBLE** | Expected from infra stack | ❌ **NOT RUNNING** - Start Redis service |
|
||||
| **Dependencies** | Python Packages | celery>=5.3.0 | ✅ IN REQUIREMENTS | `backend/requirements.txt:11` | No action needed |
|
||||
| **Dependencies** | Python Packages | redis | ✅ IN REQUIREMENTS | `backend/requirements.txt:4` | No action needed |
|
||||
| **Dependencies** | Python Packages | Django>=5.2.7 | ✅ IN REQUIREMENTS | `backend/requirements.txt:1` | No action needed |
|
||||
| **Dependencies** | Python Packages | djangorestframework | ✅ IN REQUIREMENTS | `backend/requirements.txt:6` | No action needed |
|
||||
| **Frontend** | API Client | siteBuilderApi functions | ✅ EXISTS | `frontend/src/services/siteBuilder.api.ts` | No action needed |
|
||||
| **Frontend** | Store | useBuilderStore with metadata loading | ✅ EXISTS | `frontend/src/store/builderStore.ts:399-412` | No action needed |
|
||||
| **Logging** | StructureGenerationService | Logging statements | ✅ IMPLEMENTED | `backend/igny8_core/business/site_building/services/structure_generation_service.py:49-53, 98-102` | No action needed |
|
||||
| **Logging** | GenerateSiteStructure | Logging statements | ✅ IMPLEMENTED | `backend/igny8_core/ai/functions/generate_site_structure.py:135` | No action needed |
|
||||
| **Error Handling** | InsufficientCreditsError | Handled in StructureGenerationService | ✅ IMPLEMENTED | `backend/igny8_core/business/site_building/services/structure_generation_service.py:58-61` | No action needed |
|
||||
| **Error Handling** | Celery Fallback | Synchronous execution if Celery unavailable | ✅ IMPLEMENTED | `backend/igny8_core/business/site_building/services/structure_generation_service.py:109-115` | No action needed |
|
||||
|
||||
---
|
||||
|
||||
## Critical Issues Summary
|
||||
|
||||
### 🔴 **CRITICAL - Database Migrations Not Applied**
|
||||
**Impact**: All Site Builder endpoints fail with `ProgrammingError: relation "igny8_site_builder_business_types" does not exist`
|
||||
|
||||
**Root Cause**: Migrations exist but haven't been run on the database
|
||||
|
||||
**Fix Required**:
|
||||
```bash
|
||||
# Step 1: Navigate to app directory
|
||||
cd /data/app/igny8
|
||||
|
||||
# Step 2: Create migrations if model changes exist
|
||||
docker compose -f docker-compose.app.yml -p igny8-app exec igny8_backend python manage.py makemigrations site_building
|
||||
|
||||
# Step 3: Apply migrations
|
||||
docker compose -f docker-compose.app.yml -p igny8-app exec igny8_backend python manage.py migrate site_building
|
||||
|
||||
# Alternative: If backend is in infra stack, use:
|
||||
# cd /data/app
|
||||
# docker compose -f docker-compose.yml -p igny8-infra exec <backend_container_name> python manage.py makemigrations site_building
|
||||
# docker compose -f docker-compose.yml -p igny8-infra exec <backend_container_name> python manage.py migrate site_building
|
||||
```
|
||||
|
||||
**Files Affected**:
|
||||
- `backend/igny8_core/business/site_building/migrations/0001_initial.py`
|
||||
- `backend/igny8_core/business/site_building/migrations/0002_sitebuilder_metadata.py`
|
||||
|
||||
**Tables That Will Be Created**:
|
||||
1. `igny8_site_blueprints`
|
||||
2. `igny8_page_blueprints`
|
||||
3. `igny8_site_builder_business_types`
|
||||
4. `igny8_site_builder_audience_profiles`
|
||||
5. `igny8_site_builder_brand_personalities`
|
||||
6. `igny8_site_builder_hero_imagery`
|
||||
|
||||
---
|
||||
|
||||
### 🔴 **CRITICAL - Redis Not Running**
|
||||
**Impact**: Celery tasks can't be queued, AI generation fails silently or runs synchronously
|
||||
|
||||
**Root Cause**: Redis service is not accessible (Connection refused errors in logs)
|
||||
|
||||
**Fix Required**:
|
||||
1. Ensure Redis service is running in the infra stack
|
||||
2. Verify network connectivity between backend and Redis
|
||||
3. Check Redis is accessible at `redis:6379` from backend container
|
||||
|
||||
**Configuration**:
|
||||
- Expected: `redis://redis:6379/0`
|
||||
- Environment vars: `REDIS_HOST=redis`, `REDIS_PORT=6379`
|
||||
|
||||
---
|
||||
|
||||
### 🔴 **CRITICAL - Celery Worker Not Running**
|
||||
**Impact**: Even if Redis is fixed, AI tasks won't execute because no worker is processing them
|
||||
|
||||
**Root Cause**: `igny8_celery_worker` container is not running
|
||||
|
||||
**Fix Required**:
|
||||
```bash
|
||||
# Navigate to app directory
|
||||
cd /data/app/igny8
|
||||
|
||||
# Start Celery worker
|
||||
docker compose -f docker-compose.app.yml -p igny8-app up -d igny8_celery_worker
|
||||
|
||||
# Verify it's running
|
||||
docker compose -f docker-compose.app.yml -p igny8-app ps igny8_celery_worker
|
||||
```
|
||||
|
||||
**Container Configuration**: `docker-compose.app.yml:105-128`
|
||||
|
||||
**Note**: If backend is in infra stack, Celery worker may also be there. Check which stack contains the backend service.
|
||||
|
||||
---
|
||||
|
||||
### 🟡 **WARNING - Celery Beat Not Running**
|
||||
**Impact**: Periodic tasks (credit replenishment, automation rules) won't run
|
||||
|
||||
**Root Cause**: `igny8_celery_beat` container is not running
|
||||
|
||||
**Fix Required**:
|
||||
```bash
|
||||
# Navigate to app directory
|
||||
cd /data/app/igny8
|
||||
|
||||
# Start Celery beat
|
||||
docker compose -f docker-compose.app.yml -p igny8-app up -d igny8_celery_beat
|
||||
|
||||
# Verify it's running
|
||||
docker compose -f docker-compose.app.yml -p igny8-app ps igny8_celery_beat
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Verification Checklist
|
||||
|
||||
After fixing the critical issues, verify:
|
||||
|
||||
- [ ] Database migrations applied: `python manage.py showmigrations site_building` shows all as `[X]`
|
||||
- [ ] Tables exist: Query `igny8_site_builder_business_types` returns data
|
||||
- [ ] Redis accessible: `redis-cli -h redis ping` returns `PONG`
|
||||
- [ ] Celery worker running: `docker ps | grep celery_worker` shows container
|
||||
- [ ] Celery worker connected: Check logs for "celery@hostname ready"
|
||||
- [ ] Metadata endpoint works: `GET /api/v1/site-builder/metadata/` returns 200 with data
|
||||
- [ ] AI task can be queued: Check logs for `[StructureGenerationService] Queued AI task`
|
||||
- [ ] AI task executes: Check logs for `run_ai_task STARTED: generate_site_structure`
|
||||
|
||||
---
|
||||
|
||||
## Code Quality Assessment
|
||||
|
||||
### ✅ **Strengths**
|
||||
1. **Complete Implementation**: All core components are implemented
|
||||
2. **Proper Separation**: Business logic separated from API layer
|
||||
3. **Error Handling**: Graceful fallbacks for Celery unavailability
|
||||
4. **Credit System**: Properly integrated with billing system
|
||||
5. **Logging**: Comprehensive logging throughout the flow
|
||||
6. **Type Hints**: Good use of type hints in services
|
||||
7. **Documentation**: Models and services have docstrings
|
||||
|
||||
### ⚠️ **Potential Improvements**
|
||||
1. **Migration Dependencies**: Ensure migration dependencies are correct (currently depends on `igny8_core_auth.0014` and `writer.0009`)
|
||||
2. **Error Messages**: Could be more user-friendly in API responses
|
||||
3. **Testing**: Test files exist but may need updates for current implementation
|
||||
4. **Monitoring**: Consider adding metrics for AI task success/failure rates
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **Immediate**: Run database migrations
|
||||
2. **Immediate**: Start Redis service (if in infra stack)
|
||||
3. **Immediate**: Start Celery worker container
|
||||
4. **Immediate**: Start Celery beat container (optional but recommended)
|
||||
5. **Verification**: Test metadata endpoint
|
||||
6. **Verification**: Test structure generation endpoint
|
||||
7. **Monitoring**: Watch logs for AI task execution
|
||||
|
||||
---
|
||||
|
||||
## Files Reference
|
||||
|
||||
### Core Models
|
||||
- `backend/igny8_core/business/site_building/models.py` - All Site Builder models
|
||||
|
||||
### Services
|
||||
- `backend/igny8_core/business/site_building/services/structure_generation_service.py` - AI structure generation
|
||||
- `backend/igny8_core/business/site_building/services/page_generation_service.py` - Page content generation
|
||||
- `backend/igny8_core/business/site_building/services/file_management_service.py` - File handling
|
||||
|
||||
### AI Functions
|
||||
- `backend/igny8_core/ai/functions/generate_site_structure.py` - AI function implementation
|
||||
- `backend/igny8_core/ai/tasks.py` - Celery task dispatcher
|
||||
- `backend/igny8_core/ai/registry.py` - Function registry
|
||||
|
||||
### API Layer
|
||||
- `backend/igny8_core/modules/site_builder/views.py` - API endpoints
|
||||
- `backend/igny8_core/modules/site_builder/urls.py` - URL routing
|
||||
- `backend/igny8_core/modules/site_builder/serializers.py` - Request/response serialization
|
||||
|
||||
### Configuration
|
||||
- `backend/igny8_core/settings.py` - Django settings
|
||||
- `backend/igny8_core/celery.py` - Celery configuration
|
||||
- `docker-compose.app.yml` - Container definitions
|
||||
- `backend/requirements.txt` - Python dependencies
|
||||
|
||||
---
|
||||
|
||||
**Report Generated**: Based on comprehensive codebase analysis
|
||||
**Status**: All code components present, infrastructure needs attention
|
||||
|
||||
@@ -0,0 +1,264 @@
|
||||
# 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**:
|
||||
1. Create `siteBuilderApi` using `fetchAPI` pattern (not axios)
|
||||
2. 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**:
|
||||
1. Copy `builderStore.ts` from `sites/src/builder/state/`
|
||||
2. Adapt to use `siteBuilderApi` instead of `builderApi`
|
||||
3. Integrate with `useSiteStore` and `useSectorStore`:
|
||||
- Auto-populate `siteId` from `useSiteStore().activeSite`
|
||||
- Auto-populate `sectorId` from `useSectorStore().activeSector`
|
||||
- Show site/sector selector if not set
|
||||
|
||||
**Store State**:
|
||||
- `form: BuilderFormData` - Wizard form data
|
||||
- `currentStep: number` - Current wizard step (0-3)
|
||||
- `isSubmitting: boolean` - Generation in progress
|
||||
- `activeBlueprint: SiteBlueprint | null` - Latest blueprint
|
||||
- `pages: PageBlueprint[]` - Generated pages
|
||||
- `error: string | null` - Error message
|
||||
|
||||
### Phase 3: Create Type Definitions ✅
|
||||
**Location**: `frontend/src/types/siteBuilder.ts`
|
||||
|
||||
**Tasks**:
|
||||
1. Copy types from `sites/src/builder/types/siteBuilder.ts`
|
||||
2. Ensure compatibility with frontend's existing types
|
||||
|
||||
**Types Needed**:
|
||||
- `HostingType`
|
||||
- `StylePreferences`
|
||||
- `BuilderFormData`
|
||||
- `SiteBlueprint`
|
||||
- `PageBlueprint`
|
||||
- `PageBlock`
|
||||
- `SiteStructure`
|
||||
|
||||
### Phase 4: Create Wizard Step Components ⏳
|
||||
**Location**: `frontend/src/pages/Sites/Builder/steps/`
|
||||
|
||||
**Tasks**:
|
||||
1. Copy step components from `sites/src/builder/pages/wizard/steps/`
|
||||
2. Adapt to use frontend's UI components:
|
||||
- Replace `Card` with `frontend/src/components/ui/card/Card`
|
||||
- Replace custom inputs with Tailwind-styled inputs
|
||||
- Use frontend's `Button` component
|
||||
3. Adapt styles to Tailwind CSS:
|
||||
- Remove `.sb-field`, `.sb-grid`, `.sb-pill` classes
|
||||
- Use Tailwind utility classes instead
|
||||
|
||||
**Step Components**:
|
||||
- `BusinessDetailsStep.tsx` - Site/sector selection, business info
|
||||
- `BriefStep.tsx` - Business brief textarea
|
||||
- `ObjectivesStep.tsx` - Objectives list with add/remove
|
||||
- `StyleStep.tsx` - Style preferences (palette, typography, personality)
|
||||
|
||||
### Phase 5: Create Main Wizard Page ⏳
|
||||
**Location**: `frontend/src/pages/Sites/Builder/Wizard.tsx`
|
||||
|
||||
**Tasks**:
|
||||
1. Copy `WizardPage.tsx` from `sites/src/builder/pages/wizard/`
|
||||
2. Adapt to frontend patterns:
|
||||
- Use `PageMeta` component
|
||||
- Use frontend's `Card` component
|
||||
- Use frontend's `Button` component
|
||||
- Use Tailwind CSS for styling
|
||||
3. 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**:
|
||||
1. Copy `siteDefinitionStore.ts` from `sites/src/builder/state/`
|
||||
2. Use for preview functionality (if needed)
|
||||
|
||||
### Phase 7: Update Routing & Navigation ✅
|
||||
**Location**: `frontend/src/App.tsx`
|
||||
|
||||
**Tasks**:
|
||||
1. Ensure `/sites/builder` route points to new `Wizard.tsx`
|
||||
2. Update navigation to show wizard in Sites section
|
||||
|
||||
### Phase 8: Fix Test File ✅
|
||||
**Location**: `frontend/src/__tests__/sites/BulkGeneration.test.tsx`
|
||||
|
||||
**Tasks**:
|
||||
1. Update import path from `site-builder/src/api/builder.api` to `services/siteBuilder.api`
|
||||
2. Update mock path accordingly
|
||||
|
||||
### Phase 9: Testing ⏳ *(blocked by vitest not installed in dev env)*
|
||||
**Tasks**:
|
||||
1. Test wizard flow:
|
||||
- Site selection
|
||||
- Sector selection
|
||||
- All 4 wizard steps
|
||||
- Blueprint generation
|
||||
- Error handling
|
||||
2. Test integration:
|
||||
- Site/sector auto-population
|
||||
- Navigation
|
||||
- API calls
|
||||
|
||||
### Phase 10: Cleanup ⏳
|
||||
**Tasks**:
|
||||
1. Stop `igny8_site_builder` container
|
||||
2. Remove Docker image
|
||||
3. Remove `/site-builder` folder
|
||||
4. 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):
|
||||
```typescript
|
||||
import axios from 'axios';
|
||||
const client = axios.create({ baseURL: BASE_PATH });
|
||||
```
|
||||
|
||||
**To** (frontend):
|
||||
```typescript
|
||||
import { fetchAPI } from '../services/api';
|
||||
// Use fetchAPI directly, no axios
|
||||
```
|
||||
|
||||
### 2. Component Library
|
||||
**From** (sites container):
|
||||
```typescript
|
||||
import { Card } from '../../components/common/Card';
|
||||
```
|
||||
|
||||
**To** (frontend):
|
||||
```typescript
|
||||
import { Card } from '../../../components/ui/card/Card';
|
||||
```
|
||||
|
||||
### 3. Styling
|
||||
**From** (sites container):
|
||||
```css
|
||||
.sb-field { ... }
|
||||
.sb-grid { ... }
|
||||
```
|
||||
|
||||
**To** (frontend):
|
||||
```tsx
|
||||
className="flex flex-col gap-2"
|
||||
className="grid grid-cols-2 gap-4"
|
||||
```
|
||||
|
||||
### 4. Store Integration
|
||||
**From** (sites container):
|
||||
```typescript
|
||||
// Manual siteId/sectorId input
|
||||
```
|
||||
|
||||
**To** (frontend):
|
||||
```typescript
|
||||
import { useSiteStore } from '../../../store/siteStore';
|
||||
import { useSectorStore } from '../../../store/sectorStore';
|
||||
// Auto-populate from stores
|
||||
```
|
||||
|
||||
## Implementation Order
|
||||
|
||||
1. ✅ Create types (`types/siteBuilder.ts`)
|
||||
2. ✅ Create API service (`services/siteBuilder.api.ts`)
|
||||
3. ⏳ Create builder store (`store/builderStore.ts`)
|
||||
4. ⏳ Create step components (`pages/Sites/Builder/steps/`)
|
||||
5. ⏳ Create main wizard page (`pages/Sites/Builder/Wizard.tsx`)
|
||||
6. ⏳ Fix test file(s)
|
||||
7. ⏳ Test integration
|
||||
8. ⏳ 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.
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
# Site Builder URLs and File Management
|
||||
|
||||
## Summary of Implementation
|
||||
|
||||
### ✅ Generate Page Content Step
|
||||
|
||||
**Location**: `frontend/src/pages/Sites/Builder/Preview.tsx`
|
||||
|
||||
**Implementation**:
|
||||
- Added "Generate All Pages" button (shown when blueprint status is `'ready'`)
|
||||
- Button triggers `generateAllPages()` from `builderStore`
|
||||
- Shows ProgressModal during generation
|
||||
- Uses existing `PageGenerationService.bulk_generate_pages()` backend function
|
||||
|
||||
**Queue Function**: ✅ **EXISTS**
|
||||
- `PageGenerationService.bulk_generate_pages()` creates Writer Tasks
|
||||
- Tasks are queued via `ContentGenerationService.generate_content()`
|
||||
- Each page blueprint gets a Writer Task with title: `"[Site Builder] {page_title}"`
|
||||
- Tasks are processed by Celery workers
|
||||
|
||||
---
|
||||
|
||||
## URL Standards
|
||||
|
||||
### Public Site URLs (Deployed Sites)
|
||||
|
||||
**Current Implementation** (Placeholder):
|
||||
- Pattern: `https://{site_id}.igny8.com`
|
||||
- Generated by: `SitesRendererAdapter._get_deployment_url()`
|
||||
- Location: `backend/igny8_core/business/publishing/services/adapters/sites_renderer_adapter.py:191`
|
||||
|
||||
**Planned Implementation** (from docs):
|
||||
- Custom domains: `clientdomain.com` → routed via Caddy
|
||||
- Subdomain: `mysite.igny8.com` → routed via Caddy
|
||||
- Marketing site: `igny8.com` → `/igny8-sites/marketing/`
|
||||
|
||||
**Sites Renderer Routes**:
|
||||
- Public routes: `/:siteId/*` (no auth required)
|
||||
- Loads from: `/data/app/sites-data/clients/{site_id}/v{version}/`
|
||||
|
||||
---
|
||||
|
||||
### Admin/Management URLs (Frontend App)
|
||||
|
||||
**Site Management Routes** (from `frontend/src/App.tsx`):
|
||||
- `/sites` - All sites list
|
||||
- `/sites/:id` - Site dashboard
|
||||
- `/sites/:id/content` - Site content list
|
||||
- `/sites/:id/editor` - Site content editor
|
||||
- `/sites/:id/pages` - Page manager
|
||||
- `/sites/:id/pages/new` - Create new page
|
||||
- `/sites/:id/pages/:pageId/edit` - Edit page
|
||||
- `/sites/:id/posts/:postId` - View/edit post
|
||||
- `/sites/:id/posts/:postId/edit` - Edit post
|
||||
- `/sites/:id/preview` - Site preview
|
||||
- `/sites/:id/settings` - Site settings (General, SEO, OG, Schema, Integrations)
|
||||
- `/sites/manage` - Site management dashboard
|
||||
|
||||
**Site Builder Routes**:
|
||||
- `/sites/builder` - Site Builder wizard
|
||||
- `/sites/builder/preview` - Preview blueprint (with Generate All Pages button)
|
||||
- `/sites/blueprints` - Blueprints list
|
||||
|
||||
---
|
||||
|
||||
## File Management
|
||||
|
||||
### File Storage Structure
|
||||
|
||||
**Site Files**:
|
||||
```
|
||||
/data/app/sites-data/
|
||||
└── clients/
|
||||
└── {site_id}/
|
||||
└── v{version}/
|
||||
├── site.json
|
||||
├── pages/
|
||||
│ ├── home.json
|
||||
│ ├── about.json
|
||||
│ └── ...
|
||||
└── assets/ # User-managed files
|
||||
├── images/
|
||||
├── documents/
|
||||
└── media/
|
||||
```
|
||||
|
||||
**Service**: `SiteBuilderFileService`
|
||||
- Location: `backend/igny8_core/business/site_building/services/file_management_service.py`
|
||||
- Base path: `/data/app/sites-data/clients`
|
||||
- Max file size: 10MB per file
|
||||
- Max storage per site: 100MB
|
||||
|
||||
### User Access Rules
|
||||
|
||||
- **Owner/Admin**: Full access to all account sites
|
||||
- **Editor**: Access to granted sites (via SiteUserAccess)
|
||||
- **Viewer**: Read-only access to granted sites
|
||||
- File operations scoped to user's accessible sites only
|
||||
|
||||
### File Manager UI
|
||||
|
||||
**Status**: ⚠️ **NOT YET IMPLEMENTED**
|
||||
|
||||
**Planned** (from Phase 3 docs):
|
||||
- File Browser UI: `site-builder/src/components/files/FileBrowser.tsx`
|
||||
- File Upload API: `modules/site_builder/views.py`
|
||||
- Storage quota check: `infrastructure/storage/file_storage.py`
|
||||
|
||||
**Expected Routes** (not yet in App.tsx):
|
||||
- `/sites/:id/files` - File manager for site assets
|
||||
- `/sites/:id/files/upload` - Upload files
|
||||
- `/sites/:id/files/:fileId` - View/edit file
|
||||
|
||||
---
|
||||
|
||||
## Docker Volumes
|
||||
|
||||
**From `docker-compose.app.yml`**:
|
||||
```yaml
|
||||
igny8_sites:
|
||||
volumes:
|
||||
- /data/app/igny8/sites:/app
|
||||
- /data/app/sites-data:/sites # Site definitions and assets
|
||||
```
|
||||
|
||||
**Environment Variable**:
|
||||
- `SITES_DATA_PATH=/sites` (inside container)
|
||||
- Maps to `/data/app/sites-data` on host
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. ✅ **Generate All Pages button** - Added to Preview page
|
||||
2. ⏳ **File Manager UI** - Needs to be implemented
|
||||
3. ⏳ **Deployment URL generation** - Currently placeholder, needs real domain mapping
|
||||
4. ⏳ **Caddy routing configuration** - For custom domains
|
||||
5. ⏳ **File upload API endpoints** - For user file management
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
# Site Builder Workflow - Explanation & Fix
|
||||
|
||||
## The Problem (FIXED)
|
||||
|
||||
You were experiencing confusion because there were **TWO separate systems** that weren't properly connected:
|
||||
|
||||
1. **Page Blueprint** (`PageBlueprint.blocks_json`) - Contains placeholder/sample blocks from AI structure generation
|
||||
2. **Writer Content** (`Content` model) - Contains actual generated content from Writer tasks
|
||||
|
||||
**The disconnect**: When deploying a site, it only used `PageBlueprint.blocks_json` (placeholders), NOT the actual `Content` from Writer.
|
||||
|
||||
## Current Workflow (How It Works Now)
|
||||
|
||||
### Step 1: Structure Generation
|
||||
- AI generates site structure → Creates `SiteBlueprint` with `PageBlueprint` pages
|
||||
- Each `PageBlueprint` has `blocks_json` with **placeholder/sample blocks**
|
||||
|
||||
### Step 2: Content Generation
|
||||
- Pages are sent to Writer as `Tasks` (title pattern: `[Site Builder] {Page Title}`)
|
||||
- Writer generates actual content → Creates `Content` records
|
||||
- `Content` has `html_content` and `json_blocks` with **real content**
|
||||
|
||||
### Step 3: Publishing Status
|
||||
- **Page Blueprint Status** (`PageBlueprint.status`): Set to `'published'` in Page Manager
|
||||
- Controls if page appears in navigation and is accessible
|
||||
- **Content Status** (`Content.status`): Set to `'publish'` in Content Manager
|
||||
- Controls if actual written content is used (vs placeholders)
|
||||
|
||||
### Step 4: Deployment (FIXED)
|
||||
- When you deploy, `SitesRendererAdapter._build_site_definition()` now:
|
||||
1. For each page, finds the associated Writer Task (by title pattern)
|
||||
2. Finds the Content record for that task
|
||||
3. **If Content exists and status is 'publish'**, uses `Content.json_blocks` instead of `PageBlueprint.blocks_json`
|
||||
4. If Content has `html_content` but no `json_blocks`, converts it to a text block
|
||||
5. Uses the merged/actual content blocks for deployment
|
||||
|
||||
## URLs
|
||||
|
||||
- **Public Site URL**: `https://sites.igny8.com/{siteSlug}`
|
||||
- Shows deployed site with actual content (if Content is published)
|
||||
- Falls back to blueprint placeholders if Content not published
|
||||
- **Individual Pages**: `https://sites.igny8.com/{siteSlug}/{pageSlug}`
|
||||
- Example: `https://sites.igny8.com/auto-g8/products`
|
||||
|
||||
## How To Use It Now
|
||||
|
||||
1. **Generate Structure**: Create site blueprint with pages (has placeholder blocks)
|
||||
2. **Generate Content**: Pages → Tasks → Content (Writer generates real content)
|
||||
3. **Publish Content**: In Content Manager, set Content status to `'publish'`
|
||||
4. **Publish Pages**: In Page Manager, set Page status to `'published'` (for navigation)
|
||||
5. **Deploy Site**: Deploy the blueprint - it will automatically use published Content
|
||||
|
||||
## What Changed
|
||||
|
||||
✅ **Fixed**: `SitesRendererAdapter._build_site_definition()` now merges published Content into PageBlueprint blocks during deployment
|
||||
|
||||
✅ **Result**: When you deploy, the site shows actual written content, not placeholders
|
||||
|
||||
## Important Notes
|
||||
|
||||
- **Two Statuses**: Page status controls visibility, Content status controls which content is used
|
||||
- **Deployment Required**: After publishing Content, you need to **redeploy** the site for changes to appear
|
||||
- **Content Takes Precedence**: If Content is published, it replaces blueprint placeholders
|
||||
- **Fallback**: If Content not published, blueprint placeholders are used
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
# Template System - Current State & Plans
|
||||
|
||||
## Current Template Architecture
|
||||
|
||||
### 1. Site-Level Layouts (Implemented)
|
||||
**Location**: `sites/src/utils/layoutRenderer.tsx`
|
||||
|
||||
**Available Layouts**:
|
||||
- `default` - Standard header, content, footer
|
||||
- `minimal` - Clean, minimal design
|
||||
- `magazine` - Editorial, content-focused
|
||||
- `ecommerce` - Product-focused
|
||||
- `portfolio` - Showcase layout
|
||||
- `blog` - Content-first
|
||||
- `corporate` - Business layout
|
||||
|
||||
**How it works**:
|
||||
- Set in `SiteBlueprint.structure_json.layout`
|
||||
- Applied to the entire site
|
||||
- All pages use the same layout
|
||||
|
||||
### 2. Block Templates (Implemented)
|
||||
**Location**: `sites/src/utils/templateEngine.tsx`
|
||||
|
||||
**Available Block Types**:
|
||||
- `hero` - Hero section with title, subtitle, CTA
|
||||
- `text` - Text content block
|
||||
- `features` - Feature grid
|
||||
- `testimonials` - Testimonials section
|
||||
- `services` - Services grid
|
||||
- `stats` - Statistics panel
|
||||
- `cta` - Call to action
|
||||
- `image` - Image block
|
||||
- `video` - Video block
|
||||
- `form` - Contact form
|
||||
- `faq` - FAQ accordion
|
||||
- `quote` - Quote block
|
||||
- `grid` - Grid layout
|
||||
- `card` - Card block
|
||||
- `list` - List block
|
||||
- `accordion` - Accordion block
|
||||
|
||||
**How it works**:
|
||||
- Each page has `blocks_json` array
|
||||
- Each block has `type` and `data`
|
||||
- `renderTemplate()` renders blocks based on type
|
||||
|
||||
### 3. Page Types (Defined, but NO templates yet)
|
||||
**Location**: `backend/igny8_core/business/site_building/models.py`
|
||||
|
||||
**Page Type Choices**:
|
||||
- `home` - Homepage
|
||||
- `about` - About page
|
||||
- `services` - Services page
|
||||
- `products` - Products page
|
||||
- `blog` - Blog page
|
||||
- `contact` - Contact page
|
||||
- `custom` - Custom page
|
||||
|
||||
**Current State**:
|
||||
- Page types are stored but **NOT used for rendering**
|
||||
- All pages render the same way regardless of type
|
||||
- No page-type-specific templates exist
|
||||
|
||||
## Missing: Page-Type Templates
|
||||
|
||||
### What's Missing
|
||||
Currently, there's **NO page-type-specific template system**. All pages render identically:
|
||||
- Home page renders the same as Products page
|
||||
- Blog page renders the same as Contact page
|
||||
- No special handling for different page types
|
||||
|
||||
### Where Page-Type Templates Should Be
|
||||
|
||||
**Proposed Location**: `sites/src/utils/pageTypeRenderer.tsx`
|
||||
|
||||
**Proposed Structure**:
|
||||
```typescript
|
||||
// Page-type specific renderers
|
||||
function renderHomePage(page: PageDefinition, blocks: Block[]): React.ReactElement {
|
||||
// Home-specific template: Hero, features, testimonials, CTA
|
||||
}
|
||||
|
||||
function renderProductsPage(page: PageDefinition, blocks: Block[]): React.ReactElement {
|
||||
// Products-specific template: Product grid, filters, categories
|
||||
}
|
||||
|
||||
function renderBlogPage(page: PageDefinition, blocks: Block[]): React.ReactElement {
|
||||
// Blog-specific template: Post list, sidebar, pagination
|
||||
}
|
||||
|
||||
function renderContactPage(page: PageDefinition, blocks: Block[]): React.ReactElement {
|
||||
// Contact-specific template: Form, map, contact info
|
||||
}
|
||||
```
|
||||
|
||||
### How It Should Work
|
||||
|
||||
1. **In `layoutRenderer.tsx`**: After determining site layout, check page type
|
||||
2. **Route to page-type renderer**: If page type has specific template, use it
|
||||
3. **Fallback to default**: If no page-type template, use default block rendering
|
||||
|
||||
**Example Flow**:
|
||||
```
|
||||
Site Definition → Site Layout (default/minimal/etc.)
|
||||
↓
|
||||
Page Type (home/products/blog/etc.)
|
||||
↓
|
||||
Page-Type Template (if exists) OR Default Block Rendering
|
||||
↓
|
||||
Block Templates (hero/text/features/etc.)
|
||||
```
|
||||
|
||||
## Current Rendering Flow
|
||||
|
||||
```
|
||||
SiteRenderer
|
||||
↓
|
||||
loadSiteDefinition()
|
||||
↓
|
||||
renderLayout(siteDefinition) → Uses site.layout (default/minimal/etc.)
|
||||
↓
|
||||
renderDefaultLayout() → Renders all pages the same way
|
||||
↓
|
||||
renderTemplate(block) → Renders individual blocks
|
||||
```
|
||||
|
||||
## Proposed Enhanced Flow
|
||||
|
||||
```
|
||||
SiteRenderer
|
||||
↓
|
||||
loadSiteDefinition()
|
||||
↓
|
||||
renderLayout(siteDefinition) → Uses site.layout
|
||||
↓
|
||||
For each page:
|
||||
↓
|
||||
Check page.type (home/products/blog/etc.)
|
||||
↓
|
||||
If page-type template exists:
|
||||
→ renderPageTypeTemplate(page)
|
||||
Else:
|
||||
→ renderDefaultPageTemplate(page)
|
||||
↓
|
||||
renderTemplate(block) → Renders blocks
|
||||
```
|
||||
|
||||
## Implementation Plan
|
||||
|
||||
### Phase 1: Create Page-Type Renderers
|
||||
- Create `sites/src/utils/pageTypeRenderer.tsx`
|
||||
- Implement templates for each page type:
|
||||
- `home` - Hero + features + testimonials layout
|
||||
- `products` - Product grid + filters
|
||||
- `blog` - Post list + sidebar
|
||||
- `contact` - Form + map + info
|
||||
- `about` - Team + mission + values
|
||||
- `services` - Service cards + descriptions
|
||||
|
||||
### Phase 2: Integrate with Layout Renderer
|
||||
- Modify `renderDefaultLayout()` to check page type
|
||||
- Route to page-type renderer if template exists
|
||||
- Fallback to current block rendering
|
||||
|
||||
### Phase 3: Make Templates Configurable
|
||||
- Allow templates to be customized per site
|
||||
- Store template preferences in `SiteBlueprint.config_json`
|
||||
- Support custom templates
|
||||
|
||||
## Current Files
|
||||
|
||||
- **Site Layouts**: `sites/src/utils/layoutRenderer.tsx`
|
||||
- **Block Templates**: `sites/src/utils/templateEngine.tsx`
|
||||
- **Page Types**: `backend/igny8_core/business/site_building/models.py` (PageBlueprint.PAGE_TYPE_CHOICES)
|
||||
- **Missing**: Page-type templates (not implemented yet)
|
||||
|
||||
## Summary
|
||||
|
||||
✅ **Implemented**: Site-level layouts, block templates
|
||||
❌ **Missing**: Page-type-specific templates
|
||||
📝 **Planned**: Page-type renderers in `sites/src/utils/pageTypeRenderer.tsx`
|
||||
|
||||
Currently, all pages render the same way. Page types are stored but not used for rendering. To add page-type templates, create a new file `pageTypeRenderer.tsx` and integrate it into the layout renderer.
|
||||
|
||||
Reference in New Issue
Block a user