Dashboard Overview
The Dashboard provides a comprehensive view of farm operations:Production Metrics
Monthly cheese, milk, waste, and cost statistics
Historical Comparison
Month-over-month trend analysis
Daily Production Log
Recent batch production entries
TamboEngine Alerts
AI-generated production alerts
StatCard Component
Displays key performance indicators with trend comparisons.File Location
Props Interface
Implementation
StatCard.tsx
Usage Example
Dashboard.tsx
apps/frontend/src/pages/Dashboard.tsx:36
Features
- Loading Skeletons: Shows skeleton UI while data is loading
- Number Formatting: Uses
toLocaleString('es-AR')for Spanish formatting - Currency Support: Special handling for currency units ($ prefix)
- Trend Arrows: Visual up/down indicators
- No Data State: Shows alert icon when trend data is unavailable
AlertCard Component
Displays TamboEngine alerts with action buttons.File Location
Props Interface
Alert Type Definition
alerts.ts
Implementation
AlertCard.tsx
Features
- Date Formatting: Displays month and year in Spanish
- Quick Actions: Direct links to alert details and batch details
- Icon Integration: Uses Lucide icons for visual context
- Responsive Layout: Buttons stack on mobile, side-by-side on desktop
AlertsSection Component
Container for multiple AlertCards displayed in the Dashboard sidebar.File Location
Usage
Dashboard.tsx
Card Components (Base)
All dashboard components use base card components:File Location
Available Components
Basic Structure
Skeleton Component
Shows loading placeholders for better perceived performance.File Location
Usage
Dashboard Data Hooks
useCurrentMonth
Fetches current month statistics with previous month comparison.apps/frontend/src/hooks/dashboard/useCurrentMonth.ts
useGraph
Fetches historical data for charts and graphs. Location:apps/frontend/src/hooks/dashboard/useGraph.ts
Dashboard Layout
The Dashboard uses a responsive grid layout:Dashboard.tsx
apps/frontend/src/pages/Dashboard.tsx
Responsive Breakpoints
- Mobile (< 640px): Single column, stacked cards
- Tablet (640px - 1023px): 2-column stat grid
- Desktop (1024px+): 4-column stat grid with sidebar
Styling Conventions
Color Palette
Typography
Best Practices
Always show loading states
Use Skeleton components while data is fetching
Handle missing data gracefully
Show “Sin datos suficientes” when trend data is unavailable
Format numbers consistently
Use
toLocaleString('es-AR') for Spanish number formattingMake cards responsive
Test all components at mobile, tablet, and desktop sizes
Related Documentation
React Query Hooks
Learn about data fetching with TanStack Query
Layout System
Understand how Dashboard fits into the layout
Card Components
Reusable Card primitives
TypeScript Types
Type definitions for dashboard data
