feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
// ================================================================
|
2025-11-27 07:33:54 +01:00
|
|
|
// frontend/src/pages/app/DashboardPage.tsx
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
// ================================================================
|
|
|
|
|
/**
|
|
|
|
|
* JTBD-Aligned Dashboard Page
|
|
|
|
|
*
|
|
|
|
|
* Complete redesign based on Jobs To Be Done methodology.
|
|
|
|
|
* Focused on answering: "What requires my attention right now?"
|
|
|
|
|
*
|
|
|
|
|
* Key principles:
|
|
|
|
|
* - Automation-first (show what system did)
|
|
|
|
|
* - Action-oriented (prioritize tasks)
|
|
|
|
|
* - Progressive disclosure (show 20% that matters 80%)
|
|
|
|
|
* - Mobile-first (one-handed operation)
|
|
|
|
|
* - Trust-building (explain system reasoning)
|
|
|
|
|
*/
|
|
|
|
|
|
2025-11-27 07:33:54 +01:00
|
|
|
import React, { useState, useEffect, useMemo, useRef } from 'react';
|
2025-09-22 11:04:03 +02:00
|
|
|
import { useNavigate } from 'react-router-dom';
|
2025-11-27 07:33:54 +01:00
|
|
|
import { RefreshCw, ExternalLink, Plus, Sparkles, Wifi, WifiOff } from 'lucide-react';
|
2025-11-13 16:01:08 +01:00
|
|
|
import { useTranslation } from 'react-i18next';
|
2025-11-07 17:19:46 +00:00
|
|
|
import { useTenant } from '../../stores/tenant.store';
|
2025-09-19 16:17:04 +02:00
|
|
|
import {
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
useBakeryHealthStatus,
|
|
|
|
|
useOrchestrationSummary,
|
2025-11-27 07:33:54 +01:00
|
|
|
useUnifiedActionQueue,
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
useProductionTimeline,
|
|
|
|
|
useApprovePurchaseOrder,
|
|
|
|
|
useStartProductionBatch,
|
|
|
|
|
usePauseProductionBatch,
|
2025-11-27 07:33:54 +01:00
|
|
|
useExecutionProgress,
|
2025-12-05 20:07:01 +01:00
|
|
|
useDashboardRealtime, // PHASE 3: SSE state sync
|
|
|
|
|
useProgressiveDashboard, // PHASE 4: Progressive loading
|
|
|
|
|
} from '../../api/hooks/useProfessionalDashboard';
|
2025-11-12 15:34:10 +01:00
|
|
|
import { useRejectPurchaseOrder } from '../../api/hooks/purchase-orders';
|
2025-11-27 07:33:54 +01:00
|
|
|
import { useIngredients } from '../../api/hooks/inventory';
|
|
|
|
|
import { useSuppliers } from '../../api/hooks/suppliers';
|
|
|
|
|
import { useRecipes } from '../../api/hooks/recipes';
|
|
|
|
|
import { useQualityTemplates } from '../../api/hooks/qualityTemplates';
|
|
|
|
|
import { GlanceableHealthHero } from '../../components/dashboard/GlanceableHealthHero';
|
|
|
|
|
import { SetupWizardBlocker } from '../../components/dashboard/SetupWizardBlocker';
|
|
|
|
|
import { CollapsibleSetupBanner } from '../../components/dashboard/CollapsibleSetupBanner';
|
|
|
|
|
import { UnifiedActionQueueCard } from '../../components/dashboard/UnifiedActionQueueCard';
|
|
|
|
|
import { ExecutionProgressTracker } from '../../components/dashboard/ExecutionProgressTracker';
|
|
|
|
|
import { IntelligentSystemSummaryCard } from '../../components/dashboard/IntelligentSystemSummaryCard';
|
|
|
|
|
import { useAuthUser } from '../../stores';
|
2025-11-19 21:01:06 +01:00
|
|
|
import { UnifiedPurchaseOrderModal } from '../../components/domain/procurement/UnifiedPurchaseOrderModal';
|
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)
2025-11-09 08:40:01 +00:00
|
|
|
import { UnifiedAddWizard } from '../../components/domain/unified-wizard';
|
|
|
|
|
import type { ItemType } from '../../components/domain/unified-wizard';
|
2025-11-12 15:34:10 +01:00
|
|
|
import { useDemoTour, shouldStartTour, clearTourStartPending } from '../../features/demo-onboarding';
|
2025-11-27 07:33:54 +01:00
|
|
|
import { Package, Users, BookOpen, Shield } from 'lucide-react';
|
|
|
|
|
import {
|
|
|
|
|
useBatchNotifications,
|
|
|
|
|
useDeliveryNotifications,
|
|
|
|
|
useOrchestrationNotifications,
|
|
|
|
|
} from '../../hooks';
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
|
2025-12-05 20:07:01 +01:00
|
|
|
|
|
|
|
|
// Import Enterprise Dashboard
|
|
|
|
|
import EnterpriseDashboardPage from './EnterpriseDashboardPage';
|
|
|
|
|
import { useSubscription } from '../../api/hooks/subscription';
|
|
|
|
|
import { SUBSCRIPTION_TIERS } from '../../api/types/subscription';
|
|
|
|
|
|
|
|
|
|
// Rename the existing component to BakeryDashboard
|
|
|
|
|
export function BakeryDashboard() {
|
2025-09-22 11:04:03 +02:00
|
|
|
const navigate = useNavigate();
|
2025-11-27 07:33:54 +01:00
|
|
|
const { t } = useTranslation(['dashboard', 'common', 'alerts']);
|
2025-11-07 17:19:46 +00:00
|
|
|
const { currentTenant } = useTenant();
|
|
|
|
|
const tenantId = currentTenant?.id || '';
|
2025-11-12 15:34:10 +01:00
|
|
|
const { startTour } = useDemoTour();
|
|
|
|
|
const isDemoMode = localStorage.getItem('demo_mode') === 'true';
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
|
2025-11-27 07:33:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
2025-11-09 08:40:01 +00:00
|
|
|
// Unified Add Wizard state
|
|
|
|
|
const [isAddWizardOpen, setIsAddWizardOpen] = useState(false);
|
|
|
|
|
const [addWizardError, setAddWizardError] = useState<string | null>(null);
|
|
|
|
|
|
2025-11-15 21:21:06 +01:00
|
|
|
// PO Details Modal state
|
|
|
|
|
const [selectedPOId, setSelectedPOId] = useState<string | null>(null);
|
|
|
|
|
const [isPOModalOpen, setIsPOModalOpen] = useState(false);
|
2025-11-18 11:59:23 +01:00
|
|
|
const [poModalMode, setPOModalMode] = useState<'view' | 'edit'>('view');
|
2025-11-18 07:17:17 +01:00
|
|
|
|
2025-11-27 07:33:54 +01:00
|
|
|
// Setup Progress Data
|
2025-12-05 20:07:01 +01:00
|
|
|
// Always fetch setup data to determine true progress, but use localStorage as fallback during loading
|
|
|
|
|
// PHASE 1 OPTIMIZATION: Only use cached value if we're still waiting for API to respond
|
|
|
|
|
const setupProgressFromStorage = useMemo(() => {
|
|
|
|
|
try {
|
|
|
|
|
const cached = localStorage.getItem(`setup_progress_${tenantId}`);
|
|
|
|
|
return cached ? parseInt(cached, 10) : 0;
|
|
|
|
|
} catch {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}, [tenantId]);
|
|
|
|
|
|
|
|
|
|
// Always fetch the actual data to determine true progress
|
|
|
|
|
const { data: ingredients = [], isLoading: loadingIngredients } = useIngredients(
|
|
|
|
|
tenantId,
|
|
|
|
|
{},
|
|
|
|
|
{ enabled: !!tenantId }
|
|
|
|
|
);
|
|
|
|
|
const { data: suppliers = [], isLoading: loadingSuppliers } = useSuppliers(
|
|
|
|
|
tenantId,
|
|
|
|
|
{},
|
|
|
|
|
{ enabled: !!tenantId }
|
|
|
|
|
);
|
|
|
|
|
const { data: recipes = [], isLoading: loadingRecipes } = useRecipes(
|
|
|
|
|
tenantId,
|
|
|
|
|
{},
|
|
|
|
|
{ enabled: !!tenantId }
|
|
|
|
|
);
|
|
|
|
|
const { data: qualityData, isLoading: loadingQuality } = useQualityTemplates(
|
|
|
|
|
tenantId,
|
|
|
|
|
{},
|
|
|
|
|
{ enabled: !!tenantId }
|
|
|
|
|
);
|
2025-11-27 07:33:54 +01:00
|
|
|
const qualityTemplates = Array.isArray(qualityData?.templates) ? qualityData.templates : [];
|
|
|
|
|
|
2025-12-05 20:07:01 +01:00
|
|
|
// PHASE 4: Progressive data loading for perceived performance boost
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
const {
|
2025-12-05 20:07:01 +01:00
|
|
|
health: {
|
|
|
|
|
data: healthStatus,
|
|
|
|
|
isLoading: healthLoading,
|
|
|
|
|
refetch: refetchHealth,
|
|
|
|
|
},
|
|
|
|
|
actionQueue: {
|
|
|
|
|
data: actionQueue,
|
|
|
|
|
isLoading: actionQueueLoading,
|
|
|
|
|
refetch: refetchActionQueue,
|
|
|
|
|
},
|
|
|
|
|
progress: {
|
|
|
|
|
data: executionProgress,
|
|
|
|
|
isLoading: executionProgressLoading,
|
|
|
|
|
refetch: refetchExecutionProgress,
|
|
|
|
|
},
|
|
|
|
|
overallLoading,
|
|
|
|
|
isReady,
|
|
|
|
|
} = useProgressiveDashboard(tenantId);
|
|
|
|
|
|
|
|
|
|
// Additional hooks not part of progressive loading
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
const {
|
|
|
|
|
data: orchestrationSummary,
|
|
|
|
|
isLoading: orchestrationLoading,
|
|
|
|
|
refetch: refetchOrchestration,
|
|
|
|
|
} = useOrchestrationSummary(tenantId);
|
|
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
data: productionTimeline,
|
|
|
|
|
isLoading: timelineLoading,
|
|
|
|
|
refetch: refetchTimeline,
|
|
|
|
|
} = useProductionTimeline(tenantId);
|
|
|
|
|
|
2025-12-05 20:07:01 +01:00
|
|
|
// Insights functionality removed as it's not needed with new architecture
|
|
|
|
|
const insights = undefined;
|
|
|
|
|
const insightsLoading = false;
|
|
|
|
|
const refetchInsights = () => {};
|
|
|
|
|
|
|
|
|
|
// PHASE 3: Enable SSE real-time state synchronization
|
|
|
|
|
useDashboardRealtime(tenantId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// PHASE 6: Performance monitoring
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const loadTime = performance.now();
|
|
|
|
|
console.log(`📊 [Performance] Dashboard loaded in ${loadTime.toFixed(0)}ms`);
|
|
|
|
|
|
|
|
|
|
// Calculate setup completion status based on stored progress (approximation since actual data may not be loaded yet)
|
|
|
|
|
const setupComplete = setupProgressFromStorage >= 100;
|
|
|
|
|
|
|
|
|
|
if (loadTime > 1000) {
|
|
|
|
|
console.warn('⚠️ [Performance] Dashboard load time exceeded target (>1000ms):', {
|
|
|
|
|
loadTime: `${loadTime.toFixed(0)}ms`,
|
|
|
|
|
target: '1000ms',
|
|
|
|
|
setupComplete,
|
|
|
|
|
queriesSkipped: setupComplete ? 4 : 0,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
console.log('✅ [Performance] Dashboard load time within target:', {
|
|
|
|
|
loadTime: `${loadTime.toFixed(0)}ms`,
|
|
|
|
|
target: '<1000ms',
|
|
|
|
|
setupComplete,
|
|
|
|
|
queriesSkipped: setupComplete ? 4 : 0,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}, [setupProgressFromStorage]); // Include setupProgressFromStorage as dependency
|
2025-10-23 07:44:54 +02:00
|
|
|
|
2025-11-27 07:33:54 +01:00
|
|
|
// Real-time event subscriptions for automatic refetching
|
|
|
|
|
const { notifications: batchNotifications } = useBatchNotifications();
|
|
|
|
|
const { notifications: deliveryNotifications } = useDeliveryNotifications();
|
|
|
|
|
const { recentNotifications: orchestrationNotifications } = useOrchestrationNotifications();
|
|
|
|
|
|
2025-11-27 15:52:40 +01:00
|
|
|
console.log('🔄 [Dashboard] Component render - notification counts:', {
|
|
|
|
|
batch: batchNotifications.length,
|
|
|
|
|
delivery: deliveryNotifications.length,
|
|
|
|
|
orchestration: orchestrationNotifications.length,
|
|
|
|
|
batchIds: batchNotifications.map(n => n.id).join(','),
|
|
|
|
|
deliveryIds: deliveryNotifications.map(n => n.id).join(','),
|
|
|
|
|
orchestrationIds: orchestrationNotifications.map(n => n.id).join(','),
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-27 07:33:54 +01:00
|
|
|
// SSE connection status
|
|
|
|
|
const sseConnected = true; // Simplified - based on other notification hooks
|
|
|
|
|
|
|
|
|
|
// Store refetch callbacks in a ref to prevent infinite loop from dependency changes
|
|
|
|
|
// React Query refetch functions are recreated on every query state change, which would
|
|
|
|
|
// trigger useEffect again if they were in the dependency array
|
|
|
|
|
const refetchCallbacksRef = useRef({
|
|
|
|
|
refetchActionQueue,
|
|
|
|
|
refetchHealth,
|
|
|
|
|
refetchExecutionProgress,
|
|
|
|
|
refetchOrchestration,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Store previous notification IDs to prevent infinite refetch loops
|
|
|
|
|
const prevBatchNotificationsRef = useRef('');
|
|
|
|
|
const prevDeliveryNotificationsRef = useRef('');
|
|
|
|
|
const prevOrchestrationNotificationsRef = useRef('');
|
|
|
|
|
|
|
|
|
|
// Update ref with latest callbacks on every render
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
refetchCallbacksRef.current = {
|
|
|
|
|
refetchActionQueue,
|
|
|
|
|
refetchHealth,
|
|
|
|
|
refetchExecutionProgress,
|
|
|
|
|
refetchOrchestration,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Track the latest notification ID to prevent re-running on same notification
|
2025-11-27 15:52:40 +01:00
|
|
|
// Use stringified ID array to create stable dependency that only changes when IDs actually change
|
|
|
|
|
const batchIdsString = JSON.stringify(batchNotifications.map(n => n.id));
|
|
|
|
|
const deliveryIdsString = JSON.stringify(deliveryNotifications.map(n => n.id));
|
|
|
|
|
const orchestrationIdsString = JSON.stringify(orchestrationNotifications.map(n => n.id));
|
|
|
|
|
|
|
|
|
|
console.log('📝 [Dashboard] Stringified ID arrays:', {
|
|
|
|
|
batchIdsString,
|
|
|
|
|
deliveryIdsString,
|
|
|
|
|
orchestrationIdsString,
|
|
|
|
|
});
|
2025-11-27 07:33:54 +01:00
|
|
|
|
2025-11-27 15:52:40 +01:00
|
|
|
const latestBatchNotificationId = useMemo(() => {
|
|
|
|
|
const result = batchNotifications.length === 0 ? '' : (batchNotifications[0]?.id || '');
|
|
|
|
|
console.log('🧮 [Dashboard] latestBatchNotificationId useMemo recalculated:', {
|
|
|
|
|
result,
|
|
|
|
|
dependency: batchIdsString,
|
|
|
|
|
notificationCount: batchNotifications.length,
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|
}, [batchIdsString]);
|
|
|
|
|
|
|
|
|
|
const latestDeliveryNotificationId = useMemo(() => {
|
|
|
|
|
const result = deliveryNotifications.length === 0 ? '' : (deliveryNotifications[0]?.id || '');
|
|
|
|
|
console.log('🧮 [Dashboard] latestDeliveryNotificationId useMemo recalculated:', {
|
|
|
|
|
result,
|
|
|
|
|
dependency: deliveryIdsString,
|
|
|
|
|
notificationCount: deliveryNotifications.length,
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|
}, [deliveryIdsString]);
|
|
|
|
|
|
|
|
|
|
const latestOrchestrationNotificationId = useMemo(() => {
|
|
|
|
|
const result = orchestrationNotifications.length === 0 ? '' : (orchestrationNotifications[0]?.id || '');
|
|
|
|
|
console.log('🧮 [Dashboard] latestOrchestrationNotificationId useMemo recalculated:', {
|
|
|
|
|
result,
|
|
|
|
|
dependency: orchestrationIdsString,
|
|
|
|
|
notificationCount: orchestrationNotifications.length,
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|
}, [orchestrationIdsString]);
|
2025-11-27 07:33:54 +01:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
2025-11-27 15:52:40 +01:00
|
|
|
console.log('⚡ [Dashboard] batchNotifications useEffect triggered', {
|
|
|
|
|
latestBatchNotificationId,
|
|
|
|
|
prevValue: prevBatchNotificationsRef.current,
|
|
|
|
|
hasChanged: latestBatchNotificationId !== prevBatchNotificationsRef.current,
|
|
|
|
|
notificationCount: batchNotifications.length,
|
|
|
|
|
firstNotification: batchNotifications[0],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (latestBatchNotificationId &&
|
2025-12-05 20:07:01 +01:00
|
|
|
latestBatchNotificationId !== prevBatchNotificationsRef.current) {
|
2025-11-27 15:52:40 +01:00
|
|
|
console.log('🔥 [Dashboard] NEW batch notification detected, updating ref and refetching');
|
|
|
|
|
prevBatchNotificationsRef.current = latestBatchNotificationId;
|
2025-11-27 07:33:54 +01:00
|
|
|
const latest = batchNotifications[0];
|
2025-11-27 15:52:40 +01:00
|
|
|
|
2025-11-27 07:33:54 +01:00
|
|
|
if (['batch_completed', 'batch_started'].includes(latest.event_type)) {
|
2025-11-27 15:52:40 +01:00
|
|
|
console.log('🚀 [Dashboard] Triggering refetch for batch event:', latest.event_type);
|
2025-11-27 07:33:54 +01:00
|
|
|
refetchCallbacksRef.current.refetchExecutionProgress();
|
|
|
|
|
refetchCallbacksRef.current.refetchHealth();
|
2025-11-27 15:52:40 +01:00
|
|
|
} else {
|
|
|
|
|
console.log('⏭️ [Dashboard] Skipping refetch - event type not relevant:', latest.event_type);
|
2025-11-27 07:33:54 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, [latestBatchNotificationId]); // Only run when a NEW notification arrives
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
2025-11-27 15:52:40 +01:00
|
|
|
console.log('⚡ [Dashboard] deliveryNotifications useEffect triggered', {
|
|
|
|
|
latestDeliveryNotificationId,
|
|
|
|
|
prevValue: prevDeliveryNotificationsRef.current,
|
|
|
|
|
hasChanged: latestDeliveryNotificationId !== prevDeliveryNotificationsRef.current,
|
|
|
|
|
notificationCount: deliveryNotifications.length,
|
|
|
|
|
firstNotification: deliveryNotifications[0],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (latestDeliveryNotificationId &&
|
2025-12-05 20:07:01 +01:00
|
|
|
latestDeliveryNotificationId !== prevDeliveryNotificationsRef.current) {
|
2025-11-27 15:52:40 +01:00
|
|
|
console.log('🔥 [Dashboard] NEW delivery notification detected, updating ref and refetching');
|
|
|
|
|
prevDeliveryNotificationsRef.current = latestDeliveryNotificationId;
|
2025-11-27 07:33:54 +01:00
|
|
|
const latest = deliveryNotifications[0];
|
2025-11-27 15:52:40 +01:00
|
|
|
|
2025-11-27 07:33:54 +01:00
|
|
|
if (['delivery_received', 'delivery_overdue'].includes(latest.event_type)) {
|
2025-11-27 15:52:40 +01:00
|
|
|
console.log('🚀 [Dashboard] Triggering refetch for delivery event:', latest.event_type);
|
2025-11-27 07:33:54 +01:00
|
|
|
refetchCallbacksRef.current.refetchExecutionProgress();
|
|
|
|
|
refetchCallbacksRef.current.refetchHealth();
|
2025-11-27 15:52:40 +01:00
|
|
|
} else {
|
|
|
|
|
console.log('⏭️ [Dashboard] Skipping refetch - event type not relevant:', latest.event_type);
|
2025-11-27 07:33:54 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, [latestDeliveryNotificationId]); // Only run when a NEW notification arrives
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
2025-11-27 15:52:40 +01:00
|
|
|
console.log('⚡ [Dashboard] orchestrationNotifications useEffect triggered', {
|
|
|
|
|
latestOrchestrationNotificationId,
|
|
|
|
|
prevValue: prevOrchestrationNotificationsRef.current,
|
|
|
|
|
hasChanged: latestOrchestrationNotificationId !== prevOrchestrationNotificationsRef.current,
|
|
|
|
|
notificationCount: orchestrationNotifications.length,
|
|
|
|
|
firstNotification: orchestrationNotifications[0],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (latestOrchestrationNotificationId &&
|
2025-12-05 20:07:01 +01:00
|
|
|
latestOrchestrationNotificationId !== prevOrchestrationNotificationsRef.current) {
|
2025-11-27 15:52:40 +01:00
|
|
|
console.log('🔥 [Dashboard] NEW orchestration notification detected, updating ref and refetching');
|
|
|
|
|
prevOrchestrationNotificationsRef.current = latestOrchestrationNotificationId;
|
2025-11-27 07:33:54 +01:00
|
|
|
const latest = orchestrationNotifications[0];
|
2025-11-27 15:52:40 +01:00
|
|
|
|
2025-11-27 07:33:54 +01:00
|
|
|
if (latest.event_type === 'orchestration_run_completed') {
|
2025-11-27 15:52:40 +01:00
|
|
|
console.log('🚀 [Dashboard] Triggering refetch for orchestration event:', latest.event_type);
|
2025-11-27 07:33:54 +01:00
|
|
|
refetchCallbacksRef.current.refetchOrchestration();
|
|
|
|
|
refetchCallbacksRef.current.refetchActionQueue();
|
2025-11-27 15:52:40 +01:00
|
|
|
} else {
|
|
|
|
|
console.log('⏭️ [Dashboard] Skipping refetch - event type not relevant:', latest.event_type);
|
2025-11-27 07:33:54 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, [latestOrchestrationNotificationId]); // Only run when a NEW notification arrives
|
|
|
|
|
|
2025-10-23 07:44:54 +02:00
|
|
|
// Mutations
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
const approvePO = useApprovePurchaseOrder();
|
2025-11-12 15:34:10 +01:00
|
|
|
const rejectPO = useRejectPurchaseOrder();
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
const startBatch = useStartProductionBatch();
|
|
|
|
|
const pauseBatch = usePauseProductionBatch();
|
2025-10-30 21:08:07 +01:00
|
|
|
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
// Handlers
|
|
|
|
|
const handleApprove = async (actionId: string) => {
|
2025-10-30 21:08:07 +01:00
|
|
|
try {
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
await approvePO.mutateAsync({ tenantId, poId: actionId });
|
|
|
|
|
// Refetch to update UI
|
|
|
|
|
refetchActionQueue();
|
|
|
|
|
refetchHealth();
|
2025-10-30 21:08:07 +01:00
|
|
|
} catch (error) {
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
console.error('Error approving PO:', error);
|
2025-10-12 18:47:33 +02:00
|
|
|
}
|
2025-09-22 11:04:03 +02:00
|
|
|
};
|
|
|
|
|
|
2025-11-12 15:34:10 +01:00
|
|
|
const handleReject = async (actionId: string, reason: string) => {
|
|
|
|
|
try {
|
|
|
|
|
await rejectPO.mutateAsync({ tenantId, poId: actionId, reason });
|
|
|
|
|
// Refetch to update UI
|
|
|
|
|
refetchActionQueue();
|
|
|
|
|
refetchHealth();
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('Error rejecting PO:', error);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
const handleViewDetails = (actionId: string) => {
|
2025-11-18 12:14:13 +01:00
|
|
|
// Open modal to show PO details in view mode
|
2025-11-15 21:21:06 +01:00
|
|
|
setSelectedPOId(actionId);
|
2025-11-18 12:14:13 +01:00
|
|
|
setPOModalMode('view');
|
|
|
|
|
setIsPOModalOpen(true);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleModify = (actionId: string) => {
|
|
|
|
|
// Open modal to edit PO details
|
|
|
|
|
setSelectedPOId(actionId);
|
|
|
|
|
setPOModalMode('edit');
|
2025-11-15 21:21:06 +01:00
|
|
|
setIsPOModalOpen(true);
|
2025-10-21 19:50:07 +02:00
|
|
|
};
|
2025-08-28 10:41:04 +02:00
|
|
|
|
2025-10-23 07:44:54 +02:00
|
|
|
const handleStartBatch = async (batchId: string) => {
|
|
|
|
|
try {
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
await startBatch.mutateAsync({ tenantId, batchId });
|
|
|
|
|
refetchTimeline();
|
|
|
|
|
refetchHealth();
|
2025-10-23 07:44:54 +02:00
|
|
|
} catch (error) {
|
|
|
|
|
console.error('Error starting batch:', error);
|
|
|
|
|
}
|
2025-08-28 10:41:04 +02:00
|
|
|
};
|
|
|
|
|
|
2025-10-23 07:44:54 +02:00
|
|
|
const handlePauseBatch = async (batchId: string) => {
|
|
|
|
|
try {
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
await pauseBatch.mutateAsync({ tenantId, batchId });
|
|
|
|
|
refetchTimeline();
|
|
|
|
|
refetchHealth();
|
2025-10-23 07:44:54 +02:00
|
|
|
} catch (error) {
|
|
|
|
|
console.error('Error pausing batch:', error);
|
|
|
|
|
}
|
2025-09-19 16:17:04 +02:00
|
|
|
};
|
2025-08-28 10:41:04 +02:00
|
|
|
|
2025-11-27 07:33:54 +01:00
|
|
|
// Calculate configuration sections for setup flow
|
|
|
|
|
const setupSections = useMemo(() => {
|
|
|
|
|
// Create safe fallbacks for icons to prevent React error #310
|
|
|
|
|
const SafePackageIcon = Package;
|
|
|
|
|
const SafeUsersIcon = Users;
|
|
|
|
|
const SafeBookOpenIcon = BookOpen;
|
|
|
|
|
const SafeShieldIcon = Shield;
|
|
|
|
|
|
|
|
|
|
// Validate that all icons are properly imported before using them
|
|
|
|
|
const sections = [
|
|
|
|
|
{
|
|
|
|
|
id: 'inventory',
|
|
|
|
|
title: t('dashboard:config.inventory', 'Inventory'),
|
|
|
|
|
icon: SafePackageIcon,
|
|
|
|
|
path: '/app/database/inventory',
|
|
|
|
|
count: ingredients.length,
|
|
|
|
|
minimum: 3,
|
|
|
|
|
recommended: 10,
|
|
|
|
|
isComplete: ingredients.length >= 3,
|
|
|
|
|
description: t('dashboard:config.add_ingredients', 'Add at least {{count}} ingredients', { count: 3 }),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'suppliers',
|
|
|
|
|
title: t('dashboard:config.suppliers', 'Suppliers'),
|
|
|
|
|
icon: SafeUsersIcon,
|
|
|
|
|
path: '/app/database/suppliers',
|
|
|
|
|
count: suppliers.length,
|
|
|
|
|
minimum: 1,
|
|
|
|
|
recommended: 3,
|
|
|
|
|
isComplete: suppliers.length >= 1,
|
|
|
|
|
description: t('dashboard:config.add_supplier', 'Add your first supplier'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'recipes',
|
|
|
|
|
title: t('dashboard:config.recipes', 'Recipes'),
|
|
|
|
|
icon: SafeBookOpenIcon,
|
|
|
|
|
path: '/app/database/recipes',
|
|
|
|
|
count: recipes.length,
|
|
|
|
|
minimum: 1,
|
|
|
|
|
recommended: 3,
|
|
|
|
|
isComplete: recipes.length >= 1,
|
|
|
|
|
description: t('dashboard:config.add_recipe', 'Create your first recipe'),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
id: 'quality',
|
|
|
|
|
title: t('dashboard:config.quality', 'Quality Standards'),
|
|
|
|
|
icon: SafeShieldIcon,
|
|
|
|
|
path: '/app/operations/production/quality',
|
|
|
|
|
count: qualityTemplates.length,
|
|
|
|
|
minimum: 0,
|
|
|
|
|
recommended: 2,
|
|
|
|
|
isComplete: true, // Optional
|
|
|
|
|
description: t('dashboard:config.add_quality', 'Add quality checks (optional)'),
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return sections;
|
|
|
|
|
}, [ingredients.length, suppliers.length, recipes.length, qualityTemplates.length, t]);
|
|
|
|
|
|
|
|
|
|
// Calculate overall progress
|
|
|
|
|
const { completedSections, totalSections, progressPercentage, criticalMissing, recommendedMissing } = useMemo(() => {
|
2025-12-05 20:07:01 +01:00
|
|
|
// If data is still loading, use stored value as fallback to prevent flickering
|
|
|
|
|
if (loadingIngredients || loadingSuppliers || loadingRecipes || loadingQuality) {
|
|
|
|
|
return {
|
|
|
|
|
completedSections: 0,
|
|
|
|
|
totalSections: 4, // 4 required sections
|
|
|
|
|
progressPercentage: setupProgressFromStorage, // Use stored value during loading
|
|
|
|
|
criticalMissing: [],
|
|
|
|
|
recommendedMissing: [],
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-27 07:33:54 +01:00
|
|
|
// Guard against undefined or invalid setupSections
|
|
|
|
|
if (!setupSections || !Array.isArray(setupSections) || setupSections.length === 0) {
|
|
|
|
|
return {
|
|
|
|
|
completedSections: 0,
|
|
|
|
|
totalSections: 0,
|
|
|
|
|
progressPercentage: 100, // Default to 100% to avoid blocking dashboard
|
|
|
|
|
criticalMissing: [],
|
|
|
|
|
recommendedMissing: [],
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const requiredSections = setupSections.filter(s => s.id !== 'quality');
|
|
|
|
|
const completed = requiredSections.filter(s => s.isComplete).length;
|
|
|
|
|
const total = requiredSections.length;
|
|
|
|
|
const percentage = total > 0 ? Math.round((completed / total) * 100) : 100;
|
|
|
|
|
|
|
|
|
|
const critical = setupSections.filter(s => !s.isComplete && s.id !== 'quality');
|
|
|
|
|
const recommended = setupSections.filter(s => s.count < s.recommended);
|
|
|
|
|
|
2025-12-05 20:07:01 +01:00
|
|
|
// PHASE 1 OPTIMIZATION: Cache progress to localStorage for next page load
|
|
|
|
|
try {
|
|
|
|
|
localStorage.setItem(`setup_progress_${tenantId}`, percentage.toString());
|
|
|
|
|
} catch {
|
|
|
|
|
// Ignore storage errors
|
|
|
|
|
}
|
|
|
|
|
|
2025-11-27 07:33:54 +01:00
|
|
|
return {
|
|
|
|
|
completedSections: completed,
|
|
|
|
|
totalSections: total,
|
|
|
|
|
progressPercentage: percentage,
|
|
|
|
|
criticalMissing: critical,
|
|
|
|
|
recommendedMissing: recommended,
|
|
|
|
|
};
|
2025-12-05 20:07:01 +01:00
|
|
|
}, [setupSections, tenantId, loadingIngredients, loadingSuppliers, loadingRecipes, loadingQuality, setupProgressFromStorage]);
|
2025-11-27 07:33:54 +01:00
|
|
|
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
const handleRefreshAll = () => {
|
|
|
|
|
refetchHealth();
|
|
|
|
|
refetchOrchestration();
|
|
|
|
|
refetchActionQueue();
|
2025-11-27 07:33:54 +01:00
|
|
|
refetchExecutionProgress();
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
refetchTimeline();
|
|
|
|
|
refetchInsights();
|
2025-10-23 07:44:54 +02:00
|
|
|
};
|
2025-10-21 19:50:07 +02:00
|
|
|
|
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)
2025-11-09 08:40:01 +00:00
|
|
|
const handleAddWizardComplete = (itemType: ItemType, data?: any) => {
|
|
|
|
|
console.log('Item created:', itemType, data);
|
|
|
|
|
// Refetch relevant data based on what was added
|
|
|
|
|
handleRefreshAll();
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-16 22:13:52 +01:00
|
|
|
// Keyboard shortcut for Quick Add (Cmd/Ctrl + K)
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const handleKeyDown = (event: KeyboardEvent) => {
|
|
|
|
|
// Check for Cmd+K (Mac) or Ctrl+K (Windows/Linux)
|
|
|
|
|
if ((event.metaKey || event.ctrlKey) && event.key === 'k') {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
setIsAddWizardOpen(true);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
window.addEventListener('keydown', handleKeyDown);
|
|
|
|
|
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
|
|
|
}, []);
|
|
|
|
|
|
2025-11-27 07:33:54 +01:00
|
|
|
// Demo tour auto-start logic - using ref to prevent infinite loops
|
2025-11-12 15:34:10 +01:00
|
|
|
useEffect(() => {
|
2025-11-27 07:33:54 +01:00
|
|
|
// Only check tour start on initial render to prevent infinite loops
|
|
|
|
|
if (typeof window !== 'undefined') {
|
|
|
|
|
// Ensure we don't run this effect multiple times by checking a flag
|
|
|
|
|
const tourCheckDone = sessionStorage.getItem('dashboard_tour_check_done');
|
|
|
|
|
|
|
|
|
|
if (!tourCheckDone) {
|
|
|
|
|
sessionStorage.setItem('dashboard_tour_check_done', 'true');
|
|
|
|
|
|
|
|
|
|
console.log('[Dashboard] Demo mode:', isDemoMode);
|
|
|
|
|
const shouldStart = shouldStartTour();
|
|
|
|
|
console.log('[Dashboard] Should start tour:', shouldStart);
|
|
|
|
|
console.log('[Dashboard] SessionStorage demo_tour_should_start:', sessionStorage.getItem('demo_tour_should_start'));
|
|
|
|
|
console.log('[Dashboard] SessionStorage demo_tour_start_step:', sessionStorage.getItem('demo_tour_start_step'));
|
|
|
|
|
|
|
|
|
|
// Check if there's a tour intent from redirection (higher priority)
|
|
|
|
|
const shouldStartFromRedirect = sessionStorage.getItem('demo_tour_should_start') === 'true';
|
|
|
|
|
const redirectStartStep = parseInt(sessionStorage.getItem('demo_tour_start_step') || '0', 10);
|
|
|
|
|
|
|
|
|
|
if (isDemoMode && (shouldStart || shouldStartFromRedirect)) {
|
|
|
|
|
console.log('[Dashboard] Starting tour in 1.5s...');
|
|
|
|
|
const timer = setTimeout(() => {
|
|
|
|
|
console.log('[Dashboard] Executing startTour()');
|
|
|
|
|
if (shouldStartFromRedirect) {
|
|
|
|
|
// Start tour from the specific step that was intended
|
|
|
|
|
startTour(redirectStartStep);
|
|
|
|
|
// Clear the redirect intent
|
|
|
|
|
sessionStorage.removeItem('demo_tour_should_start');
|
|
|
|
|
sessionStorage.removeItem('demo_tour_start_step');
|
|
|
|
|
} else {
|
|
|
|
|
// Start tour normally (from beginning or resume)
|
|
|
|
|
startTour();
|
|
|
|
|
clearTourStartPending();
|
|
|
|
|
}
|
|
|
|
|
}, 1500);
|
|
|
|
|
|
|
|
|
|
return () => clearTimeout(timer);
|
2025-11-12 15:34:10 +01:00
|
|
|
}
|
2025-11-27 07:33:54 +01:00
|
|
|
}
|
2025-11-12 15:34:10 +01:00
|
|
|
}
|
2025-11-27 07:33:54 +01:00
|
|
|
}, [isDemoMode]); // Run only once after initial render
|
|
|
|
|
// Note: startTour removed from deps to prevent infinite loop - the effect guards with sessionStorage ensure it only runs once
|
2025-11-12 15:34:10 +01:00
|
|
|
|
2025-08-28 10:41:04 +02:00
|
|
|
return (
|
2025-11-27 15:52:40 +01:00
|
|
|
<div className="min-h-screen pb-20 md:pb-8 bg-[var(--bg-primary)]">
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
{/* Mobile-optimized container */}
|
|
|
|
|
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
|
|
|
|
|
{/* Header */}
|
|
|
|
|
<div className="flex items-center justify-between mb-6">
|
|
|
|
|
<div>
|
2025-11-27 15:52:40 +01:00
|
|
|
<h1 className="text-3xl md:text-4xl font-bold text-[var(--text-primary)]">{t('dashboard:title')}</h1>
|
|
|
|
|
<p className="mt-1 text-[var(--text-secondary)]">{t('dashboard:subtitle')}</p>
|
2025-10-21 19:50:07 +02:00
|
|
|
</div>
|
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)
2025-11-09 08:40:01 +00:00
|
|
|
|
|
|
|
|
{/* Action Buttons */}
|
|
|
|
|
<div className="flex items-center gap-3">
|
|
|
|
|
<button
|
|
|
|
|
onClick={handleRefreshAll}
|
2025-11-27 15:52:40 +01:00
|
|
|
className="flex items-center gap-2 px-4 py-2 rounded-lg font-semibold transition-colors duration-200 border border-[var(--border-primary)] bg-[var(--bg-primary)] text-[var(--text-secondary)]"
|
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)
2025-11-09 08:40:01 +00:00
|
|
|
>
|
|
|
|
|
<RefreshCw className="w-5 h-5" />
|
2025-11-13 16:01:08 +01:00
|
|
|
<span className="hidden sm:inline">{t('common:actions.refresh')}</span>
|
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)
2025-11-09 08:40:01 +00:00
|
|
|
</button>
|
|
|
|
|
|
2025-11-16 22:13:52 +01:00
|
|
|
{/* Unified Add Button with Keyboard Shortcut */}
|
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)
2025-11-09 08:40:01 +00:00
|
|
|
<button
|
|
|
|
|
onClick={() => setIsAddWizardOpen(true)}
|
2025-11-27 15:52:40 +01:00
|
|
|
className="group relative 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 bg-gradient-to-br from-[var(--color-primary)] to-[var(--color-primary-dark)] text-white"
|
2025-11-16 22:13:52 +01:00
|
|
|
title={`Quick Add (${navigator.platform.includes('Mac') ? 'Cmd' : 'Ctrl'}+K)`}
|
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)
2025-11-09 08:40:01 +00:00
|
|
|
>
|
|
|
|
|
<Plus className="w-5 h-5" />
|
2025-11-13 16:01:08 +01:00
|
|
|
<span className="hidden sm:inline">{t('common:actions.add')}</span>
|
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)
2025-11-09 08:40:01 +00:00
|
|
|
<Sparkles className="w-4 h-4 opacity-80" />
|
2025-11-16 22:13:52 +01:00
|
|
|
{/* Keyboard shortcut badge - shown on hover */}
|
2025-11-27 15:52:40 +01:00
|
|
|
<span className="hidden lg:flex absolute -bottom-8 left-1/2 -translate-x-1/2 items-center gap-1 px-2 py-1 rounded text-xs font-mono opacity-0 group-hover:opacity-100 transition-opacity duration-200 whitespace-nowrap pointer-events-none bg-[var(--bg-primary)] text-[var(--text-secondary)] shadow-sm">
|
|
|
|
|
<kbd className="px-1.5 py-0.5 rounded text-xs font-semibold bg-[var(--bg-tertiary)] border border-[var(--border-secondary)]">
|
2025-11-16 22:13:52 +01:00
|
|
|
{navigator.platform.includes('Mac') ? '⌘' : 'Ctrl'}
|
|
|
|
|
</kbd>
|
|
|
|
|
<span>+</span>
|
2025-11-27 15:52:40 +01:00
|
|
|
<kbd className="px-1.5 py-0.5 rounded text-xs font-semibold bg-[var(--bg-tertiary)] border border-[var(--border-secondary)]">
|
2025-11-16 22:13:52 +01:00
|
|
|
K
|
|
|
|
|
</kbd>
|
|
|
|
|
</span>
|
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)
2025-11-09 08:40:01 +00:00
|
|
|
</button>
|
|
|
|
|
</div>
|
2025-10-12 18:47:33 +02:00
|
|
|
</div>
|
2025-09-19 16:17:04 +02:00
|
|
|
|
2025-11-27 07:33:54 +01:00
|
|
|
{/* Setup Flow - Three States */}
|
2025-12-05 20:07:01 +01:00
|
|
|
{loadingIngredients || loadingSuppliers || loadingRecipes || loadingQuality || !isReady ? (
|
|
|
|
|
/* Loading state - only show spinner until first priority data (health) is ready */
|
2025-11-27 07:33:54 +01:00
|
|
|
<div className="flex items-center justify-center py-12">
|
|
|
|
|
<div className="animate-spin rounded-full h-12 w-12 border-b-2" style={{ borderColor: 'var(--color-primary)' }}></div>
|
2025-11-12 15:34:10 +01:00
|
|
|
</div>
|
2025-11-27 07:33:54 +01:00
|
|
|
) : progressPercentage < 50 ? (
|
|
|
|
|
/* STATE 1: Critical Missing (<50%) - Full-page blocker */
|
|
|
|
|
<SetupWizardBlocker
|
|
|
|
|
criticalSections={setupSections}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
/* STATE 2 & 3: Dashboard with optional banner */
|
|
|
|
|
<>
|
|
|
|
|
{/* Optional Setup Banner (50-99%) - Collapsible, Dismissible */}
|
|
|
|
|
{progressPercentage < 100 && recommendedMissing.length > 0 && (
|
|
|
|
|
<CollapsibleSetupBanner
|
|
|
|
|
remainingSections={recommendedMissing}
|
|
|
|
|
progressPercentage={progressPercentage}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{/* Main Dashboard Layout */}
|
|
|
|
|
<div className="space-y-6">
|
2025-12-05 20:07:01 +01:00
|
|
|
{/* SECTION 1: Glanceable Health Hero (Traffic Light) - PRIORITY 1 */}
|
2025-11-27 07:33:54 +01:00
|
|
|
<div data-tour="dashboard-stats">
|
2025-12-05 20:07:01 +01:00
|
|
|
{healthLoading ? (
|
|
|
|
|
<div className="bg-[var(--bg-primary)] rounded-lg border border-[var(--border-primary)] p-6 animate-pulse">
|
|
|
|
|
<div className="h-24 bg-[var(--bg-secondary)] rounded"></div>
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<GlanceableHealthHero
|
|
|
|
|
healthStatus={healthStatus!}
|
|
|
|
|
loading={false}
|
|
|
|
|
urgentActionCount={actionQueue?.urgentCount || 0}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2025-11-27 07:33:54 +01:00
|
|
|
</div>
|
|
|
|
|
|
2025-12-05 20:07:01 +01:00
|
|
|
{/* SECTION 2: What Needs Your Attention (Unified Action Queue) - PRIORITY 2 */}
|
2025-11-27 07:33:54 +01:00
|
|
|
<div data-tour="pending-po-approvals">
|
2025-12-05 20:07:01 +01:00
|
|
|
{actionQueueLoading ? (
|
|
|
|
|
<div className="bg-[var(--bg-primary)] rounded-lg border border-[var(--border-primary)] p-6 animate-pulse">
|
|
|
|
|
<div className="space-y-4">
|
|
|
|
|
<div className="h-8 bg-[var(--bg-secondary)] rounded w-1/3"></div>
|
|
|
|
|
<div className="h-32 bg-[var(--bg-secondary)] rounded"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<UnifiedActionQueueCard
|
|
|
|
|
actionQueue={actionQueue!}
|
|
|
|
|
loading={false}
|
|
|
|
|
tenantId={tenantId}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2025-11-27 07:33:54 +01:00
|
|
|
</div>
|
|
|
|
|
|
2025-12-05 20:07:01 +01:00
|
|
|
{/* SECTION 3: Execution Progress Tracker (Plan vs Actual) - PRIORITY 3 */}
|
2025-11-27 07:33:54 +01:00
|
|
|
<div data-tour="execution-progress">
|
2025-12-05 20:07:01 +01:00
|
|
|
{executionProgressLoading ? (
|
|
|
|
|
<div className="bg-[var(--bg-primary)] rounded-lg border border-[var(--border-primary)] p-6 animate-pulse">
|
|
|
|
|
<div className="space-y-4">
|
|
|
|
|
<div className="h-8 bg-[var(--bg-secondary)] rounded w-1/2"></div>
|
|
|
|
|
<div className="h-24 bg-[var(--bg-secondary)] rounded"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<ExecutionProgressTracker
|
|
|
|
|
progress={executionProgress}
|
|
|
|
|
loading={false}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
2025-11-27 07:33:54 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* SECTION 4: Intelligent System Summary - Unified AI Impact & Orchestration */}
|
|
|
|
|
<div data-tour="intelligent-system-summary">
|
|
|
|
|
<IntelligentSystemSummaryCard
|
2025-12-05 20:07:01 +01:00
|
|
|
orchestrationSummary={orchestrationSummary!}
|
2025-11-27 07:33:54 +01:00
|
|
|
orchestrationLoading={orchestrationLoading}
|
|
|
|
|
onWorkflowComplete={handleRefreshAll}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* SECTION 6: Quick Action Links */}
|
2025-11-27 15:52:40 +01:00
|
|
|
<div className="rounded-xl shadow-lg p-6 border border-[var(--border-primary)] bg-[var(--bg-primary)]">
|
|
|
|
|
<h2 className="text-xl font-bold mb-4 text-[var(--text-primary)]">{t('dashboard:sections.quick_actions')}</h2>
|
2025-11-27 07:33:54 +01:00
|
|
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => navigate('/app/operations/procurement')}
|
2025-11-27 15:52:40 +01:00
|
|
|
className="flex items-center justify-between p-4 rounded-lg transition-colors duration-200 group bg-[var(--bg-tertiary)] border-l-4 border-l-[var(--color-info)]"
|
2025-11-27 07:33:54 +01:00
|
|
|
>
|
2025-11-27 15:52:40 +01:00
|
|
|
<span className="font-semibold text-[var(--text-primary)]">{t('dashboard:quick_actions.view_orders')}</span>
|
|
|
|
|
<ExternalLink className="w-5 h-5 group-hover:translate-x-1 transition-transform duration-200 text-[var(--color-info)]" />
|
2025-11-27 07:33:54 +01:00
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => navigate('/app/operations/production')}
|
2025-11-27 15:52:40 +01:00
|
|
|
className="flex items-center justify-between p-4 rounded-lg transition-colors duration-200 group bg-[var(--bg-tertiary)] border-l-4 border-l-[var(--color-success)]"
|
2025-11-27 07:33:54 +01:00
|
|
|
>
|
2025-11-27 15:52:40 +01:00
|
|
|
<span className="font-semibold text-[var(--text-primary)]">{t('dashboard:quick_actions.view_production')}</span>
|
|
|
|
|
<ExternalLink className="w-5 h-5 group-hover:translate-x-1 transition-transform duration-200 text-[var(--color-success)]" />
|
2025-11-27 07:33:54 +01:00
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => navigate('/app/database/inventory')}
|
2025-11-27 15:52:40 +01:00
|
|
|
className="flex items-center justify-between p-4 rounded-lg transition-colors duration-200 group bg-[var(--bg-tertiary)] border-l-4 border-l-[var(--color-secondary)]"
|
2025-11-27 07:33:54 +01:00
|
|
|
>
|
2025-11-27 15:52:40 +01:00
|
|
|
<span className="font-semibold text-[var(--text-primary)]">{t('dashboard:quick_actions.view_inventory')}</span>
|
|
|
|
|
<ExternalLink className="w-5 h-5 group-hover:translate-x-1 transition-transform duration-200 text-[var(--color-secondary)]" />
|
2025-11-27 07:33:54 +01:00
|
|
|
</button>
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
onClick={() => navigate('/app/database/suppliers')}
|
2025-11-27 15:52:40 +01:00
|
|
|
className="flex items-center justify-between p-4 rounded-lg transition-colors duration-200 group bg-[var(--bg-tertiary)] border-l-4 border-l-[var(--color-warning)]"
|
2025-11-27 07:33:54 +01:00
|
|
|
>
|
2025-11-27 15:52:40 +01:00
|
|
|
<span className="font-semibold text-[var(--text-primary)]">{t('dashboard:quick_actions.view_suppliers')}</span>
|
|
|
|
|
<ExternalLink className="w-5 h-5 group-hover:translate-x-1 transition-transform duration-200 text-[var(--color-warning)]" />
|
2025-11-27 07:33:54 +01:00
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
</div>
|
2025-11-27 07:33:54 +01:00
|
|
|
</>
|
|
|
|
|
)}
|
2025-08-28 10:41:04 +02:00
|
|
|
</div>
|
2025-10-23 07:44:54 +02:00
|
|
|
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
{/* Mobile-friendly bottom padding */}
|
|
|
|
|
<div className="h-20 md:hidden"></div>
|
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)
2025-11-09 08:40:01 +00:00
|
|
|
|
|
|
|
|
{/* Unified Add Wizard */}
|
|
|
|
|
<UnifiedAddWizard
|
|
|
|
|
isOpen={isAddWizardOpen}
|
|
|
|
|
onClose={() => setIsAddWizardOpen(false)}
|
|
|
|
|
onComplete={handleAddWizardComplete}
|
|
|
|
|
/>
|
2025-11-15 21:21:06 +01:00
|
|
|
|
2025-11-19 21:01:06 +01:00
|
|
|
{/* Purchase Order Details Modal - Using Unified Component */}
|
2025-11-15 21:21:06 +01:00
|
|
|
{selectedPOId && (
|
2025-11-19 21:01:06 +01:00
|
|
|
<UnifiedPurchaseOrderModal
|
2025-11-15 21:21:06 +01:00
|
|
|
poId={selectedPOId}
|
|
|
|
|
tenantId={tenantId}
|
|
|
|
|
isOpen={isPOModalOpen}
|
2025-11-18 11:59:23 +01:00
|
|
|
initialMode={poModalMode}
|
2025-11-15 21:21:06 +01:00
|
|
|
onClose={() => {
|
|
|
|
|
setIsPOModalOpen(false);
|
|
|
|
|
setSelectedPOId(null);
|
2025-11-18 11:59:23 +01:00
|
|
|
setPOModalMode('view');
|
2025-11-18 07:17:17 +01:00
|
|
|
handleRefreshAll();
|
|
|
|
|
}}
|
2025-11-18 11:59:23 +01:00
|
|
|
onApprove={handleApprove}
|
2025-11-19 21:01:06 +01:00
|
|
|
onReject={handleReject}
|
|
|
|
|
showApprovalActions={true}
|
2025-11-18 07:17:17 +01:00
|
|
|
/>
|
|
|
|
|
)}
|
2025-08-28 10:41:04 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
feat: Complete JTBD-aligned bakery dashboard redesign
Implements comprehensive dashboard redesign based on Jobs To Be Done methodology
focused on answering: "What requires my attention right now?"
## Backend Implementation
### Dashboard Service (NEW)
- Health status calculation (green/yellow/red traffic light)
- Action queue prioritization (critical/important/normal)
- Orchestration summary with narrative format
- Production timeline transformation
- Insights calculation and consequence prediction
### API Endpoints (NEW)
- GET /dashboard/health-status - Overall bakery health indicator
- GET /dashboard/orchestration-summary - What system did automatically
- GET /dashboard/action-queue - Prioritized tasks requiring attention
- GET /dashboard/production-timeline - Today's production schedule
- GET /dashboard/insights - Key metrics (savings, inventory, waste, deliveries)
### Enhanced Models
- PurchaseOrder: Added reasoning, consequence, reasoning_data fields
- ProductionBatch: Added reasoning, reasoning_data fields
- Enables transparency into automation decisions
## Frontend Implementation
### API Hooks (NEW)
- useBakeryHealthStatus() - Real-time health monitoring
- useOrchestrationSummary() - System transparency
- useActionQueue() - Prioritized action management
- useProductionTimeline() - Production tracking
- useInsights() - Glanceable metrics
### Dashboard Components (NEW)
- HealthStatusCard: Traffic light indicator with checklist
- ActionQueueCard: Prioritized actions with reasoning/consequences
- OrchestrationSummaryCard: Narrative of what system did
- ProductionTimelineCard: Chronological production view
- InsightsGrid: 2x2 grid of key metrics
### Main Dashboard Page (REPLACED)
- Complete rewrite with mobile-first design
- All sections integrated with error handling
- Real-time refresh and quick action links
- Old dashboard backed up as DashboardPage.legacy.tsx
## Key Features
### Automation-First
- Shows what orchestrator did overnight
- Builds trust through transparency
- Explains reasoning for all automated decisions
### Action-Oriented
- Prioritizes tasks over information display
- Clear consequences for each action
- Large touch-friendly buttons
### Progressive Disclosure
- Shows 20% of info that matters 80% of time
- Expandable details when needed
- No overwhelming metrics
### Mobile-First
- One-handed operation
- Large touch targets (min 44px)
- Responsive grid layouts
### Trust-Building
- Narrative format ("I planned your day")
- Reasoning inputs transparency
- Clear status indicators
## User Segments Supported
1. Solo Bakery Owner (Primary)
- Simple health indicator
- Action checklist (max 3-5 items)
- Mobile-optimized
2. Multi-Location Owner
- Multi-tenant support (existing)
- Comparison capabilities
- Delegation ready
3. Enterprise/Central Bakery (Future)
- Network topology support
- Advanced analytics ready
## JTBD Analysis Delivered
Main Job: "Help me quickly understand bakery status and know what needs my intervention"
Emotional Jobs Addressed:
- Feel in control despite automation
- Reduce daily anxiety
- Feel competent with technology
- Trust system as safety net
Social Jobs Addressed:
- Demonstrate professional management
- Avoid being bottleneck
- Show sustainability
## Technical Stack
Backend: Python, FastAPI, SQLAlchemy, PostgreSQL
Frontend: React, TypeScript, TanStack Query, Tailwind CSS
Architecture: Microservices with circuit breakers
## Breaking Changes
- Complete dashboard page rewrite (old version backed up)
- New API endpoints require orchestrator service deployment
- Database migrations needed for reasoning fields
## Migration Required
Run migrations to add new model fields:
- purchase_orders: reasoning, consequence, reasoning_data
- production_batches: reasoning, reasoning_data
## Documentation
See DASHBOARD_REDESIGN_SUMMARY.md for complete implementation details,
JTBD analysis, success metrics, and deployment guide.
BREAKING CHANGE: Dashboard page completely redesigned with new data structures
2025-11-07 17:10:17 +00:00
|
|
|
}
|
2025-11-07 21:33:18 +00:00
|
|
|
|
2025-12-05 20:07:01 +01:00
|
|
|
/**
|
|
|
|
|
* Main Dashboard Page
|
|
|
|
|
* Conditionally renders either the Enterprise Dashboard or the Bakery Dashboard
|
|
|
|
|
* based on the user's subscription tier.
|
|
|
|
|
*/
|
|
|
|
|
export function DashboardPage() {
|
|
|
|
|
const { subscriptionInfo } = useSubscription();
|
|
|
|
|
const { currentTenant } = useTenant();
|
|
|
|
|
const { plan, loading } = subscriptionInfo;
|
|
|
|
|
const tenantId = currentTenant?.id;
|
|
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
|
return (
|
|
|
|
|
<div className="flex items-center justify-center min-h-screen">
|
|
|
|
|
<div className="animate-spin rounded-full h-12 w-12 border-b-2" style={{ borderColor: 'var(--color-primary)' }}></div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (plan === SUBSCRIPTION_TIERS.ENTERPRISE) {
|
|
|
|
|
return <EnterpriseDashboardPage tenantId={tenantId} />;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return <BakeryDashboard />;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default DashboardPage;
|