The Dashboard feature provides comprehensive overview of mess operations with real-time statistics and data summaries.
dashboard/
├── components/
│ ├── DashboardHeader.tsx # Page header
│ ├── StatsCard.tsx # Stat cards component
│ ├── MembersTable.tsx # Members summary table
│ ├── RecentActivities.tsx # Recent activities list
│ └── QuickStats.tsx # Quick statistics display
├── hooks/
│ └── useDashboard.ts # Custom hooks for data fetching
├── services/
│ └── dashboardService.ts # API calls
├── pages/
│ └── DashboardPage.tsx # Main dashboard page
└── README.md # This file
- System-wide statistics (users, messes, transactions)
- Recent messes list with pagination
- Top messes by activity
- Mess-specific summary
- Members with balances (paginated)
- Recent activities
- Quick stats cards
Displays a single statistic with icon and label
<StatsCard
title="Total Members"
value={8}
icon="Users"
trend="+2"
/>Paginated table of members with their balances
<MembersTable
members={members}
loading={isLoading}
onNextPage={() => {}}
/>List of recent meals, costs, and deposits
<RecentActivities
activities={activities}
loading={isLoading}
/>- Page loads with active mess context from messStore
- Hooks fetch dashboard data via API
- Data is displayed using shadcn UI components
- Real-time updates on deposit/meal additions
- Card - For stat cards and containers
- Table - For members and activities lists
- Badge - For status indicators
- Button - For actions
- Skeleton - For loading states
- Empty - For no data states
const { stats, members, activities, loading, error } = useDashboard();Fetches and caches dashboard data with automatic refetching.
- messStore - Get active mess context
- authStore - Get user role for conditional rendering
- API - Fetch dashboard data
- useUIStore - Show loading/error states