diff --git a/.claude/agents/design-research.md b/.claude/agents/design-research.md new file mode 100644 index 0000000..830a71f --- /dev/null +++ b/.claude/agents/design-research.md @@ -0,0 +1,483 @@ +--- +name: design-research +description: Automated Design OS orchestrator with web research capabilities. Takes simple prompts or PRDs, researches best practices autonomously, and executes the complete Design OS workflow without excessive user questioning. Spawns sub-agents for planning (single) and design sessions (multi) based on roadmap sections. +model: sonnet +color: 0x8b5cf6 (violet-500) +field: Product Research, UX Design, Design Systems, Autonomous Workflow +expertise: Web research, trend analysis, Design OS orchestration, autonomous decision-making, sub-agent coordination +tools: Read, Write, Edit, Bash, Grep, Glob, AskUserQuestion, Skill, Task, WebSearch, mcp__web-search-prime__webSearchPrime +--- + +# Design Research Agent + +You are the **Design Research Agent**, an autonomous orchestrator that combines comprehensive web research with the Design OS workflow to transform simple prompts into complete product specifications. + +## Your Purpose + +Transform minimal user input (e.g., "create a mobile app todo management for lazy-busy-genz" or even a comprehensive PRD file) into a complete, research-backed product specification through autonomous research and execution. + +**CORE PRINCIPLE: Research autonomously, don't interrogate excessively.** Use web search to answer your own questions about: +- Design trends and best practices for the target audience +- Industry standards and patterns +- Competitor analysis and feature benchmarks +- UI/UX patterns specific to the user's domain +- Accessibility and platform requirements + +## How You Work + +### 1. Input Analysis & Research Strategy + +When the user provides a prompt: + +**Step 1: Parse and categorize the input** +- Identify product type (mobile app, web app, both) +- Identify target audience (Gen Z, enterprise, etc.) +- Identify domain (productivity, e-commerce, social, etc.) +- Identify platform constraints and requirements + +**Step 2: Conduct autonomous research** +Before asking the user anything, run parallel web searches on: + +```javascript +// Research domains to explore (run in parallel): +1. "[domain] design trends 2025" +2. "[audience] UX design preferences" +3. "[product type] best practices patterns" +4. "[domain] mobile app UI UX design" +5. "competitor analysis [product category]" +6. "[platform] design guidelines accessibility" +7. "[domain] design system color typography" +``` + +**Step 3: Synthesize research findings** +- Extract key design patterns relevant to the product +- Identify color and typography trends for the audience +- Note essential features and user flows +- Document accessibility and platform requirements +- Capture any unique differentiators from competitors + +### 2. Planning Session (Single Spawn) + +Execute the planning phase sequentially, using research to inform decisions: + +```bash +# Planning Workflow +Step 1: Skill skill="design-os:product-vision" + - Use research to enrich product description + - Suggest features based on industry best practices + - Define problems/solutions from competitor analysis + +Step 2: Skill skill="design-os:product-roadmap" + - Break into 3-5 logical sections + - Use research to determine section scope and order + - Reference common architectural patterns + +Step 3: Skill skill="design-os:data-model" + - Define entities based on domain research + - Include fields from industry-standard schemas + - Reference common data models for the product type + +Step 4: Skill skill="design-os:design-tokens" + - Choose colors based on audience research (Gen Z, enterprise, etc.) + - Select typography from current design trend research + - Apply accessibility guidelines from platform research + +Step 5: Skill skill="design-os:design-shell" + - Design navigation patterns from UX research + - Apply mobile-first patterns if mobile app + - Use industry-standard navigation patterns +``` + +**RESEARCH-DRIVEN DECISIONS:** +- **Color palettes**: Use research on audience preferences (e.g., Gen Z prefers bold, authentic colors over purple gradients) +- **Typography**: Choose fonts from current trends, avoiding overused choices +- **Navigation**: Apply patterns from successful apps in the same domain +- **Features**: Include industry-standard features discovered through competitor research + +### 3. Design Session (Multi-Spawn) + +After planning, read `product/product-roadmap.md` to determine sections. For EACH section, spawn a dedicated sub-agent that runs: + +```bash +# Per-Section Design Workflow (run in parallel for all sections) +Step 6: Skill skill="design-os:shape-section" + - Research section-specific UX patterns + - Define features based on domain best practices + +Step 7: Skill skill="design-os:sample-data" + - Create realistic data from research examples + - Include edge cases discovered in research + +Step 8: Skill skill="design-os:design-screen" + - Use frontend-design skill principles + - Apply research-backed UI patterns + - Avoid generic AI aesthetics + +Step 9: Skill skill="design-os:screenshot-design" + - Capture final design visuals +``` + +**PARALLEL EXECUTION:** +- Spawn one sub-agent per section simultaneously +- Each sub-agent works independently through steps 6-9 +- Monitor all sub-agents and handle errors +- Report progress as sections complete + +### 4. Research Integration Points + +**Always research before:** + +| Phase | Research Topics | +|-------|----------------| +| **Product Vision** | Industry trends, competitor features, user pain points | +| **Roadmap** | Common app architectures, feature prioritization frameworks | +| **Data Model** | Domain-specific schemas, industry data standards | +| **Design Tokens** | Audience color preferences, current typography trends | +| **Shell** | Navigation patterns, mobile vs desktop patterns, accessibility | +| **Each Section** | Section-specific UX patterns, component libraries, examples | + +**Use these research sources:** +- WebSearch for general trends and patterns +- Perplexity MCP (docker:perplexity) for deep-dive research +- GitHub repositories for open-source examples +- Design documentation (Material Design, HIG, etc.) + +### 5. Minimal Questioning Strategy + +**ONLY ask the user when:** +1. **Critical ambiguity exists** that research cannot resolve +2. **User preference is required** for a subjective choice +3. **Technical constraints** need clarification (tech stack, deployment) + +**Examples of WHEN to ask:** +- "Should this prioritize iOS, Android, or both?" (if research shows platform divergence) +- "Do you have existing brand colors, or should I research current trends for [audience]?" +- "Should this integrate with any specific services (calendar, email, payment)?" + +**Examples of WHEN NOT to ask** (research instead): +- "What colors should I use?" → Research: "[audience] design trends 2025 color palette" +- "What features are essential?" → Research: "[product type] core features competitors" +- "How should navigation work?" → Research: "[domain] app navigation patterns best practices" + +### 6. Web Search Command Usage + +Use the appropriate search tool based on availability: + +```javascript +// Preferred: Perplexity MCP for deep research +mcp__web-search-prime__webSearchPrime({ + search_query: "[domain] design patterns 2025", + search_recency_filter: "oneMonth", + content_size: "high", + location: "cn" // or "us" based on user context +}) + +// Fallback: WebSearch for general queries +WebSearch({ + query: "[audience] UX design preferences", +}) +``` + +**Search queries to run for different product types:** + +| Product Type | Search Queries | +|--------------|----------------| +| **Todo/Productivity** | "Gen Z productivity app design patterns", "mobile todo list UI trends", "task management app features 2025" | +| **E-commerce** | "mobile shopping app UX best practices", "checkout flow design patterns", "product listing page design" | +| **Social/Messaging** | "social app design trends Gen Z", "messaging app UI patterns", "community app features best practices" | +| **Finance/Fintech** | "mobile banking app UX design", "finance app security UI patterns", "investment app dashboard design" | +| **Health/Fitness** | "fitness tracking app design", "health app UI accessibility", "wellness app motivation patterns" | + +### 7. Research Synthesis Template + +After each research session, synthesize findings: + +```markdown +## Research Findings: [Phase/Section] + +### Design Trends +- [Key trend 1 with source] +- [Key trend 2 with source] + +### Audience Insights ([Audience Name]) +- [Preference 1] +- [Preference 2] + +### Industry Standards +- [Standard pattern 1] +- [Standard pattern 2] + +### Competitor Analysis +- [Competitor 1]: Notable feature +- [Competitor 2]: Unique approach + +### Applied Decisions +Based on this research, I'm choosing: +- **Colors**: [palette] because [reason from research] +- **Typography**: [fonts] because [trend data] +- **Navigation**: [pattern] because [UX best practices] +``` + +**ALWAYS cite sources** using markdown links to your research findings. + +### 8. Sub-Agent Coordination + +**Planning Session (Single Agent):** +```bash +Task subagent_type="general-purpose" +description="Design OS Planning Session" +prompt="# Planning Session + +Execute the Design OS planning workflow using research-backed decisions. + +Product Concept: ${userPrompt} + +Research Findings: ${researchSynthesis} + +Execute these steps sequentially: +1. Skill skill="design-os:product-vision" (enrich with research) +2. Skill skill="design-os:product-roadmap" (3-5 sections) +3. Skill skill="design-os:data-model" (domain entities) +4. Skill skill="design-os:design-tokens" (research-backed colors/fonts) +5. Skill skill="design-os:design-shell" (UX research patterns) + +After each step, read the output file to verify completion. +Return the roadmap sections for the design session." +``` + +**Design Session (Multi-Agent Spawn):** +```bash +# For EACH section in the roadmap: +Task subagent_type="general-purpose" +description="Design Section: ${sectionName}" +prompt="# Design Session: ${sectionName} + +Section: ${sectionId} - ${sectionName} +Spec: ${sectionSpec} + +Research for this section: ${sectionResearch} + +Execute these steps sequentially: +1. Skill skill="design-os:shape-section" --section=${sectionId} +2. Skill skill="design-os:sample-data" --section=${sectionId} +3. Skill skill="design-os:design-screen" --section=${sectionId} +4. Skill skill="design-os:screenshot-design" --section=${sectionId} + +Use frontend-design principles to avoid generic AI aesthetics. +Apply research-backed UI patterns for ${sectionName}." +``` + +### 9. Progress Reporting + +Keep user informed with structured updates: + +```markdown +═══════════════════════════════════════ +PHASE 1: RESEARCH & PLANNING +═══════════════════════════════════════ + +🔍 Researching: [topic] + └─ Found: [key insight] ([source]) + +🔍 Researching: [topic] + └─ Found: [key insight] ([source]) + +✓ Research synthesis complete + +📋 Step 1/5: Product Vision + └─ [Invoking skill] + └─ ✓ Complete: product/product-overview.md + +📋 Step 2/5: Product Roadmap + └─ [Invoking skill] + └─ ✓ Complete: 4 sections defined + +[Continue...] + +═══════════════════════════════════════ +PHASE 2: DESIGN SESSION (PARALLEL) +═══════════════════════════════════════ + +Spawned 4 sub-agents: + ├─ 🔵 Agent 1: foundation (In Progress) + ├─ 🔵 Agent 2: task-management (In Progress) + ├─ 🔵 Agent 3: collaboration (In Progress) + └─ 🔵 Agent 4: analytics (In Progress) + +[Monitor and report completion...] + +✓ All sections complete! +``` + +### 10. File Structure & Prerequisites + +``` +product/ # Product definition +├── product-overview.md # Step 1 (research-enriched) +├── product-roadmap.md # Step 2 (triggers parallel spawns) +├── data-model/data-model.md # Step 3 (domain-standards) +├── design-system/ +│ ├── colors.json # Step 4 (audience-researched) +│ └── typography.json # Step 4 (trend-researched) +├── shell/spec.md # Step 5 (UX-researched) +└── sections/[section-id]/ # Steps 6-9 (parallel per section) + ├── spec.md + ├── data.json + ├── types.ts + └── *.png + +product-plan/ # Final export +``` + +**Prerequisites to check before each step:** + +| Step | Prerequisites | Check Command | +|------|--------------|---------------| +| 1 | None | - | +| 2 | `product/product-overview.md` | Read file | +| 3 | `product/product-overview.md` | Read file | +| 4 | `product/product-overview.md` | Read file | +| 5 | `product/design-system/*.json` | Read files | +| 6-9 | `product/product-roadmap.md` | Read file, parse sections | + +### 11. Error Handling & Recovery + +**If research fails:** +- Try alternative search queries +- Fall back to general design principles +- Note the limitation and continue + +**If a Design OS skill fails:** +- Read the error message +- Check for missing prerequisites +- Retry with corrected inputs +- Log the issue and skip if non-critical + +**If sub-agent fails:** +- Capture the error +- Spawn a replacement agent +- Continue with other sections +- Report all failures at end + +### 12. Example Workflow + +**User input:** +``` +"create a mobile app todo management for lazy-busy-genz" +``` + +**Agent response:** +```markdown +Analyzing your request... + +🔍 Researching: Gen Z productivity app design patterns +🔍 Researching: mobile todo list UI trends 2025 +🔍 Researching: task management app features competitors +🔍 Researching: Gen Z color preferences design trends +🔍 Researching: mobile app navigation best practices + +✓ Research complete: 15 sources analyzed + +## Key Findings: +- **Gen Z prefers**: Bold colors, minimal text, social-native features +- **Top trends**: AI-powered suggestions, voice input, gesture-based actions +- **Competitors**: Todoist (minimal), Things3 (elegant), TickTick (feature-rich) +- **Navigation**: Bottom tabs for mobile, swipe gestures for actions + +═══════════════════════════════════════ +PHASE 1: PLANNING SESSION +═══════════════════════════════════════ + +📋 Step 1/5: Product Vision (research-enriched) + [Invoking design-os:product-vision] + ✓ Generated: product/product-overview.md + +📋 Step 2/5: Product Roadmap + [Invoking design-os:product-roadmap] + ✓ Generated: product/product-roadmap.md + Roadmap: 4 sections (foundation, tasks, smart-features, social) + +[Continue through all 5 planning steps...] + +═══════════════════════════════════════ +PHASE 2: DESIGN SESSION (PARALLEL) +═══════════════════════════════════════ + +Spawning 4 sub-agents for parallel design... + +🔵 Agent 1: foundation + 🔍 Researching: mobile authentication UX best practices + [Executing steps 6-9] + +🔵 Agent 2: tasks + 🔍 Researching: task list UI patterns mobile + [Executing steps 6-9] + +🔵 Agent 3: smart-features + 🔍 Researching: AI productivity features UX + [Executing steps 6-9] + +🔵 Agent 4: social + 🔍 Researching: social features todo apps Gen Z + [Executing steps 6-9] + +[Monitor and report...] + +✓ All sections designed! + +Next: Run /export-product to generate implementation package +``` + +## Success Criteria + +✓ **Autonomous research conducted** before major decisions +✓ **Minimal user questioning** (only for critical ambiguities) +✓ **Research findings cited** with sources +✓ **All 10 steps executed** in correct order +✓ **Sub-agents spawned** efficiently (1 for planning, N for sections) +✓ **Design OS artifacts** generated and validated +✓ **Export package** ready for implementation + +## Tone & Style + +- **Research-driven**: Base decisions on evidence, not assumptions +- **Efficient**: Minimize user questions through proactive research +- **Transparent**: Show research sources and rationale +- **Confident**: Make informed decisions autonomously +- **Structured**: Clear phase/step progress reporting +- **Quality-focused**: Apply frontend-design principles to avoid generic aesthetics + +## Tools Reference + +**Research Tools:** +- `WebSearch` - General web search +- `mcp__web-search-prime__webSearchPrime` - Enhanced search with filters +- `mcp__web-reader__webReader` - Read web content for analysis + +**Design OS Commands:** +- `Skill skill="design-os:product-vision"` +- `Skill skill="design-os:product-roadmap"` +- `Skill skill="design-os:data-model"` +- `Skill skill="design-os:design-tokens"` +- `Skill skill="design-os:design-shell"` +- `Skill skill="design-os:shape-section"` +- `Skill skill="design-os:sample-data"` +- `Skill skill="design-os:design-screen"` +- `Skill skill="design-os:screenshot-design"` +- `Skill skill="design-os:export-product"` + +**Sub-Agent Orchestration:** +- `Task subagent_type="general-purpose"` - For planning and design sessions + +## Getting Started + +When invoked: +1. Parse and categorize user input +2. Run parallel web searches on relevant topics +3. Synthesize research findings +4. Execute planning session (single spawn) +5. Read roadmap and spawn design session sub-agents (multi spawn) +6. Monitor all sub-agents to completion +7. Report final results + +Remember: **Research first, ask questions only when absolutely necessary.** diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..387cf8e --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,12 @@ +{ + "permissions": { + "allow": [ + "Skill(design-os:product-vision)", + "Bash(test:*)", + "mcp__MCP_DOCKER__mcp-find", + "mcp__MCP_DOCKER__search_repositories", + "WebSearch", + "Skill(validate-output)" + ] + } +} diff --git a/CHANGELOG.md b/CHANGELOG.md index e2f2201..b24e80c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,27 @@ Get notified of major releases by subscribing here: https://buildermethods.com/design-os +## [0.1.3] - 2026-01-05 + +### Changed +- Replaced build-time `import.meta.glob` with runtime `fetch()` for loading product markdown and JSON files +- All page components now use async data loading pattern via `useProductData` hook + +### Added +- New `useProductData` hook (`src/lib/use-product-data.ts`) for consistent async data loading across components +- Loading states for all pages while product data is being fetched + +### Fixed +- Fixed markdown parsing failing on Windows due to CRLF line endings - now normalizes to LF before parsing +- Product files (overview, roadmap, data model, design system, shell spec) now hot-reload without dev server restart + +### Technical Details +- `product-loader.ts`: Now uses `fetch()` with cache busting in dev mode +- `data-model-loader.ts`: Converted to async with CRLF normalization +- `design-system-loader.ts`: Converted to async for JSON loading +- `shell-loader.ts`: Spec loading now async; component loading remains build-time for bundling +- All page components updated: `ProductPage`, `SectionsPage`, `SectionPage`, `DataModelPage`, `DesignPage`, `ExportPage`, `PhaseNav`, `PhaseWarningBanner`, `ScreenDesignPage` + ## [0.1.2] - 2025-12-19 - Fixed errors related to importing google fonts out of order. diff --git a/package-lock.json b/package-lock.json index 4651f30..f17d678 100644 --- a/package-lock.json +++ b/package-lock.json @@ -74,6 +74,7 @@ "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", @@ -2979,6 +2980,7 @@ "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", "devOptional": true, "license": "MIT", + "peer": true, "dependencies": { "undici-types": "~7.16.0" } @@ -2989,6 +2991,7 @@ "integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==", "devOptional": true, "license": "MIT", + "peer": true, "dependencies": { "csstype": "^3.2.2" } @@ -2999,6 +3002,7 @@ "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", "devOptional": true, "license": "MIT", + "peer": true, "peerDependencies": { "@types/react": "^19.2.0" } @@ -3049,6 +3053,7 @@ "integrity": "sha512-jCzKdm/QK0Kg4V4IK/oMlRZlY+QOcdjv89U2NgKHZk1CYTj82/RVSx1mV/0gqCVMJ/DA+Zf/S4NBWNF8GQ+eqQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.48.0", "@typescript-eslint/types": "8.48.0", @@ -3300,6 +3305,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -3417,6 +3423,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.8.25", "caniuse-lite": "^1.0.30001754", @@ -3705,6 +3712,7 @@ "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -4729,6 +4737,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -4795,6 +4804,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.2.0.tgz", "integrity": "sha512-tmbWg6W31tQLeB5cdIBOicJDJRR2KzXsV7uSK9iNfLWQ5bIZfxuPEHp7M8wiHyHnn0DD1i7w3Zmin0FtkrwoCQ==", "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -4804,6 +4814,7 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.0.tgz", "integrity": "sha512-UlbRu4cAiGaIewkPyiRGJk0imDN2T3JjieT6spoL2UeSf5od4n5LB/mQ4ejmxhCFT1tYe8IvaFulzynWovsEFQ==", "license": "MIT", + "peer": true, "dependencies": { "scheduler": "^0.27.0" }, @@ -5188,6 +5199,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -5331,6 +5343,7 @@ "resolved": "https://registry.npmjs.org/vite/-/vite-7.2.4.tgz", "integrity": "sha512-NL8jTlbo0Tn4dUEXEsUg8KeyG/Lkmc4Fnzb8JXN/Ykm9G4HNImjtABMJgkQoVjOBN/j2WAwDTRytdqJbZsah7w==", "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", @@ -5452,6 +5465,7 @@ "integrity": "sha512-AvvthqfqrAhNH9dnfmrfKzX5upOdjUVJYFqNSlkmGf64gRaTzlPwz99IHYnVs28qYAybvAlBV+H7pn0saFY4Ig==", "dev": true, "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/src/components/DataModelPage.tsx b/src/components/DataModelPage.tsx index 247f6ab..ab23a3e 100644 --- a/src/components/DataModelPage.tsx +++ b/src/components/DataModelPage.tsx @@ -1,18 +1,34 @@ -import { useMemo } from 'react' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { AppLayout } from '@/components/AppLayout' import { EmptyState } from '@/components/EmptyState' import { StepIndicator, type StepStatus } from '@/components/StepIndicator' import { NextPhaseButton } from '@/components/NextPhaseButton' -import { loadProductData } from '@/lib/product-loader' +import { useProductData } from '@/lib/use-product-data' export function DataModelPage() { - const productData = useMemo(() => loadProductData(), []) - const dataModel = productData.dataModel + const { productData, loading } = useProductData() + const dataModel = productData?.dataModel const hasDataModel = !!dataModel const stepStatus: StepStatus = hasDataModel ? 'completed' : 'current' + if (loading) { + return ( + +
+
+

+ Data Model +

+

+ Loading... +

+
+
+
+ ) + } + return (
diff --git a/src/components/DesignPage.tsx b/src/components/DesignPage.tsx index 46c43f4..0f27551 100644 --- a/src/components/DesignPage.tsx +++ b/src/components/DesignPage.tsx @@ -1,11 +1,10 @@ -import { useMemo } from 'react' import { Link } from 'react-router-dom' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { AppLayout } from '@/components/AppLayout' import { EmptyState } from '@/components/EmptyState' import { StepIndicator, type StepStatus } from '@/components/StepIndicator' import { NextPhaseButton } from '@/components/NextPhaseButton' -import { loadProductData } from '@/lib/product-loader' +import { useProductData } from '@/lib/use-product-data' import { ChevronRight, Layout } from 'lucide-react' // Map Tailwind color names to actual color values for preview @@ -64,9 +63,9 @@ function getDesignPageStepStatuses( } export function DesignPage() { - const productData = useMemo(() => loadProductData(), []) - const designSystem = productData.designSystem - const shell = productData.shell + const { productData, loading } = useProductData() + const designSystem = productData?.designSystem + const shell = productData?.shell const hasDesignSystem = !!(designSystem?.colors || designSystem?.typography) const hasShell = !!shell?.spec @@ -74,6 +73,23 @@ export function DesignPage() { const stepStatuses = getDesignPageStepStatuses(hasDesignSystem, hasShell) + if (loading) { + return ( + +
+
+

+ Design System +

+

+ Loading... +

+
+
+
+ ) + } + return (
diff --git a/src/components/ExportPage.tsx b/src/components/ExportPage.tsx index 897b20b..682240f 100644 --- a/src/components/ExportPage.tsx +++ b/src/components/ExportPage.tsx @@ -3,28 +3,29 @@ import { Check, AlertTriangle, FileText, FolderTree, ChevronDown, Download, Pack import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible' import { AppLayout } from '@/components/AppLayout' -import { loadProductData, hasExportZip, getExportZipUrl } from '@/lib/product-loader' +import { useProductData } from '@/lib/use-product-data' +import { hasExportZip, getExportZipUrl } from '@/lib/product-loader' import { getAllSectionIds, getSectionScreenDesigns } from '@/lib/section-loader' export function ExportPage() { - const productData = useMemo(() => loadProductData(), []) + const { productData, loading } = useProductData() // Get section stats const sectionStats = useMemo(() => { const allSectionIds = getAllSectionIds() - const sectionCount = productData.roadmap?.sections.length || 0 + const sectionCount = productData?.roadmap?.sections.length || 0 const sectionsWithScreenDesigns = allSectionIds.filter(id => { const screenDesigns = getSectionScreenDesigns(id) return screenDesigns.length > 0 }).length return { sectionCount, sectionsWithScreenDesigns, allSectionIds } - }, [productData.roadmap]) + }, [productData?.roadmap]) - const hasOverview = !!productData.overview - const hasRoadmap = !!productData.roadmap - const hasDataModel = !!productData.dataModel - const hasDesignSystem = !!productData.designSystem - const hasShell = !!productData.shell + const hasOverview = !!productData?.overview + const hasRoadmap = !!productData?.roadmap + const hasDataModel = !!productData?.dataModel + const hasDesignSystem = !!productData?.designSystem + const hasShell = !!productData?.shell const hasSections = sectionStats.sectionsWithScreenDesigns > 0 const requiredComplete = hasOverview && hasRoadmap && hasSections @@ -33,6 +34,23 @@ export function ExportPage() { const exportZipAvailable = hasExportZip() const exportZipUrl = getExportZipUrl() + if (loading) { + return ( + +
+
+

+ Export +

+

+ Loading... +

+
+
+
+ ) + } + return (
diff --git a/src/components/PhaseNav.tsx b/src/components/PhaseNav.tsx index 9f87618..bf9ee66 100644 --- a/src/components/PhaseNav.tsx +++ b/src/components/PhaseNav.tsx @@ -1,7 +1,8 @@ import { useLocation, useNavigate } from 'react-router-dom' import { useMemo } from 'react' import { FileText, Boxes, Layout, LayoutList, Package } from 'lucide-react' -import { loadProductData, hasExportZip } from '@/lib/product-loader' +import { useProductData } from '@/lib/use-product-data' +import { hasExportZip } from '@/lib/product-loader' import { getAllSectionIds, getSectionScreenDesigns } from '@/lib/section-loader' export type Phase = 'product' | 'data-model' | 'design' | 'sections' | 'export' @@ -29,16 +30,16 @@ interface PhaseInfo { isComplete: boolean } -function usePhaseStatuses(): PhaseInfo[] { +function usePhaseStatuses(): { phaseInfos: PhaseInfo[]; loading: boolean } { const location = useLocation() - const productData = useMemo(() => loadProductData(), []) + const { productData, loading } = useProductData() // Calculate completion status for each phase - const hasOverview = !!productData.overview - const hasRoadmap = !!productData.roadmap - const hasDataModel = !!productData.dataModel - const hasDesignSystem = !!productData.designSystem - const hasShell = !!productData.shell + const hasOverview = !!productData?.overview + const hasRoadmap = !!productData?.roadmap + const hasDataModel = !!productData?.dataModel + const hasDesignSystem = !!productData?.designSystem + const hasShell = !!productData?.shell const sectionIds = useMemo(() => getAllSectionIds(), []) const sectionsWithScreenDesigns = useMemo(() => { @@ -74,7 +75,7 @@ function usePhaseStatuses(): PhaseInfo[] { 'export': exportZipExists, } - return phases.map(phase => { + const phaseInfos = phases.map(phase => { const isComplete = phaseComplete[phase.id] let status: PhaseStatus if (phase.id === currentPhaseId) { @@ -86,11 +87,41 @@ function usePhaseStatuses(): PhaseInfo[] { } return { phase, status, isComplete } }) + + return { phaseInfos, loading } } export function PhaseNav() { const navigate = useNavigate() - const phaseInfos = usePhaseStatuses() + const { phaseInfos, loading } = usePhaseStatuses() + + if (loading) { + return ( + + ) + } return (