feat: Add JTBD-driven Unified Add Wizard system
Implemented a comprehensive unified wizard system to consolidate all "add new content"
actions into a single, intuitive, step-by-step guided experience based on Jobs To Be Done
(JTBD) methodology.
## What's New
### Core Components
- **UnifiedAddWizard**: Main orchestrator component that routes to specific wizards
- **ItemTypeSelector**: Beautiful visual card-based selection for 9 content types
- **9 Individual Wizards**: Step-by-step flows for each content type
### Priority Implementations (P0)
1. **SalesEntryWizard** ⭐ (MOST CRITICAL)
- Manual entry with dynamic product lists and auto-calculated totals
- File upload placeholder for CSV/Excel bulk import
- Critical for small bakeries without POS systems
2. **InventoryWizard**
- Type selection (ingredient vs finished product)
- Context-aware forms based on inventory type
- Optional initial lot entry
### Placeholder Wizards (P1/P2)
- Customer Order, Supplier, Recipe, Customer, Quality Template, Equipment, Team Member
- Proper structure in place for incremental enhancement
### Dashboard Integration
- Added prominent "Agregar" button in dashboard header
- Opens wizard modal with visual type selection
- Auto-refreshes dashboard after wizard completion
### Design Highlights
- Mobile-first responsive design (full-screen on mobile, modal on desktop)
- Touch-friendly with 44px+ touch targets
- Follows existing color system and design tokens
- Progressive disclosure to reduce cognitive load
- Accessibility-compliant (WCAG AA)
## Documentation
Created comprehensive documentation:
- `JTBD_UNIFIED_ADD_WIZARD.md` - Full JTBD analysis and research
- `WIZARD_ARCHITECTURE_DESIGN.md` - Technical design and specifications
- `UNIFIED_WIZARD_IMPLEMENTATION_SUMMARY.md` - Implementation guide
## Files Changed
- New: `frontend/src/components/domain/unified-wizard/` (15 new files)
- Modified: `frontend/src/pages/app/DashboardPage.tsx` (added wizard integration)
## Next Steps
- [ ] Connect wizards to real API endpoints (currently mock/placeholder)
- [ ] Implement full CSV upload for sales entry
- [ ] Add comprehensive form validation
- [ ] Enhance P1 priority wizards based on user feedback
## JTBD Alignment
Main Job: "When I need to expand or update my bakery operations, I want to quickly add
new resources to my management system, so I can keep my business running smoothly."
Key insights applied:
- Prioritized sales entry (most bakeries lack POS)
- Mobile-first (bakery owners are on their feet)
- Progressive disclosure (reduce overwhelm)
- Forgiving interactions (can go back, save drafts)
This commit is contained in:
@@ -15,9 +15,9 @@
|
||||
* - Trust-building (explain system reasoning)
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { RefreshCw, ExternalLink } from 'lucide-react';
|
||||
import { RefreshCw, ExternalLink, Plus, Sparkles } from 'lucide-react';
|
||||
import { useTenant } from '../../stores/tenant.store';
|
||||
import {
|
||||
useBakeryHealthStatus,
|
||||
@@ -34,12 +34,18 @@ import { ActionQueueCard } from '../../components/dashboard/ActionQueueCard';
|
||||
import { OrchestrationSummaryCard } from '../../components/dashboard/OrchestrationSummaryCard';
|
||||
import { ProductionTimelineCard } from '../../components/dashboard/ProductionTimelineCard';
|
||||
import { InsightsGrid } from '../../components/dashboard/InsightsGrid';
|
||||
import { UnifiedAddWizard } from '../../components/domain/unified-wizard';
|
||||
import type { ItemType } from '../../components/domain/unified-wizard';
|
||||
|
||||
export function NewDashboardPage() {
|
||||
const navigate = useNavigate();
|
||||
const { currentTenant } = useTenant();
|
||||
const tenantId = currentTenant?.id || '';
|
||||
|
||||
// Unified Add Wizard state
|
||||
const [isAddWizardOpen, setIsAddWizardOpen] = useState(false);
|
||||
const [addWizardError, setAddWizardError] = useState<string | null>(null);
|
||||
|
||||
// Data fetching
|
||||
const {
|
||||
data: healthStatus,
|
||||
@@ -125,6 +131,12 @@ export function NewDashboardPage() {
|
||||
refetchInsights();
|
||||
};
|
||||
|
||||
const handleAddWizardComplete = (itemType: ItemType, data?: any) => {
|
||||
console.log('Item created:', itemType, data);
|
||||
// Refetch relevant data based on what was added
|
||||
handleRefreshAll();
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="min-h-screen pb-20 md:pb-8" style={{ backgroundColor: 'var(--bg-secondary)' }}>
|
||||
{/* Mobile-optimized container */}
|
||||
@@ -135,19 +147,37 @@ export function NewDashboardPage() {
|
||||
<h1 className="text-3xl md:text-4xl font-bold" style={{ color: 'var(--text-primary)' }}>Panel de Control</h1>
|
||||
<p className="mt-1" style={{ color: 'var(--text-secondary)' }}>Your bakery at a glance</p>
|
||||
</div>
|
||||
<button
|
||||
onClick={handleRefreshAll}
|
||||
className="flex items-center gap-2 px-4 py-2 rounded-lg font-semibold transition-colors duration-200"
|
||||
style={{
|
||||
backgroundColor: 'var(--bg-primary)',
|
||||
borderColor: 'var(--border-primary)',
|
||||
border: '1px solid',
|
||||
color: 'var(--text-secondary)'
|
||||
}}
|
||||
>
|
||||
<RefreshCw className="w-5 h-5" />
|
||||
<span className="hidden sm:inline">Refresh</span>
|
||||
</button>
|
||||
|
||||
{/* Action Buttons */}
|
||||
<div className="flex items-center gap-3">
|
||||
<button
|
||||
onClick={handleRefreshAll}
|
||||
className="flex items-center gap-2 px-4 py-2 rounded-lg font-semibold transition-colors duration-200"
|
||||
style={{
|
||||
backgroundColor: 'var(--bg-primary)',
|
||||
borderColor: 'var(--border-primary)',
|
||||
border: '1px solid',
|
||||
color: 'var(--text-secondary)'
|
||||
}}
|
||||
>
|
||||
<RefreshCw className="w-5 h-5" />
|
||||
<span className="hidden sm:inline">Refresh</span>
|
||||
</button>
|
||||
|
||||
{/* Unified Add Button */}
|
||||
<button
|
||||
onClick={() => setIsAddWizardOpen(true)}
|
||||
className="flex items-center gap-2 px-6 py-2.5 rounded-lg font-semibold transition-all duration-200 shadow-lg hover:shadow-xl hover:-translate-y-0.5 active:translate-y-0"
|
||||
style={{
|
||||
background: 'linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%)',
|
||||
color: 'white'
|
||||
}}
|
||||
>
|
||||
<Plus className="w-5 h-5" />
|
||||
<span className="hidden sm:inline">Agregar</span>
|
||||
<Sparkles className="w-4 h-4 opacity-80" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Main Dashboard Layout */}
|
||||
@@ -230,6 +260,13 @@ export function NewDashboardPage() {
|
||||
|
||||
{/* Mobile-friendly bottom padding */}
|
||||
<div className="h-20 md:hidden"></div>
|
||||
|
||||
{/* Unified Add Wizard */}
|
||||
<UnifiedAddWizard
|
||||
isOpen={isAddWizardOpen}
|
||||
onClose={() => setIsAddWizardOpen(false)}
|
||||
onComplete={handleAddWizardComplete}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user