Files
bakery-ia/frontend/src/components/dashboard/ActionQueueCard.tsx

274 lines
9.2 KiB
TypeScript
Raw Normal View History

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
// ================================================================
// frontend/src/components/dashboard/ActionQueueCard.tsx
// ================================================================
/**
* Action Queue Card - What needs your attention right now
*
* Prioritized list of actions the user needs to take, with context
* about why each action is needed and what happens if they don't do it.
*/
import React, { useState } from 'react';
import {
FileText,
AlertCircle,
CheckCircle2,
Eye,
Edit,
Clock,
Euro,
ChevronDown,
ChevronUp,
} from 'lucide-react';
import { ActionItem, ActionQueue } from '../../api/hooks/newDashboard';
import { useReasoningFormatter } from '../../hooks/useReasoningTranslation';
import { useTranslation } from 'react-i18next';
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
interface ActionQueueCardProps {
actionQueue: ActionQueue;
loading?: boolean;
onApprove?: (actionId: string) => void;
onViewDetails?: (actionId: string) => void;
onModify?: (actionId: string) => void;
}
const urgencyConfig = {
critical: {
bg: 'bg-red-50',
border: 'border-red-300',
badge: 'bg-red-100 text-red-800',
icon: AlertCircle,
},
important: {
bg: 'bg-amber-50',
border: 'border-amber-300',
badge: 'bg-amber-100 text-amber-800',
icon: AlertCircle,
},
normal: {
bg: 'bg-blue-50',
border: 'border-blue-300',
badge: 'bg-blue-100 text-blue-800',
icon: FileText,
},
};
function ActionItemCard({
action,
onApprove,
onViewDetails,
onModify,
}: {
action: ActionItem;
onApprove?: (id: string) => void;
onViewDetails?: (id: string) => void;
onModify?: (id: string) => void;
}) {
const [expanded, setExpanded] = useState(false);
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
const config = urgencyConfig[action.urgency as keyof typeof urgencyConfig] || urgencyConfig.normal;
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 UrgencyIcon = config.icon;
const { formatPOAction } = useReasoningFormatter();
const { t } = useTranslation('reasoning');
// Translate reasoning_data (or fallback to deprecated text fields)
const { reasoning, consequence, severity } = action.reasoning_data
? formatPOAction(action.reasoning_data)
: { reasoning: action.reasoning || '', consequence: action.consequence || '', severity: '' };
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
return (
<div
className={`${config.bg} ${config.border} border-2 rounded-lg p-4 md:p-5 transition-all duration-200 hover:shadow-md`}
>
{/* Header */}
<div className="flex items-start gap-3 mb-3">
<UrgencyIcon className={`w-6 h-6 flex-shrink-0 ${config.badge.split(' ')[1]}`} />
<div className="flex-1 min-w-0">
<div className="flex items-start justify-between gap-2 mb-1">
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
<h3 className="font-bold text-lg">{action.title || 'Action Required'}</h3>
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
<span className={`${config.badge} px-2 py-1 rounded text-xs font-semibold uppercase flex-shrink-0`}>
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
{action.urgency || 'normal'}
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
</span>
</div>
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
<p className="text-sm text-gray-600">{action.subtitle || ''}</p>
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>
</div>
{/* Amount (for POs) */}
{action.amount && (
<div className="flex items-center gap-2 mb-3 text-lg font-bold">
<Euro className="w-5 h-5" />
<span>
{action.amount.toFixed(2)} {action.currency}
</span>
</div>
)}
{/* Reasoning (always visible) */}
<div className="bg-white rounded-md p-3 mb-3">
<p className="text-sm font-medium text-gray-700 mb-1">
{t('jtbd.action_queue.why_needed')}
</p>
<p className="text-sm text-gray-600">{reasoning}</p>
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>
{/* Consequence (expandable) */}
{consequence && (
<>
<button
onClick={() => setExpanded(!expanded)}
className="flex items-center gap-2 text-sm text-gray-600 hover:text-gray-900 transition-colors mb-3 w-full"
>
{expanded ? <ChevronUp className="w-4 h-4" /> : <ChevronDown className="w-4 h-4" />}
<span className="font-medium">{t('jtbd.action_queue.what_if_not')}</span>
</button>
{expanded && (
<div className="bg-amber-50 border border-amber-200 rounded-md p-3 mb-3">
<p className="text-sm text-amber-900">{consequence}</p>
{severity && (
<span className="text-xs font-semibold text-amber-900 mt-1 block">
{severity}
</span>
)}
</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
)}
{/* Time Estimate */}
<div className="flex items-center gap-2 text-xs text-gray-500 mb-4">
<Clock className="w-4 h-4" />
<span>
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
{t('jtbd.action_queue.estimated_time')}: {action.estimatedTimeMinutes || 5} min
</span>
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>
{/* Action Buttons */}
<div className="flex flex-wrap gap-2">
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
{(action.actions || []).map((button, index) => {
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 buttonStyles = {
primary: 'bg-blue-600 hover:bg-blue-700 text-white',
secondary: 'bg-gray-200 hover:bg-gray-300 text-gray-800',
tertiary: 'bg-white hover:bg-gray-50 text-gray-700 border border-gray-300',
};
const handleClick = () => {
if (button.action === 'approve' && onApprove) {
onApprove(action.id);
} else if (button.action === 'view_details' && onViewDetails) {
onViewDetails(action.id);
} else if (button.action === 'modify' && onModify) {
onModify(action.id);
}
};
return (
<button
key={index}
onClick={handleClick}
className={`${buttonStyles[button.type]} px-4 py-2 rounded-lg font-semibold text-sm transition-colors duration-200 flex items-center gap-2 min-h-[44px]`}
>
{button.action === 'approve' && <CheckCircle2 className="w-4 h-4" />}
{button.action === 'view_details' && <Eye className="w-4 h-4" />}
{button.action === 'modify' && <Edit className="w-4 h-4" />}
{button.label}
</button>
);
})}
</div>
</div>
);
}
export function ActionQueueCard({
actionQueue,
loading,
onApprove,
onViewDetails,
onModify,
}: ActionQueueCardProps) {
const [showAll, setShowAll] = useState(false);
const { t } = useTranslation('reasoning');
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
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
if (loading || !actionQueue) {
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
return (
<div className="bg-white rounded-xl shadow-md p-6">
<div className="animate-pulse space-y-4">
<div className="h-6 bg-gray-200 rounded w-1/2"></div>
<div className="h-32 bg-gray-200 rounded"></div>
<div className="h-32 bg-gray-200 rounded"></div>
</div>
</div>
);
}
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
if (!actionQueue.actions || actionQueue.actions.length === 0) {
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
return (
<div className="bg-green-50 border-2 border-green-200 rounded-xl p-8 text-center">
<CheckCircle2 className="w-16 h-16 text-green-600 mx-auto mb-4" />
<h3 className="text-xl font-bold text-green-900 mb-2">
{t('jtbd.action_queue.all_caught_up')}
</h3>
<p className="text-green-700">{t('jtbd.action_queue.no_actions')}</p>
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>
);
}
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
const displayedActions = showAll ? actionQueue.actions : actionQueue.actions.slice(0, 3);
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
return (
<div className="bg-white rounded-xl shadow-md p-6">
{/* Header */}
<div className="flex items-center justify-between mb-6">
<h2 className="text-2xl font-bold text-gray-900">{t('jtbd.action_queue.title')}</h2>
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
{(actionQueue.totalActions || 0) > 3 && (
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
<span className="bg-red-100 text-red-800 px-3 py-1 rounded-full text-sm font-semibold">
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
{actionQueue.totalActions || 0} {t('jtbd.action_queue.total')}
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
</span>
)}
</div>
{/* Summary Badges */}
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
{((actionQueue.criticalCount || 0) > 0 || (actionQueue.importantCount || 0) > 0) && (
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 className="flex flex-wrap gap-2 mb-6">
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
{(actionQueue.criticalCount || 0) > 0 && (
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
<span className="bg-red-100 text-red-800 px-3 py-1 rounded-full text-sm font-semibold">
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
{actionQueue.criticalCount || 0} {t('jtbd.action_queue.critical')}
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
</span>
)}
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
{(actionQueue.importantCount || 0) > 0 && (
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
<span className="bg-amber-100 text-amber-800 px-3 py-1 rounded-full text-sm font-semibold">
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
{actionQueue.importantCount || 0} {t('jtbd.action_queue.important')}
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
</span>
)}
</div>
)}
{/* Action Items */}
<div className="space-y-4">
{displayedActions.map((action) => (
<ActionItemCard
key={action.id}
action={action}
onApprove={onApprove}
onViewDetails={onViewDetails}
onModify={onModify}
/>
))}
</div>
{/* Show More/Less */}
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
{(actionQueue.totalActions || 0) > 3 && (
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
<button
onClick={() => setShowAll(!showAll)}
className="w-full mt-4 py-3 bg-gray-100 hover:bg-gray-200 rounded-lg font-semibold text-gray-700 transition-colors duration-200"
>
{showAll
? t('jtbd.action_queue.show_less')
fix: Add comprehensive null guards to all dashboard components This commit fixes React Error #306 (text content mismatch) by ensuring no component ever tries to render undefined values as text content. Changes made across all dashboard components: 1. **Component Entry Guards**: - Added early returns for null/undefined data - Changed `if (loading)` to `if (loading || !data)` pattern - Components now show loading skeleton when data is undefined 2. **Property Access Guards**: - Added `|| fallback` operators for all rendered text - Added optional chaining for nested property access - Added conditional rendering for optional/array fields 3. **Specific Component Fixes**: **HealthStatusCard.tsx**: - Added early return for !healthStatus - Added fallback for status: `healthStatus.status || 'green'` - Added conditional rendering for nextScheduledRun - Added conditional rendering for checklistItems array - Added text fallback: `item.text || ''` **InsightsGrid.tsx**: - Added null check: `if (!insights || !insights.savings || ...)` - Added fallbacks: `insights.savings?.label || 'Savings'` - Added fallbacks for all 4 insight cards **OrchestrationSummaryCard.tsx**: - Added early return for !summary - Added fallback: `summary.message || ''` - Added fallback: `summary.runNumber || 0` - Added array checks: `summary.purchaseOrdersSummary && ...` - Added fallbacks for PO items: `po.supplierName || 'Unknown Supplier'` - Added fallbacks for batch items: `batch.quantity || 0` - Added safe date parsing: `batch.readyByTime ? new Date(...) : 'TBD'` **ProductionTimelineCard.tsx**: - Added early return for !timeline - Added array check: `!timeline.timeline || timeline.timeline.length === 0` - Added fallbacks for all item properties: - `item.statusIcon || '🔵'` - `item.productName || 'Product'` - `item.quantity || 0` - `item.unit || 'units'` - `item.batchNumber || 'N/A'` - `item.priority || 'NORMAL'` - `item.statusText || 'Status'` - `item.progress || 0` **ActionQueueCard.tsx**: - Added early return for !actionQueue - Added safe config lookup with fallback to normal urgency - Added array check: `!actionQueue.actions || ...` - Added property fallbacks: - `action.title || 'Action Required'` - `action.urgency || 'normal'` - `action.subtitle || ''` - `action.estimatedTimeMinutes || 5` - Added array guard: `(action.actions || []).map(...)` - Added fallbacks for counts: `actionQueue.totalActions || 0` **useReasoningTranslation.ts**: - Enhanced formatPOAction with explicit fallbacks - Enhanced formatBatchAction with explicit fallbacks - All translation functions return strings with || operators **DashboardPage.tsx**: - Removed conditional rendering operators (&&) - Components now always render and handle their own null states - Pattern: `<Component data={data} loading={loading} />` 4. **Testing Strategy**: - All components gracefully handle undefined data - Loading states shown when data is undefined - No undefined values can be rendered as text content - Multiple fallback layers ensure strings are always returned This comprehensive fix addresses the root cause of React Error #306 by making all components bulletproof against undefined values.
2025-11-07 20:15:29 +00:00
: t('jtbd.action_queue.show_more', { count: (actionQueue.totalActions || 3) - 3 })}
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
</button>
)}
</div>
);
}