Consolidate docs: move design/docs files to docs folder

- Moved DESIGN-GUIDE.md → docs/30-FRONTEND/DESIGN-GUIDE.md
- Moved frontend/DESIGN_SYSTEM.md → docs/30-FRONTEND/DESIGN-TOKENS.md
- Moved IGNY8-APP.md → docs/00-SYSTEM/IGNY8-APP.md
- Moved fixes-kb.md → docs/90-REFERENCE/FIXES-KB.md
- Moved FINAL_PRELAUNCH.md → docs/plans/FINAL-PRELAUNCH.md
- Updated all references in .rules, README.md, docs/INDEX.md
- Updated ESLint plugin documentation comments
- Root folder now only contains: .rules, CHANGELOG.md, README.md
This commit is contained in:
IGNY8 VPS (Salman)
2026-01-02 23:43:58 +00:00
parent f28f641fd5
commit bc371e5482
13 changed files with 427 additions and 56 deletions

View File

@@ -0,0 +1,663 @@
# Frontend Complete Refactoring & Standardization Plan
## ✅ STATUS: TAILWIND DEFAULT COLORS DISABLED
**As of 2026-01-01**: All Tailwind default color palettes (blue-500, red-600, green-400, etc.) have been **disabled** via `@theme` in `design-system.css`. Only our custom design system colors work now.
### What's Disabled (via `@theme { --color-*-*: initial; }`)
- `red-*`, `orange-*`, `amber-*`, `yellow-*`, `lime-*`
- `green-*`, `emerald-*`, `teal-*`, `cyan-*`, `sky-*`
- `blue-*`, `indigo-*`, `violet-*`, `fuchsia-*`, `pink-*`, `rose-*`
- `slate-*`, `zinc-*`, `neutral-*`, `stone-*`
### What WORKS (our design system)
- `brand-*` (25-950) - derived from `--color-primary`
- `success-*` (25-950) - derived from `--color-success`
- `warning-*` (25-950) - derived from `--color-warning`
- `error-*` (25-950) - derived from `--color-danger`
- `purple-*` (25-950) - derived from `--color-purple`
- `gray-*` (25-950) - derived from `--color-gray-base`
- `blue-light-*` - info/link colors (derived from primary)
---
## 🎯 Objective
**Completely remove Tailwind default styles** and refactor the entire frontend to use **ONLY** the custom design system defined in `/src/styles/design-system.css`.
### Why This Refactor?
- AI agents keep defaulting to Tailwind's standard colors instead of our custom tokens
- Mixed Tailwind + custom styles cause conflicts and inconsistencies
- No single source of truth - styles scattered across files
- Inline components duplicated across multiple pages
### End Goal
- **Single CSS file** (`design-system.css`) as the ONLY source for all design tokens
- **All colors** come from CSS variables defined in `:root`
- **All components** extracted to `/components/ui/` - NO inline component definitions
- **Zero Tailwind default colors** - only our custom palette (brand, success, error, warning, purple, gray)
---
## 📂 Single Source of Truth: `/src/styles/design-system.css`
This file contains:
- **Section 1**: Design Tokens (CSS Variables) - colors, radius, shadows, gradients
- **Section 2**: Dark Mode Overrides
- **Section 3**: Tailwind Configuration (DEFAULT COLORS DISABLED)
- **Section 4**: Base Styles
- **Section 5**: Component Utilities
- **Section 6**: Form Element Styles
- **Section 7**: Table Styles
- **Section 8**: Header Metrics
- **Section 9**: Badge Styles
- **Section 10-13**: Library overrides, utilities, animations
---
## 🎨 Color Architecture: 6 Primary Colors Only
### Why Only 6 Primary Hex Colors?
1. **Dynamic Theming**: Users can customize theme colors in the frontend
2. **Single Change = Entire System Updates**: Change one primary color → all shades/variants update automatically
3. **Consistency**: Whole app looks designed by ONE person, not scattered/mismatched
4. **Maintainability**: No hunting for hardcoded hex values scattered everywhere
### The 6 Primary Color Tokens (ONLY THESE USE HEX)
```css
:root {
/* ===== THE ONLY 6 HEX VALUES IN THE ENTIRE SYSTEM ===== */
--color-primary: #2C7AA1; /* Brand Blue - main CTA, links, primary actions */
--color-success: #2CA18E; /* Success Green - confirmations, positive states */
--color-warning: #D9A12C; /* Warning Amber - alerts, cautions */
--color-danger: #A12C40; /* Danger Red - errors, destructive actions */
--color-purple: #2C40A1; /* Purple - premium features, special emphasis */
--color-gray-base: #667085; /* Gray Base - neutral text, borders, backgrounds */
}
```
### ALL Other Colors MUST Derive From These 6
```css
/* ✅ CORRECT - Derived from primary tokens */
--color-primary-dark: color-mix(in srgb, var(--color-primary) 80%, black);
--color-primary-light: color-mix(in srgb, var(--color-primary) 60%, white);
--color-primary-subtle: color-mix(in srgb, var(--color-primary) 8%, white);
--color-brand-500: var(--color-primary);
--color-brand-600: color-mix(in srgb, var(--color-primary) 85%, black);
--color-brand-400: color-mix(in srgb, var(--color-primary) 75%, white);
/* ... all shades computed from the primary */
/* ❌ WRONG - Hardcoded hex for variants */
--color-primary-dark: #005A8C; /* NO! Must derive from --color-primary */
--color-brand-600: #0369a1; /* NO! Must use color-mix() */
```
### Color Derivation Rules
| Shade | Derivation Formula |
|-------|-------------------|
| `*-25` | `color-mix(in srgb, var(--color-*) 3%, white)` |
| `*-50` | `color-mix(in srgb, var(--color-*) 8%, white)` |
| `*-100` | `color-mix(in srgb, var(--color-*) 15%, white)` |
| `*-200` | `color-mix(in srgb, var(--color-*) 25%, white)` |
| `*-300` | `color-mix(in srgb, var(--color-*) 40%, white)` |
| `*-400` | `color-mix(in srgb, var(--color-*) 60%, white)` |
| `*-500` | `var(--color-*)` (the primary itself) |
| `*-600` | `color-mix(in srgb, var(--color-*) 85%, black)` |
| `*-700` | `color-mix(in srgb, var(--color-*) 70%, black)` |
| `*-800` | `color-mix(in srgb, var(--color-*) 55%, black)` |
| `*-900` | `color-mix(in srgb, var(--color-*) 40%, black)` |
| `*-950` | `color-mix(in srgb, var(--color-*) 25%, black)` |
### Future Theming Support
When user selects a theme, we only change these 6 values:
```javascript
// Theme switcher (future feature)
document.documentElement.style.setProperty('--color-primary', '#NEW_HEX');
document.documentElement.style.setProperty('--color-success', '#NEW_HEX');
// ... and the ENTIRE app updates automatically!
```
---
## Phase 1: Audit Detection Scripts
### 1.1 Run These Detection Commands
```bash
# Create audit results folder
mkdir -p /data/app/igny8/frontend/audit-results
# =====================================================
# STYLE VIOLATIONS - Must be 0 after refactor
# =====================================================
# 1. ALL inline styles (style={{)
grep -rn "style={{" src/pages/ src/components/ --include="*.tsx" > audit-results/01-inline-styles.txt
echo "Inline styles found: $(wc -l < audit-results/01-inline-styles.txt)"
# 2. ALL hardcoded hex colors in className (text-[#xxx], bg-[#xxx])
grep -rn "\[#[0-9a-fA-F]\{3,6\}\]" src/pages/ src/components/ --include="*.tsx" > audit-results/02-hardcoded-hex-class.txt
echo "Hardcoded hex in className: $(wc -l < audit-results/02-hardcoded-hex-class.txt)"
# 3. ALL hardcoded hex colors anywhere (outside CSS)
grep -rn "#[0-9a-fA-F]\{6\}" src/pages/ src/components/ --include="*.tsx" > audit-results/03-hardcoded-hex-all.txt
echo "Hardcoded hex anywhere: $(wc -l < audit-results/03-hardcoded-hex-all.txt)"
# 4. ALL rgb/rgba inline values
grep -rn "rgba\?(" src/pages/ src/components/ --include="*.tsx" > audit-results/04-rgb-values.txt
echo "RGB/RGBA values: $(wc -l < audit-results/04-rgb-values.txt)"
# 5. TAILWIND DEFAULT COLORS (should NOT exist - we disabled them)
grep -rn "bg-blue-\|text-blue-\|border-blue-\|bg-red-\|text-red-\|border-red-\|bg-green-\|text-green-\|border-green-\|bg-yellow-\|text-yellow-\|bg-emerald-\|text-emerald-\|bg-indigo-\|text-indigo-\|bg-pink-\|text-pink-\|bg-rose-\|text-rose-\|bg-amber-\|text-amber-\|bg-cyan-\|text-cyan-\|bg-teal-\|text-teal-\|bg-violet-\|text-violet-\|bg-fuchsia-\|text-fuchsia-\|bg-lime-\|text-lime-\|bg-orange-\|text-orange-\|bg-sky-\|text-sky-\|bg-slate-\|text-slate-\|bg-zinc-\|text-zinc-\|bg-neutral-\|text-neutral-\|bg-stone-\|text-stone-" src/pages/ src/components/ --include="*.tsx" > audit-results/05-tailwind-default-colors.txt
echo "Tailwind default colors: $(wc -l < audit-results/05-tailwind-default-colors.txt)"
# =====================================================
# COMPONENT VIOLATIONS
# =====================================================
# 6. External UI library imports (MUI, Chakra, Ant, etc.)
grep -rn "from '@mui\|from '@chakra\|from 'antd\|from '@headlessui\|from '@radix" src/pages/ src/components/ --include="*.tsx" > audit-results/06-external-ui-imports.txt
echo "External UI imports: $(wc -l < audit-results/06-external-ui-imports.txt)"
# 7. lucide-react imports (should use /icons/)
grep -rn "from 'lucide-react" src/pages/ src/components/ --include="*.tsx" > audit-results/07-lucide-imports.txt
echo "Lucide imports: $(wc -l < audit-results/07-lucide-imports.txt)"
# 8. Inline component definitions (const ComponentName = () => { inside pages)
grep -rn "const [A-Z][a-zA-Z]*\s*=\s*(" src/pages/ --include="*.tsx" > audit-results/08-inline-components.txt
echo "Inline component definitions: $(wc -l < audit-results/08-inline-components.txt)"
# 9. Raw HTML buttons (should use Button component)
grep -rn "<button " src/pages/ --include="*.tsx" > audit-results/09-raw-buttons.txt
echo "Raw HTML buttons: $(wc -l < audit-results/09-raw-buttons.txt)"
# 10. Raw HTML selects (should use standard Select)
grep -rn "<select " src/pages/ --include="*.tsx" > audit-results/10-raw-selects.txt
echo "Raw HTML selects: $(wc -l < audit-results/10-raw-selects.txt)"
# 11. Raw HTML inputs without standard classes
grep -rn "<input " src/pages/ --include="*.tsx" > audit-results/11-raw-inputs.txt
echo "Raw HTML inputs: $(wc -l < audit-results/11-raw-inputs.txt)"
# =====================================================
# SUMMARY
# =====================================================
echo ""
echo "====== AUDIT SUMMARY ======"
echo "Run these counts after refactoring - ALL should be 0:"
echo " 01-inline-styles.txt"
echo " 02-hardcoded-hex-class.txt"
echo " 05-tailwind-default-colors.txt"
echo " 06-external-ui-imports.txt"
echo " 07-lucide-imports.txt"
echo " 08-inline-components.txt (review - extract to /components/)"
```
---
## Phase 2: Color System Standardization
### 2.1 The 6 Primary Color Tokens (ONLY HEX ALLOWED)
| Token | Hex Value | Purpose |
|-------|-----------|---------|
| `--color-primary` | `#2C7AA1` | Brand/Primary actions, links, CTA |
| `--color-success` | `#2CA18E` | Success states, confirmations |
| `--color-warning` | `#D9A12C` | Warning states, alerts, cautions |
| `--color-danger` | `#A12C40` | Error/Danger states, destructive |
| `--color-purple` | `#2C40A1` | Premium/Special features |
| `--color-gray-base` | `#667085` | Neutral base for grays |
### 2.2 Allowed Color Classes (ALL derived from 6 primaries)
| Color Category | Tailwind Classes | CSS Variable Base |
|----------------|------------------|-------------------|
| **Primary/Brand** | `brand-25` to `brand-950` | `--color-primary` |
| **Gray/Neutral** | `gray-25` to `gray-950` | `--color-gray-base` |
| **Success** | `success-25` to `success-950` | `--color-success` |
| **Error** | `error-25` to `error-950` | `--color-danger` |
| **Warning** | `warning-25` to `warning-950` | `--color-warning` |
| **Purple** | `purple-25` to `purple-950` | `--color-purple` |
### 2.3 BANNED - Hardcoded Hex Values
**ZERO hardcoded hex values allowed in:**
- TSX/JSX files
- Component files
- Page files
- Inline styles
**ONLY place hex values exist:** The 6 primary tokens in `design-system.css`
### 2.4 BANNED - Tailwind Default Colors (DISABLED)
These are explicitly disabled and should NEVER appear:
```
❌ blue-*, red-*, green-*, emerald-*, teal-*, cyan-*, sky-*
❌ indigo-*, violet-*, fuchsia-*, pink-*, rose-*
❌ amber-*, yellow-*, lime-*, orange-*
❌ slate-*, zinc-*, neutral-*, stone-*
```
### 2.5 Color Replacement Map
| ❌ Wrong | ✅ Correct |
|----------|-----------|
| `bg-blue-500`, `text-blue-500` | `bg-brand-500`, `text-brand-500` |
| `bg-red-500`, `text-red-500` | `bg-error-500`, `text-error-500` |
| `bg-green-500`, `text-green-500` | `bg-success-500`, `text-success-500` |
| `bg-yellow-500`, `text-yellow-500` | `bg-warning-500`, `text-warning-500` |
| `bg-indigo-500`, `text-indigo-500` | `bg-purple-500`, `text-purple-500` |
| `#0693e3` (hardcoded) | `var(--color-primary)` or `text-brand-500` |
| `#10B981` (hardcoded) | `var(--color-success)` or `text-success-500` |
| `#EF4444` (hardcoded) | `var(--color-danger)` or `text-error-500` |
| `style={{ color: '#xxx' }}` | Use CSS class from design system |
| `bg-[#XXXXXX]` | Use design token class |
---
## Phase 3: Component Extraction & Standardization
### 3.1 Rules for Components
1. **NO inline component definitions** in page files
2. **Any component used in 2+ places** → Extract to `/components/`
3. **All components** use ONLY CSS classes from `design-system.css`
4. **No component-level inline styles**
### 3.2 Standard Component Location
| Component Type | Location | Notes |
|----------------|----------|-------|
| Buttons | `/components/ui/button/` | All button variants |
| Modals/Dialogs | `/components/ui/modal/` | All popup overlays |
| Alerts/Notifications | `/components/ui/alert/` | All status messages |
| Badges/Tags | `/components/ui/badge/` | All labels/chips |
| Dropdowns | `/components/ui/dropdown/` | All select menus |
| Forms | `/components/ui/form/` | Inputs, selects, checkboxes |
| Cards | `/components/ui/card/` | Card containers |
| Tables | `/components/ui/table/` | Data tables |
| Tabs | `/components/ui/tabs/` | Tab interfaces |
| Spinners/Loading | `/components/ui/spinner/` | Loading states |
| Tooltips | `/components/ui/tooltip/` | Hover info |
| Progress | `/components/ui/progress/` | Progress bars |
### 3.3 Inline Components to Extract
Search pattern: `const [A-Z][a-zA-Z]* = (` in `/pages/`
For each found:
1. Check if similar exists in `/components/ui/`
2. If used in multiple pages → Extract to appropriate folder
3. If page-specific → Keep but move to bottom of file or separate file in same folder
---
## Phase 4: Styling Classes Standardization
### 4.1 Standard CSS Classes (from design-system.css)
**Menu Items:**
```css
.menu-item /* Base menu item */
.menu-item-active /* Active state */
.menu-item-inactive /* Inactive state */
.menu-item-icon-size /* Icon sizing */
```
**Form Elements:**
```css
.igny8-select-styled /* Styled select dropdown */
.tableCheckbox /* Table checkbox */
```
**Tables:**
```css
.igny8-table-compact /* Compact table */
.igny8-table-container /* Table wrapper with min-height */
.igny8-table-wrapper /* Scrollable table wrapper */
.igny8-table-smooth /* Smooth transitions */
.igny8-data-row /* Animated data row */
```
**Header Metrics:**
```css
.igny8-header-metrics /* Metrics bar container */
.igny8-header-metric /* Single metric */
.igny8-header-metric-label
.igny8-header-metric-value
.igny8-header-metric-accent
```
### 4.2 Shadow Classes
Use these instead of Tailwind defaults:
```
shadow-theme-xs, shadow-theme-sm, shadow-theme-md, shadow-theme-lg, shadow-theme-xl
```
### 4.3 Typography Classes
```
text-title-2xl, text-title-xl, text-title-lg, text-title-md, text-title-sm
text-theme-xl, text-theme-sm, text-theme-xs
```
---
## Phase 5: Page-by-Page Audit Checklist
### 5.1 Audit Order (by priority)
| # | Module | Folder | Est. Files |
|---|--------|--------|------------|
| 1 | Account Settings | `pages/account/` | ~6 |
| 2 | Site Settings | `pages/Settings/` | ~10 |
| 3 | Sites Management | `pages/Sites/` | ~8 |
| 4 | Writer | `pages/Writer/` | ~5 |
| 5 | Planner | `pages/Planner/` | ~3 |
| 6 | Automation | `pages/Automation/` | ~2 |
| 7 | Optimizer | `pages/Optimizer/` | ~3 |
| 8 | Billing | `pages/Billing/` | ~4 |
| 9 | Dashboard | `pages/Dashboard/` | ~2 |
| 10 | Other Pages | Remaining | ~10+ |
### 5.2 Per-File Audit Checklist
For EACH `.tsx` file:
#### A. IMPORTS ✓
- [ ] NO `@mui/*` imports
- [ ] NO `lucide-react` imports (use `/icons/`)
- [ ] NO `@chakra-ui`, `antd`, `@headlessui`, `@radix-ui`
- [ ] All icons from `/icons/` folder
- [ ] All UI components from `/components/ui/`
#### B. COLORS ✓
- [ ] NO Tailwind default colors (blue-*, red-*, green-*, etc.)
- [ ] NO hardcoded hex (`#XXXXXX`)
- [ ] NO hardcoded rgb/rgba
- [ ] NO inline color styles (`style={{ color: '...' }}`)
- [ ] ONLY uses: brand-*, gray-*, success-*, error-*, warning-*, purple-*
#### C. STYLES ✓
- [ ] NO `style={{` patterns
- [ ] NO `sx={{` patterns
- [ ] All styles via CSS classes from design-system.css
- [ ] Dark mode handled via CSS variables (automatic)
#### D. COMPONENTS ✓
- [ ] NO inline component definitions (extract to /components/)
- [ ] NO raw `<button>` elements (use Button component)
- [ ] NO custom modal implementations (use Modal)
- [ ] NO custom alert/toast (use Alert)
- [ ] NO custom dropdown (use Dropdown)
#### E. FORMS ✓
- [ ] Inputs use standard pattern
- [ ] Selects use `.igny8-select-styled` or standard Select component
- [ ] Checkboxes use standard pattern
- [ ] Form labels consistent
---
## Phase 6: Execution Tracker
### 6.1 Page Audit Progress
| File | Audited | Issues | Fixed | Verified |
|------|---------|--------|-------|----------|
| **Account Module** |||||
| `pages/account/Profile.tsx` | ☐ | - | ☐ | ☐ |
| `pages/account/Team.tsx` | ☐ | - | ☐ | ☐ |
| `pages/account/Security.tsx` | ☐ | - | ☐ | ☐ |
| `pages/account/Preferences.tsx` | ☐ | - | ☐ | ☐ |
| `pages/account/Notifications.tsx` | ☐ | - | ☐ | ☐ |
| `pages/account/ApiKeys.tsx` | ☐ | - | ☐ | ☐ |
| **Settings Module** |||||
| `pages/Settings/General.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Settings/Integrations.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Settings/Publishing.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Settings/ContentDefaults.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Settings/AIModels.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Settings/ImageGeneration.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Settings/SEO.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Settings/Categories.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Settings/Tags.tsx` | ☐ | - | ☐ | ☐ |
| **Sites Module** |||||
| `pages/Sites/SitesList.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Sites/SiteDetail.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Sites/SiteSettings.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Sites/SiteDashboard.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Sites/CreateSite.tsx` | ☐ | - | ☐ | ☐ |
| **Other Modules** |||||
| `pages/Writer/*.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Planner/*.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Automation/*.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Optimizer/*.tsx` | ☐ | - | ☐ | ☐ |
| `pages/Billing/*.tsx` | ☐ | - | ☐ | ☐ |
### 6.2 Component Folder Audit
| Folder | Audited | Issues | Fixed |
|--------|---------|--------|-------|
| `components/ui/button/` | ☐ | - | ☐ |
| `components/ui/modal/` | ☐ | - | ☐ |
| `components/ui/alert/` | ☐ | - | ☐ |
| `components/ui/badge/` | ☐ | - | ☐ |
| `components/ui/dropdown/` | ☐ | - | ☐ |
| `components/ui/card/` | ☐ | - | ☐ |
| `components/ui/table/` | ☐ | - | ☐ |
| `components/ui/tabs/` | ☐ | - | ☐ |
| `components/ui/form/` | ☐ | - | ☐ |
| `components/common/` | ☐ | - | ☐ |
| `components/layout/` | ☐ | - | ☐ |
---
## Phase 7: Verification
### 7.1 Zero-Tolerance Verification
After refactoring, these commands should return **0 results**:
```bash
# 1. No Tailwind default colors
grep -rn "bg-blue-\|text-blue-\|bg-red-\|text-red-\|bg-green-\|text-green-\|bg-yellow-\|text-yellow-\|bg-indigo-\|bg-emerald-\|bg-pink-\|bg-rose-" src/pages/ src/components/ --include="*.tsx" | wc -l
# 2. No inline styles
grep -rn "style={{" src/pages/ src/components/ --include="*.tsx" | wc -l
# 3. No hardcoded hex in className
grep -rn "\[#[0-9a-fA-F]\{3,6\}\]" src/pages/ src/components/ --include="*.tsx" | wc -l
# 4. No external UI libraries
grep -rn "from '@mui\|from '@chakra\|from 'antd" src/pages/ src/components/ --include="*.tsx" | wc -l
# 5. No lucide-react direct imports
grep -rn "from 'lucide-react" src/pages/ --include="*.tsx" | wc -l
```
### 7.2 Visual Verification
- [ ] All pages render correctly (no broken styles)
- [ ] Light mode works properly
- [ ] Dark mode works properly (via `.dark` class)
- [ ] All buttons consistent
- [ ] All forms consistent
- [ ] All tables consistent
- [ ] All modals consistent
- [ ] Brand colors appear correctly
---
## 📋 Quick Reference: Correct Usage Patterns
### Colors (ALL derived from 6 primaries)
```tsx
// ✅ CORRECT - use design token classes (derived from 6 primaries)
className="text-brand-500 bg-brand-50 border-brand-200"
className="text-success-500 bg-success-50"
className="text-error-500 bg-error-50"
className="text-warning-500 bg-warning-50"
className="text-purple-500 bg-purple-50"
className="text-gray-700 bg-gray-100"
// ✅ CORRECT - use CSS variables when needed
className="bg-[var(--color-primary)]"
style={{ '--custom-color': 'var(--color-primary)' }} // Only for CSS custom properties
// ❌ WRONG - Tailwind defaults (DISABLED)
className="text-blue-500 bg-blue-50"
className="text-red-500 bg-green-500"
// ❌ WRONG - Hardcoded hex (NEVER in TSX)
style={{ color: '#0693e3' }}
className="bg-[#0077B6]"
className="text-[#DC2626]"
```
### Components
```tsx
// ✅ CORRECT
import { Button } from '@/components/ui/button/Button';
import { Modal } from '@/components/ui/modal';
import { CheckIcon } from '@/icons';
<Button variant="primary" tone="brand">Save</Button>
// ❌ WRONG
import { Button } from '@mui/material';
import { Check } from 'lucide-react';
<button className="...">Save</button>
```
### Where Hex Values ARE Allowed
```css
/* ✅ ONLY in design-system.css - the 6 primary tokens */
:root {
--color-primary: #2C7AA1;
--color-success: #2CA18E;
--color-warning: #D9A12C;
--color-danger: #A12C40;
--color-purple: #2C40A1;
--color-gray-base: #667085;
}
/* ✅ All other colors derived using color-mix() */
--color-primary-dark: color-mix(in srgb, var(--color-primary) 75%, black);
--color-brand-600: color-mix(in srgb, var(--color-primary) 85%, black);
--color-gray-700: color-mix(in srgb, var(--color-gray-base) 70%, black);
```
---
## 🚨 CRITICAL RULES
1. **6 PRIMARY HEX ONLY**: Only `--color-primary`, `--color-success`, `--color-warning`, `--color-danger`, `--color-purple`, `--color-gray-base` use hex values (plus `#ffffff` for white)
2. **ALL SHADES DERIVED**: Every shade (25-950) is computed from primary using `color-mix()`
3. **NO TAILWIND DEFAULTS**: blue-*, red-*, green-*, etc. are DISABLED
4. **NO INLINE STYLES**: Never use `style={{}}` for colors/spacing
5. **NO HARDCODED HEX IN TSX**: All hex lives in design-system.css only
6. **EXTRACT COMPONENTS**: Any UI used 2+ times → `/components/ui/`
7. **USE STANDARD COMPONENTS**: Button, Modal, Alert, Badge from `/components/ui/`
---
## 🎯 Design Consistency Goals
### The "One Designer" Principle
The entire application must look like it was designed and built by **ONE person**:
| Aspect | Requirement |
|--------|-------------|
| **Colors** | Exact same 6 color palettes everywhere |
| **Spacing** | Consistent padding/margins (use Tailwind spacing scale) |
| **Typography** | Same font sizes, weights, line heights |
| **Borders** | Same border radius, colors, widths |
| **Shadows** | Same shadow tokens everywhere |
| **Buttons** | All use `<Button>` component, same variants |
| **Forms** | All inputs, selects, checkboxes styled identically |
| **Cards** | Same card patterns, padding, borders |
| **Tables** | Same table styles, row heights, headers |
| **Modals** | Same modal structure, animations |
### Visual Consistency Checklist
- [ ] All primary buttons use `bg-brand-500`
- [ ] All success messages use `success-*` palette
- [ ] All error states use `error-*` palette
- [ ] All warning states use `warning-*` palette
- [ ] All premium/special features use `purple-*` palette
- [ ] All neutral backgrounds use `gray-*` palette
- [ ] Border radius consistent (use `--radius-*` tokens)
- [ ] Shadows consistent (use `--shadow-*` tokens)
- [ ] Typography consistent (use `text-theme-*` classes)
---
---
## 🚨 CRITICAL ISSUES - Fix First
### Issue 1: Missing Components After Changes
**Problem**: Many pages have missing components after lucide-react → local icons migration
**Affected Files** (from git diff):
- `ImportExport.tsx` - Uses `Database`, `CheckCircle` etc. from lucide-react
- `WordPressIntegrationDebug.tsx` - Uses `CheckCircle`, `XCircle`, `AlertTriangle`, etc.
- `PostEditor.tsx` - Uses `SaveIcon`, `XIcon`, `FileTextIcon`, etc.
- `NotificationsPage.tsx` - Uses `Bell`, `CheckCircle`, `AlertTriangle`, etc.
- `AccountSettingsPage.tsx` - Uses `Save`, `Loader2`, `Settings`, etc.
- `PlansAndBillingPage.tsx` - Uses `CreditCard`, `Package`, etc.
- `ContentSettingsPage.tsx` - Uses `Save`, `Loader2`, `Image`, etc.
- `UsageAnalyticsPage.tsx` - Uses `TrendingUp`, `Activity`, etc.
- `PurchaseCreditsPage.tsx` - Uses `AlertCircle`, `Check`, etc.
- Multiple components in `/components/sites/`, `/components/billing/`, `/components/auth/`
**Fix**: Replace lucide-react imports with local `/icons/` imports. Add missing aliases to `/icons/index.ts`
### Issue 2: Table Row Height Too Big (Planner & Writer)
**Problem**: Planner and Writer table font sizes too big for some columns, increasing overall row height - tables not compact anymore
**Root Cause**: Font size changes in CSS or component updates affecting table cell sizing
**Fix Locations**:
- `/src/styles/design-system.css` - `.igny8-table-compact td` rules
- Planner and Writer table components - check for increased text sizes
**Required Changes**:
```css
/* Ensure compact table styling */
.igny8-table-compact td {
padding: 6px 10px !important; /* Reduced from 8px 12px */
font-size: 13px !important; /* Reduced from 14px */
line-height: 1.3 !important; /* Tighter line height */
}
.igny8-table-compact th {
padding: 8px 12px !important; /* Reduced from 12px 16px */
font-size: 12px !important; /* Reduced from 14px */
}
```
---
## Notes
- Gray scale (`gray-25` to `gray-950`) is ALLOWED - derived from `--color-gray-base`
- Dark mode is handled automatically via CSS variables in `.dark` class
- When in doubt, check `design-system.css` for available classes
- New utility classes should be added to `design-system.css`, not inline
- **Future theming**: Changing 6 primary hex values updates entire app automatically

View File

@@ -0,0 +1,898 @@
# Publishing & Onboarding Implementation Plan
**Created:** January 1, 2026
**Status:** Planning
**Priority:** High
**Scope:** App-level changes (IGNY8 Backend + Frontend)
---
> ## ⚠️ CRITICAL: DO NOT BREAK EXISTING FUNCTIONALITY
>
> **The current "Publish to Site" button in the dropdown menu is WORKING PERFECTLY.**
>
> This manual publish functionality MUST continue to work throughout ALL implementation phases:
> - Content dropdown → "Publish to Site" button → Successfully publishes content to WordPress
> - This is the core publishing feature that users rely on
> - Each phase of implementation MUST be tested to ensure this functionality remains intact
> - If any change breaks manual publishing, STOP and fix immediately before proceeding
>
> **Testing Required After EVERY Section:**
> 1. Manual "Publish to Site" button still works
> 2. Content successfully appears on WordPress site
> 3. Status updates correctly after publishing
> 4. No console errors or API failures
---
## Table of Contents
1. [Executive Summary](#1-executive-summary)
2. [Bug Fixes (Immediate)](#2-bug-fixes-immediate)
3. [Status System Redesign](#3-status-system-redesign)
4. [Publishing Settings Relocation](#4-publishing-settings-relocation)
5. [Internal Publishing Scheduler](#5-internal-publishing-scheduler)
6. [Simplified Onboarding Flow](#6-simplified-onboarding-flow)
7. [UI Wording Consistency Audit](#7-ui-wording-consistency-audit)
8. [Platform-Agnostic Terminology](#8-platform-agnostic-terminology)
9. [Metrics Integration](#9-metrics-integration---published-to-site)
10. [Automation Settings Verification](#10-automation-settings-verification)
11. [WordPress Bridge Plugin Changes](#11-wordpress-bridge-plugin-changes-reference-only)
12. [Implementation Order](#12-implementation-order)
13. [Summary Checklist](#13-summary-checklist)
---
## 1. Executive Summary
### Goals
1. **Fix critical bugs** - Sites dashboard error, edit URL issues
2. **Clarify status terminology** - Separate "Approved" (internal) from "Published" (on site)
3. **Site-level publishing settings** - Move from account-wide to per-site configuration
4. **Internal scheduling** - Control when content publishes to external sites
5. **Simplified onboarding** - Defaults-first approach for new users
6. **Platform-agnostic language** - Prepare for Shopify and custom integrations
### Current State Problems
| Problem | Location | Impact |
|---------|----------|--------|
| `ComponentCard` not defined | Sites Dashboard | Page crashes |
| Edit URLs have `undefined` | ContentViewTemplate | Broken navigation |
| "Published" used prematurely | Stage 7, Approved page | User confusion |
| Publishing settings not integrated | /account/content-settings/publishing | Settings do nothing |
| No publishing scheduler | Backend | Content stuck waiting |
| WordPress-specific language | Throughout app | Limits future integrations |
| "Published to Site" metric missing | Planner, Writer, Footer, Dashboard, Automation | Incomplete metrics |
| Auto-publish settings not enforced | Run Now & Scheduled automation | Settings ignored |
---
## 2. Bug Fixes (Immediate)
### 2.1 Sites Dashboard - ComponentCard Error
**File:** `frontend/src/pages/Sites/Dashboard.tsx`
**Issue:** Line 259 uses `ComponentCard` and lines 185, 334 use `Card`, but neither are imported. Also `ArrowUpIcon` is used but not imported.
**Fix:**
- Add import for `ComponentCard` from `../../components/common/ComponentCard`
- Add import for `Card` from `../../components/ui/card`
- Add import for `ArrowUpIcon` from `../../icons`
---
### 2.2 Edit URL - Undefined Site ID
**File:** `frontend/src/templates/ContentViewTemplate.tsx`
**Issue:** Lines 1011 and 1031 use `content.site_id` for edit navigation, but `site_id` is not returned in the Content API response.
**Root Cause:** `ContentSerializer` has `site_id = serializers.IntegerField(write_only=True, required=False)` - the `write_only=True` prevents it from being returned in responses.
**Fix - Backend:**
- File: `backend/igny8_core/modules/writer/serializers.py`
- Line ~166: Change `site_id` from `write_only=True` to `read_only=True`
- Also add `site_id` to the serializer's `fields` list if not already included for reads
**Fix - Frontend (Defensive):**
- File: `frontend/src/services/api.ts`
- Line ~2211: Add `site_id?: number;` to the `Content` interface
---
### 2.3 Approved Page - Edit Action Not Working
**File:** `frontend/src/pages/Writer/Approved.tsx`
**Issue:** Line 222 `handleRowAction` for 'edit' action navigates to `/writer/content?id=${row.id}` which is incorrect format.
**Fix:** Change navigation to proper edit URL format:
```
navigate(`/sites/${row.site_id}/posts/${row.id}/edit`)
```
Note: Requires site_id fix from 2.2 to work properly.
---
## 3. Status System Redesign
### 3.1 Current Status Flow
```
draft → review → published (backend)
"Approved" (frontend label)
"Published to Site" (manual action)
```
**Problems:**
- Backend status `published` doesn't mean "on external site"
- Frontend calls it "Approved" but backend calls it "published"
- No distinction between "ready to publish" and "actually published"
### 3.2 Proposed Status Flow
**Option A: Add `approved` Status to Backend (Recommended)**
```
draft → review → approved → published
↓ ↓
Ready for Actually on
publishing external site
```
**Backend Model Changes:**
- File: `backend/igny8_core/business/content/models.py`
- Line ~271: Add `('approved', 'Approved')` to `STATUS_CHOICES`
**Migration Required:**
- Update existing `status='published'` where `external_id IS NULL` to `status='approved'`
**Option B: Use Existing Status + Site Status Field (Alternative)**
Add new field `site_status` to track external publication status separately:
```python
SITE_STATUS_CHOICES = [
('not_published', 'Not Published'),
('scheduled', 'Scheduled'),
('publishing', 'Publishing'),
('published', 'Published'),
('failed', 'Failed'),
]
site_status = models.CharField(max_length=50, choices=SITE_STATUS_CHOICES, default='not_published')
```
### 3.3 Files to Update for Status Changes
| File | Changes |
|------|---------|
| `backend/igny8_core/business/content/models.py` | Add `approved` status |
| `backend/igny8_core/business/automation/services/automation_service.py` | Stage 7: Change to `approved` not `published` |
| `backend/igny8_core/tasks/wordpress_publishing.py` | Query for `approved` status |
| `frontend/src/services/api.ts` | Update Content interface status type |
| `frontend/src/pages/Writer/Approved.tsx` | Filter by `approved` status |
| `frontend/src/pages/Writer/Review.tsx` | No change (still filters `review`) |
| `frontend/src/templates/ContentViewTemplate.tsx` | Update status badge labels |
---
## 4. Publishing Settings Relocation
### 4.1 Current State
- Location: `/account/content-settings/publishing`
- File: `frontend/src/pages/Settings/Publishing.tsx`
- Status: **Not integrated with backend** - settings don't persist or work
### 4.2 Proposed State
Move publishing settings to **Site-level** configuration.
**New Location:** `/sites/{id}/settings` → Publishing tab
### 4.3 Backend Changes
**New Model: PublishingSettings**
File: `backend/igny8_core/business/integration/models.py`
```
PublishingSettings
├── site (FK to Site)
├── account (FK to Account)
├── auto_publish_enabled (Boolean, default=True)
├── auto_approval_enabled (Boolean, default=True)
├── daily_publish_limit (Integer, default=3)
├── weekly_publish_limit (Integer, default=15)
├── monthly_publish_limit (Integer, default=50)
├── publish_days (JSONField, default=['mon','tue','wed','thu','fri'])
├── publish_time_slots (JSONField, default=['09:00','14:00','18:00'])
├── created_at (DateTime)
├── updated_at (DateTime)
```
**New API Endpoints:**
File: `backend/igny8_core/modules/integration/views.py`
| Endpoint | Method | Purpose |
|----------|--------|---------|
| `/v1/integration/sites/{site_id}/publishing-settings/` | GET | Get publishing settings for site |
| `/v1/integration/sites/{site_id}/publishing-settings/` | PUT | Update publishing settings |
**New Serializer:**
File: `backend/igny8_core/modules/integration/serializers.py`
- `PublishingSettingsSerializer` with all fields
### 4.4 Frontend Changes
**Remove/Deprecate:**
- File: `frontend/src/pages/Settings/Publishing.tsx`
- Remove from routing in `App.tsx`
- Remove sidebar link if exists
**Add to Site Settings:**
File: `frontend/src/pages/Sites/Settings.tsx`
- Add "Publishing" tab alongside General, Integrations, Content Types
- Create new component: `frontend/src/components/sites/PublishingSettings.tsx`
**New Component Structure:**
```
PublishingSettings.tsx
├── Auto-Approval Toggle (with explanation)
├── Auto-Publish Toggle (with explanation)
├── Daily Limit Input (1-10, default 3)
├── Weekly Limit Input (1-50, default 15)
├── Monthly Limit Input (1-200, default 50)
├── Publish Days Checkboxes (Mon-Sun)
├── Time Slots Input (add/remove times)
└── Save Button
```
---
## 5. Internal Publishing Scheduler
### 5.1 Overview
Content flows: `approved``scheduled``published`
IGNY8 controls **when** content is sent to external sites based on user's publishing settings.
### 5.2 New Database Fields
**Content Model Updates:**
File: `backend/igny8_core/business/content/models.py`
Add fields:
- `scheduled_publish_at` (DateTimeField, null=True) - When content should publish
- `site_status` (CharField) - External site status (not_published/scheduled/publishing/published/failed)
- `site_status_updated_at` (DateTimeField, null=True) - Last status change
### 5.3 New Celery Task: Publishing Scheduler
**File:** `backend/igny8_core/tasks/publishing_scheduler.py`
**Task:** `schedule_approved_content()`
**Runs:** Every 1 hour via Celery Beat (changed from 5 minutes - less aggressive scheduling)
**Logic:**
1. Find all content with `status='approved'` and `site_status='not_published'`
2. Group by site
3. For each site:
- Load PublishingSettings
- Check daily/weekly/monthly limits (how many already published today/this week/this month)
- If under limits, check if current time matches any publish_time_slot
- If matches, mark content as `site_status='scheduled'` and set `scheduled_publish_at`
- Limit batch size per run
**Task:** `process_scheduled_publications()`
**Runs:** Every 5 minutes via Celery Beat (changed from 1 minute - reduced load)
**Logic:**
1. Find content where `site_status='scheduled'` and `scheduled_publish_at <= now()`
2. For each content:
- Queue `publish_content_to_site.delay(content_id)`
- Set `site_status='publishing'`
### 5.4 Celery Beat Schedule Updates
**File:** `backend/igny8_core/celery.py`
Add to `beat_schedule`:
```python
'schedule-approved-content': {
'task': 'igny8_core.tasks.publishing_scheduler.schedule_approved_content',
'schedule': crontab(minute=0), # Every hour at :00
},
'process-scheduled-publications': {
'task': 'igny8_core.tasks.publishing_scheduler.process_scheduled_publications',
'schedule': crontab(minute='*/5'), # Every 5 minutes
},
```
### 5.5 Publishing Queue UI
**New Page:** `/sites/{id}/publishing-queue`
**File:** `frontend/src/pages/Sites/PublishingQueue.tsx`
**Features:**
- List of content with `site_status='scheduled'`
- Shows scheduled publish date/time
- Drag-drop to reorder queue (updates `scheduled_publish_at`)
- Pause/unpause individual items
- Calendar view showing distribution
---
## 6. Simplified Onboarding Flow
### 6.1 New User Journey (Defaults-First)
```
Step 1: Create Account (existing)
Step 2: Add First Site
- Name, URL
- Hosting type (WordPress selected)
- Skip advanced settings → Use defaults
Step 3: Install WordPress Plugin
- Show API key
- Test connection
Step 4: Add First Keywords
- Bulk input or CSV import
Step 5: Done! Show Dashboard
- "Your content pipeline is running"
- First content ETA based on queue
```
### 6.2 Default Settings (Applied Automatically)
| Setting | Default Value | Location |
|---------|---------------|----------|
| Auto-approval | ON | PublishingSettings |
| Auto-publish | ON | PublishingSettings |
| Daily limit | 3 articles | PublishingSettings |
| Weekly limit | 15 articles | PublishingSettings |
| Monthly limit | 50 articles | PublishingSettings |
| Publish days | Mon-Fri | PublishingSettings |
| Publish times | 9am, 2pm, 6pm | PublishingSettings |
| Automation enabled | ON | AutomationConfig |
| Run frequency | Every 6 hours | AutomationConfig |
### 6.3 Onboarding Wizard Component
**File:** `frontend/src/components/onboarding/OnboardingWizard.tsx`
**Steps Component Structure:**
- `Step1Welcome` - Welcome message, value prop
- `Step2AddSite` - Site name, URL, type
- `Step3ConnectIntegration` - API key, plugin install guide, test
- `Step4AddKeywords` - Keyword input, CSV upload
- `Step5Complete` - Success, show dashboard preview
**Triggers:**
- Show wizard on first login (check account has no sites)
- Can be dismissed and accessed later from Help menu
### 6.4 Backend Defaults Service
**File:** `backend/igny8_core/business/integration/services/defaults_service.py`
**Function:** `create_site_with_defaults(account, site_data)`
**Actions:**
1. Create Site
2. Create PublishingSettings with defaults
3. Create AutomationConfig with defaults
4. Return site + settings
---
## 7. UI Wording Consistency Audit
### 7.1 Status Labels Mapping
| Backend Status | Frontend Display | Badge Color |
|----------------|------------------|-------------|
| `draft` | Draft | Gray |
| `review` | Ready for Review | Amber |
| `approved` | Approved | Green |
| `published` | On Site | Blue |
**Contextual Labels:**
| Page | Status Column Header | Values |
|------|---------------------|--------|
| Review Page | Status | Ready for Review, Draft |
| Approved Page | Site Content Status | Approved (Pending), On Site |
| Content View | Badge | Draft, Review, Approved, Published |
### 7.2 Files Requiring Label Updates
| File | Current | New |
|------|---------|-----|
| `frontend/src/pages/Writer/Approved.tsx` | "Content Approved" title | Keep (correct) |
| `frontend/src/templates/ContentViewTemplate.tsx` | Status badge | Map `published` → "On Site" if `external_id`, else "Approved" |
| `frontend/src/config/pages/approved.config.tsx` | Column headers | "Site Content Status" |
| `frontend/src/components/dashboard/*.tsx` | Various metrics | Use consistent terms |
### 7.3 Action Button Labels
| Current | New | Reason |
|---------|-----|--------|
| "Publish to WordPress" | "Publish to Site" | Platform-agnostic |
| "WordPress Status" | "Site Status" | Platform-agnostic |
| "View on WordPress" | "View on Site" | Platform-agnostic |
---
## 8. Platform-Agnostic Terminology
### 8.1 String Replacements
Search and replace across codebase:
| Search | Replace | Scope |
|--------|---------|-------|
| "Publish to WordPress" | "Publish to Site" | UI labels only |
| "WordPress status" | "Site status" | UI labels only |
| "View on WordPress" | "View on Site" | UI labels only |
| "WordPress Publishing" | "Site Publishing" | UI labels only |
**Do NOT replace in:**
- Backend API endpoint paths
- WordPress-specific service classes
- Plugin-related code
- Technical documentation (keep WordPress references)
### 8.2 Files to Update
| File | Changes |
|------|---------|
| `frontend/src/components/WordPressPublish/WordPressPublish.tsx` | Button labels |
| `frontend/src/components/WordPressPublish/ContentActionsMenu.tsx` | Menu item labels |
| `frontend/src/pages/Writer/Review.tsx` | Action menu labels |
| `frontend/src/pages/Writer/Approved.tsx` | Action menu labels |
| `frontend/src/config/pages/table-actions.config.tsx` | Action labels |
| `frontend/src/pages/Settings/Publishing.tsx` | Destination labels |
### 8.3 Future-Proof Architecture
**SiteIntegration Model** already supports multiple platforms via `platform` field:
- `wordpress`
- `shopify` (future)
- `custom` (future)
**Publishing Service** should route to appropriate adapter:
- `WordPressAdapter`
- `ShopifyAdapter` (future)
- `CustomWebhookAdapter` (future)
---
## 9. Metrics Integration - "Published to Site"
### 9.1 Missing Metrics Audit
The "Published to Site" metric is currently **MISSING** from the following locations:
| Location | Component/File | Current State | Required Change |
|----------|----------------|---------------|-----------------|
| Planner Header | `frontend/src/pages/Planner/*.tsx` | No "Published" count | Add metric card |
| Writer Header | Table actions row (above table) | No "Published" count | Add metric in header |
| Footer Widget | `frontend/src/components/FooterWidget.tsx` | Missing from stats | Add "Published to Site" stat |
| Main Dashboard | `frontend/src/pages/Dashboard/` | Incomplete metrics | Add dedicated metric card |
| Automation Page | `frontend/src/pages/Automation/` | Missing from metrics | Add to stage summary |
| Sites Dashboard | `frontend/src/pages/Sites/Dashboard.tsx` | May be missing | Verify and add if needed |
### 9.2 Metric Query Requirements
**Backend API Updates Needed:**
File: `backend/igny8_core/modules/` (various)
Add endpoints or update existing to return:
- `published_to_site_count` - Content with `external_id IS NOT NULL`
- `published_to_site_today` - Published to site in last 24 hours
- `published_to_site_this_week` - Published to site in last 7 days
- `published_to_site_this_month` - Published to site in last 30 days
### 9.3 Frontend Metric Components
**Files to Update:**
| File | Change Required |
|------|-----------------|
| `frontend/src/pages/Planner/Keywords.tsx` | Add Published metric to header row |
| `frontend/src/pages/Planner/Clusters.tsx` | Add Published metric to header row |
| `frontend/src/pages/Writer/Review.tsx` | Add Published metric to header row |
| `frontend/src/pages/Writer/Approved.tsx` | Add Published metric to header row |
| `frontend/src/components/FooterWidget/FooterWidget.tsx` | Add Published stat |
| `frontend/src/pages/Dashboard/Dashboard.tsx` | Add Published metric card |
| `frontend/src/pages/Automation/AutomationPage.tsx` | Add Published to metrics section |
---
## 10. Automation Settings Verification
### 10.1 Run Now & Scheduled Automation Requirements
Both **Manual "Run Now"** and **Automatic Scheduled** runs MUST respect the same settings:
| Setting | Manual Run | Scheduled Run | Location |
|---------|------------|---------------|----------|
| Auto-Approve | ✅ Must check | ✅ Must check | Site PublishingSettings |
| Auto-Publish to Site | ✅ Must check | ✅ Must check | Site PublishingSettings |
| Daily Publish Limit | ✅ Must enforce | ✅ Must enforce | Site PublishingSettings |
| Weekly Publish Limit | ✅ Must enforce | ✅ Must enforce | Site PublishingSettings |
| Monthly Publish Limit | ✅ Must enforce | ✅ Must enforce | Site PublishingSettings |
| Publish Days | N/A (manual) | ✅ Must check | Site PublishingSettings |
| Publish Time Slots | N/A (manual) | ✅ Must check | Site PublishingSettings |
### 10.2 Automation Service Updates Required
**File:** `backend/igny8_core/business/automation/services/automation_service.py`
**Stage 7 Processing Must:**
1. Check if `auto_approval_enabled` in PublishingSettings
- If YES: Set status to `approved`
- If NO: Keep status as `review`
2. Check if `auto_publish_enabled` in PublishingSettings
- If YES AND auto_approval enabled: Queue for site publishing
- If NO: Leave as `approved` (manual publish required)
3. Respect all publishing limits when auto-publishing
### 10.3 Settings Flow Verification Checklist
```
[Site Settings Page]
[PublishingSettings Model]
[Automation Service reads settings]
[Stage 7 checks auto_approval]
↓ (if enabled)
[Sets status='approved']
[Stage 7 checks auto_publish]
↓ (if enabled)
[Queues for scheduled publishing]
[Publishing Scheduler picks up]
[Respects daily/weekly/monthly limits]
[Publishes to Site]
```
---
## 11. WordPress Bridge Plugin Changes (Reference Only)
**Note:** This section is for reference. A separate plan will be created for plugin-level changes.
### 11.1 Potential Plugin Updates Needed
| Feature | Plugin Change Required |
|---------|----------------------|
| Scheduled posts | Accept `scheduled_at` in publish payload |
| Post update | Handle PUT requests to existing posts |
| Republish | Allow updating posts by content_id |
| Image upload | Download and attach featured images |
### 11.2 New Webhook Events (Future)
| Event | Direction | Purpose |
|-------|-----------|---------|
| `content_scheduled` | App → WP | Notify WP of scheduled content |
| `schedule_changed` | App → WP | Update scheduled time |
| `post_updated` | WP → App | Notify of post edits |
---
## 12. Implementation Order
> **⚠️ IMPORTANT:** After completing EACH section, verify that manual "Publish to Site" button still works before proceeding to the next section.
---
### Section 1: Critical Bug Fixes (Day 1)
| Task # | Task | Files | Priority |
|--------|------|-------|----------|
| 1.1 | Fix ComponentCard import | Sites/Dashboard.tsx | P0 |
| 1.2 | Fix Card import | Sites/Dashboard.tsx | P0 |
| 1.3 | Fix ArrowUpIcon import | Sites/Dashboard.tsx | P0 |
| 1.4 | Fix site_id in API response | writer/serializers.py | P0 |
| 1.5 | Add site_id to Content interface | api.ts | P0 |
| 1.6 | Fix edit URL navigation | Approved.tsx | P0 |
| 1.7 | Fix edit button URLs | ContentViewTemplate.tsx | P0 |
**✅ Section 1 Verification:**
- [ ] Sites Dashboard loads without errors
- [ ] Edit buttons navigate correctly
- [ ] **Manual "Publish to Site" button still works**
---
### Section 2: Status System (Days 2-3)
| Task # | Task | Files | Priority |
|--------|------|-------|----------|
| 2.1 | Add `approved` status to Content model | content/models.py | P1 |
| 2.2 | Create database migration | migrations/ | P1 |
| 2.3 | Run migration on database | Django manage.py | P1 |
| 2.4 | Update Stage 7 to set `approved` | automation_service.py | P1 |
| 2.5 | Update frontend Content interface | api.ts | P1 |
| 2.6 | Update Approved page filter | Approved.tsx | P1 |
| 2.7 | Update status badges | ContentViewTemplate.tsx | P1 |
| 2.8 | Update status config | config files | P1 |
**✅ Section 2 Verification:**
- [ ] New content from automation gets `approved` status
- [ ] Approved page shows correct content
- [ ] Status badges display correctly
- [ ] **Manual "Publish to Site" button still works**
---
### Section 3: Publishing Settings Model (Days 4-5)
| Task # | Task | Files | Priority |
|--------|------|-------|----------|
| 3.1 | Create PublishingSettings model | integration/models.py | P1 |
| 3.2 | Create database migration | migrations/ | P1 |
| 3.3 | Run migration on database | Django manage.py | P1 |
| 3.4 | Create PublishingSettingsSerializer | integration/serializers.py | P1 |
| 3.5 | Create API endpoints | integration/views.py | P1 |
| 3.6 | Add URL routes | integration/urls.py | P1 |
**✅ Section 3 Verification:**
- [ ] API endpoints return 200 for GET/PUT
- [ ] Settings save and retrieve correctly
- [ ] **Manual "Publish to Site" button still works**
---
### Section 4: Publishing Settings Frontend (Day 6)
| Task # | Task | Files | Priority |
|--------|------|-------|----------|
| 4.1 | Create PublishingSettings component | components/sites/PublishingSettings.tsx | P1 |
| 4.2 | Add Publishing tab to Site Settings | Sites/Settings.tsx | P1 |
| 4.3 | Create API service functions | api.ts | P1 |
| 4.4 | Remove/deprecate old Publishing page | Settings/Publishing.tsx | P2 |
| 4.5 | Update routing if needed | App.tsx | P2 |
**✅ Section 4 Verification:**
- [ ] Publishing tab visible in Site Settings
- [ ] Settings UI loads and saves correctly
- [ ] **Manual "Publish to Site" button still works**
---
### Section 5: Automation Integration (Days 7-8)
| Task # | Task | Files | Priority |
|--------|------|-------|----------|
| 5.1 | Update Stage 7 to read PublishingSettings | automation_service.py | P1 |
| 5.2 | Implement auto_approval check | automation_service.py | P1 |
| 5.3 | Implement auto_publish check | automation_service.py | P1 |
| 5.4 | Test with "Run Now" button | Manual testing | P1 |
| 5.5 | Test with scheduled automation | Manual testing | P1 |
**✅ Section 5 Verification:**
- [ ] Run Now respects auto_approval setting
- [ ] Run Now respects auto_publish setting
- [ ] Scheduled run respects all settings
- [ ] **Manual "Publish to Site" button still works**
---
### Section 6: Publishing Scheduler Tasks (Days 9-10)
| Task # | Task | Files | Priority |
|--------|------|-------|----------|
| 6.1 | Add scheduled_publish_at field to Content | content/models.py | P1 |
| 6.2 | Add site_status field to Content | content/models.py | P1 |
| 6.3 | Create database migration | migrations/ | P1 |
| 6.4 | Run migration on database | Django manage.py | P1 |
| 6.5 | Create schedule_approved_content task | tasks/publishing_scheduler.py | P1 |
| 6.6 | Create process_scheduled_publications task | tasks/publishing_scheduler.py | P1 |
| 6.7 | Add tasks to Celery Beat (1 hour, 5 min) | celery.py | P1 |
| 6.8 | Restart Celery Beat | Docker/service restart | P1 |
**✅ Section 6 Verification:**
- [ ] Celery Beat schedules appear in Flower
- [ ] Tasks run at correct intervals
- [ ] Content gets scheduled correctly
- [ ] **Manual "Publish to Site" button still works**
---
### Section 7: Metrics Integration (Days 11-12)
| Task # | Task | Files | Priority |
|--------|------|-------|----------|
| 7.1 | Add published_to_site counts to API | Backend views | P1 |
| 7.2 | Add metric to Planner header | Planner pages | P1 |
| 7.3 | Add metric to Writer header | Writer pages | P1 |
| 7.4 | Add metric to Footer Widget | FooterWidget.tsx | P1 |
| 7.5 | Add metric to Dashboard | Dashboard.tsx | P1 |
| 7.6 | Add metric to Automation page | AutomationPage.tsx | P1 |
**✅ Section 7 Verification:**
- [ ] "Published to Site" metric shows in all locations
- [ ] Counts are accurate
- [ ] **Manual "Publish to Site" button still works**
---
### Section 8: UI Consistency (Days 13-14)
| Task # | Task | Files | Priority |
|--------|------|-------|----------|
| 8.1 | Replace "WordPress" with "Site" in labels | Multiple frontend files | P2 |
| 8.2 | Standardize status labels | Config files, templates | P2 |
| 8.3 | Update tooltips and help text | Various | P2 |
| 8.4 | Update documentation | WORDPRESS-INTEGRATION-FLOW.md | P3 |
**✅ Section 8 Verification:**
- [ ] UI labels are consistent
- [ ] No "WordPress" in user-facing labels (except settings)
- [ ] **Manual "Publish to Site" button still works**
---
### Section 9: Publishing Queue UI (Optional - Day 15)
| Task # | Task | Files | Priority |
|--------|------|-------|----------|
| 9.1 | Create PublishingQueue page | Sites/PublishingQueue.tsx | P2 |
| 9.2 | Add navigation link | Site dashboard/menu | P2 |
| 9.3 | Implement drag-drop reordering | PublishingQueue.tsx | P2 |
| 9.4 | Add calendar view | PublishingQueue.tsx | P3 |
**✅ Section 9 Verification:**
- [ ] Queue page loads correctly
- [ ] Scheduled content displays
- [ ] **Manual "Publish to Site" button still works**
---
### Section 10: Onboarding (Days 16-18)
| Task # | Task | Files | Priority |
|--------|------|-------|----------|
| 10.1 | Create defaults service | defaults_service.py | P2 |
| 10.2 | Create OnboardingWizard component | OnboardingWizard.tsx | P2 |
| 10.3 | Create wizard step components | onboarding/ folder | P2 |
| 10.4 | Integrate wizard trigger | App.tsx or auth flow | P2 |
| 10.5 | Test end-to-end onboarding | Manual testing | P2 |
**✅ Section 10 Verification:**
- [ ] Wizard triggers for new accounts
- [ ] All steps complete successfully
- [ ] Defaults are applied correctly
- [ ] **Manual "Publish to Site" button still works**
---
## 13. Summary Checklist
### ⚠️ Critical: Preserve Working Functionality
- [ ] **Manual "Publish to Site" button works after EVERY section**
### Section 1: Bug Fixes
- [ ] 1.1 Fix ComponentCard import in Sites Dashboard
- [ ] 1.2 Fix Card import in Sites Dashboard
- [ ] 1.3 Fix ArrowUpIcon import in Sites Dashboard
- [ ] 1.4 Make site_id readable in ContentSerializer
- [ ] 1.5 Add site_id to frontend Content interface
- [ ] 1.6 Fix edit action navigation in Approved page
- [ ] 1.7 Fix edit button URLs in ContentViewTemplate
- [ ] **✅ VERIFY: Publish to Site still works**
### Section 2: Status System
- [ ] 2.1 Add `approved` status to Content model
- [ ] 2.2 Create database migration
- [ ] 2.3 Run migration
- [ ] 2.4 Update Stage 7 to set `approved` not `published`
- [ ] 2.5 Update frontend Content interface
- [ ] 2.6 Update Approved page filter
- [ ] 2.7 Update status badges
- [ ] 2.8 Update status config
- [ ] **✅ VERIFY: Publish to Site still works**
### Section 3: Publishing Settings Backend
- [ ] 3.1 Create PublishingSettings model
- [ ] 3.2 Create database migration
- [ ] 3.3 Run migration
- [ ] 3.4 Create serializer
- [ ] 3.5 Create API endpoints
- [ ] 3.6 Add URL routes
- [ ] **✅ VERIFY: Publish to Site still works**
### Section 4: Publishing Settings Frontend
- [ ] 4.1 Create PublishingSettings component
- [ ] 4.2 Add Publishing tab to Site Settings
- [ ] 4.3 Create API service functions
- [ ] 4.4 Remove/deprecate old Publishing page
- [ ] 4.5 Update routing
- [ ] **✅ VERIFY: Publish to Site still works**
### Section 5: Automation Integration
- [ ] 5.1 Update Stage 7 to read PublishingSettings
- [ ] 5.2 Implement auto_approval check
- [ ] 5.3 Implement auto_publish check
- [ ] 5.4 Test "Run Now" button
- [ ] 5.5 Test scheduled automation
- [ ] **✅ VERIFY: Publish to Site still works**
### Section 6: Publishing Scheduler
- [ ] 6.1 Add scheduled_publish_at field to Content
- [ ] 6.2 Add site_status field to Content
- [ ] 6.3 Create database migration
- [ ] 6.4 Run migration
- [ ] 6.5 Create schedule_approved_content task (1 hour)
- [ ] 6.6 Create process_scheduled_publications task (5 min)
- [ ] 6.7 Add tasks to Celery Beat
- [ ] 6.8 Restart Celery Beat
- [ ] **✅ VERIFY: Publish to Site still works**
### Section 7: Metrics Integration
- [ ] 7.1 Add published_to_site counts to API
- [ ] 7.2 Add metric to Planner header
- [ ] 7.3 Add metric to Writer header
- [ ] 7.4 Add metric to Footer Widget
- [ ] 7.5 Add metric to Dashboard
- [ ] 7.6 Add metric to Automation page
- [ ] **✅ VERIFY: Publish to Site still works**
### Section 8: UI Consistency
- [ ] 8.1 Replace "WordPress" with "Site" in labels
- [ ] 8.2 Standardize status labels
- [ ] 8.3 Update tooltips and help text
- [ ] 8.4 Update documentation
- [ ] **✅ VERIFY: Publish to Site still works**
### Section 9: Publishing Queue (Optional)
- [ ] 9.1 Create PublishingQueue page
- [ ] 9.2 Add navigation link
- [ ] 9.3 Implement drag-drop reordering
- [ ] 9.4 Add calendar view
- [ ] **✅ VERIFY: Publish to Site still works**
### Section 10: Onboarding
- [ ] 10.1 Create defaults service
- [ ] 10.2 Create OnboardingWizard component
- [ ] 10.3 Create wizard step components
- [ ] 10.4 Integrate wizard trigger
- [ ] 10.5 Test end-to-end onboarding
- [ ] **✅ VERIFY: Publish to Site still works**
---
**Document Version:** 2.0
**Last Updated:** January 1, 2026
**Author:** Development Team

View File

@@ -0,0 +1,46 @@
# IGNY8 Cleanup TODOs
**Last Updated:** December 27, 2025
---
## 🗑️ Code Marked for Removal
### SiteBuilder (Deprecated)
SiteBuilder module is completely removed from the app. Any code found related to it should be cleaned up.
| File/Location | Type | Status | Notes |
|---------------|------|--------|-------|
| *Add entries here when found* | | | |
**How to identify SiteBuilder code:**
- References to `sitebuilder`, `site_builder`, `SiteBuilder`
- Components/pages with "SiteBuilder" in name
- API endpoints containing `sitebuilder`
- Models or services for building sites using IGNY8
---
## ⏸️ Inactive Modules (Phase 2)
These modules exist but are NOT active. Do not modify unless specifically requested.
| Module | Status | Planned Activation |
|--------|--------|-------------------|
| Linker | ⏸️ Disabled | Phase 2 |
| Optimizer | ⏸️ Disabled | Phase 2 |
---
## 📝 Found Items Log
*When you find deprecated code during development, add it here:*
```markdown
### [Date] - [Found By]
- **File:** path/to/file
- **Type:** SiteBuilder / Other
- **Action Needed:** Remove / Refactor
- **Notes:** Description
```