import React, { useMemo, useState } from "react"; import { motion } from "framer-motion"; import { Upload, Wand2, Layers, Image as ImageIcon, CheckCircle2, AlertTriangle, RefreshCw, FileJson, PanelRightOpen, Play, Download, Eye, Settings, PenTool, Workflow, ShieldCheck, Box, Search, Sparkles, ArrowRight, } from "lucide-react"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; const agents = [ { id: "intake", name: "Asset Intake Agent", icon: Upload, status: "Ready", purpose: "Ingests the master design, source assets, brand rules, reference JSON, copy, logos, product renders, pack shots, fonts, and mandatories.", inputs: ["Master design visual", "Reference JSON", "Asset folder", "Brand rules", "Campaign copy"], outputs: ["Normalised asset manifest", "Detected design system", "Missing asset warnings"], checkpoint: "Human confirms asset completeness before adaptation begins.", }, { id: "detect", name: "Touchpoint Detection Agent", icon: Search, status: "Next", purpose: "Detects pink-marked adaptation areas in JPEGs/PSDs, extracts masks, size, angle, perspective, safe area, and likely substrate type.", inputs: ["Touchpoint JPEG/PSD", "Pink mask rules", "Known format library"], outputs: ["Placement mask", "Bounding geometry", "Perspective map", "Touchpoint metadata"], checkpoint: "Human can adjust or approve detected pink areas.", }, { id: "flat", name: "Flat Adaptation Agent", icon: Wand2, status: "Queued", purpose: "Creates flat artwork for each touchpoint using the master design logic, campaign hierarchy, aspect ratio, copy rules, and image-crop rules.", inputs: ["Master design rules", "Touchpoint geometry", "Asset manifest", "Copy hierarchy"], outputs: ["Flat PNG/JPEG", "Editable layer JSON", "Generation rationale"], checkpoint: "Human reviews flat visuals before in-situ application.", }, { id: "mockup", name: "Mockup Application Agent", icon: ImageIcon, status: "Queued", purpose: "Applies approved flats into the pink-marked areas, preserving perspective, lighting, shadows, scale, crop, and in-store realism.", inputs: ["Approved flat", "Placement mask", "Original touchpoint visual"], outputs: ["In-situ mockup", "Overlay metadata", "Before/after comparison"], checkpoint: "Human approves final mockup or sends back for regeneration.", }, { id: "qa", name: "Brand QA Agent", icon: ShieldCheck, status: "Queued", purpose: "Checks outputs against brand rules, legibility, safe area, claims, logo usage, campaign hierarchy, and required legal or retailer constraints.", inputs: ["Mockups", "Flat visuals", "Brand/rule JSON", "Retailer constraints"], outputs: ["QA score", "Issue list", "Suggested fixes"], checkpoint: "Human resolves warnings or approves with exceptions.", }, { id: "handoff", name: "Edit Handoff Agent", icon: Layers, status: "Queued", purpose: "Packages final outputs as previews, structured JSON, source references, and eventually layered PSD/Photoshop-compatible files.", inputs: ["Approved mockups", "Layer JSON", "Source assets", "QA report"], outputs: ["Export package", "Layered JSON", "PSD-ready structure", "Review report"], checkpoint: "Human downloads files for production tweaks.", }, ]; const touchpoints = [ { name: "Shelf Barker", type: "JPEG", mask: "Detected", ratio: "4:1", risk: "Low", state: "Ready for flat" }, { name: "Free Standing Display Unit", type: "PSD", mask: "Pending", ratio: "Mixed", risk: "Medium", state: "Needs layer scan" }, { name: "Gondola End", type: "JPEG", mask: "Detected", ratio: "16:9", risk: "Low", state: "Ready for flat" }, { name: "Aisle Fin", type: "JPEG", mask: "Review", ratio: "1:3", risk: "High", state: "Mask needs approval" }, ]; const mvpPlan = [ { title: "MVP 1: JPEG Prototype", scope: "Master image + JSON rules + JPEG touchpoints with pink zones.", output: "Flat visuals, in-situ JPEG mockups, metadata JSON, review queue.", value: "Proves the core creative adaptation and placement logic quickly.", }, { title: "MVP 2: Production Assist", scope: "Adds PSD ingestion, brand QA, versioning, regenerate controls, and approval notes.", output: "Approved mockups, QA reports, editable layer JSON, export packages.", value: "Moves from demo to usable studio workflow.", }, { title: "MVP 3: Human Handoff", scope: "Adds Photoshop-compatible layered output and reusable client/project libraries.", output: "Layered PSD/PSB or PSD-ready files, asset-linked JSON, final production pack.", value: "Lets designers finish, tweak, and own the final craft layer.", }, ]; const sampleSchema = `{ "project": { "name": "Retail Touchpoint Adaptation Pilot", "client": "Client name", "campaign": "Campaign name", "status": "prototype" }, "master_design": { "reference_image": "master_design.jpg", "source_json": "master_design_rules.json", "design_intent": "Describe the creative idea and hierarchy", "brand_rules": { "logo_min_size_px": 120, "safe_area_percent": 8, "primary_message": "Hero campaign line", "secondary_message": "Supporting line", "mandatory_assets": ["logo", "product", "cta"] } }, "touchpoints": [ { "id": "tp_001", "name": "Shelf Barker", "source_file": "shelf_barker_marked.jpg", "mask_colour": "#ff00ff", "detected_area": { "bbox_px": [120, 340, 980, 520], "aspect_ratio": "4:1", "perspective_required": false, "safe_area_px": 24 }, "adaptation_rules": { "priority": ["product", "primary_message", "logo", "cta"], "crop_strategy": "protect product and message", "allow_copy_reflow": true } } ], "outputs": { "flat_visuals": true, "insitu_mockups": true, "qa_report": true, "layered_json": true, "photoshop_handoff": "future" } }`; const workflowSteps = [ "Upload master design + JSON", "Upload touchpoint visuals", "Detect pink masks", "Generate flats", "Apply to in-situ visuals", "Run brand QA", "Export review pack", ]; function StatusPill({ status }) { const tone = status === "Ready" || status === "Detected" || status === "Low" ? "bg-emerald-100 text-emerald-800" : status === "Next" || status === "Review" || status === "Medium" ? "bg-amber-100 text-amber-800" : status === "Queued" || status === "Pending" ? "bg-slate-100 text-slate-700" : "bg-rose-100 text-rose-800"; return {status}; } function UploadDropzone({ title, subtitle, icon: Icon }) { return (
{title}
{subtitle}
A working dashboard concept for agent-led adaptation: ingest a master creative, detect pink marked areas, generate flat visuals, apply them to in-situ store visuals, QA, and export a human-editable handoff pack.
Upload the source material required by the agents.
Current MVP run status.
{step}
Files waiting for detection, flat generation, mockup application, and approval.
| Touchpoint | Type | Mask | Ratio | Risk | State |
|---|---|---|---|---|---|
| {tp.name} | {tp.type} | {tp.ratio} | {tp.state} |
Agent {index + 1}
{agent.purpose}
Inputs
Outputs
This JSON structure is the backbone of the workflow. It lets every agent know what assets exist, what the creative hierarchy is, where the touchpoint adaptation area sits, and what outputs are required.
{sampleSchema}
Scope: {mvp.scope}
Output: {mvp.output}
Value: {mvp.value}
Build MVP 1 as a local or web-based prototype that accepts one master visual, one rules JSON, and three to five JPEG touchpoints. The first measurable success criterion is reliable pink-mask detection plus credible flat artwork placement into the in-situ visual.