A modern, responsive dashboard for real-time wet lab equipment emissions monitoring with comprehensive analytics and inventory management.
- Real-time Monitoring - Track COβ emissions, active equipment, efficiency scores, and energy consumption
- Interactive Charts - Visualize monthly emissions trends and top equipment by emissions
- Predictive Alerts - Get notified about maintenance needs and optimization opportunities
- Month-over-Month Analytics - Compare current and previous month metrics with percentage changes
- List/Grid View Toggle - Switch between 3-column responsive grid and sortable table views
- Equipment Search - Filter by name, type, manufacturer, or equipment ID
- Faulty Equipment Tracking - Visual indicators with error messages for equipment needing maintenance
- Color-Coded Status Badges - Active π’ | Idle π‘ | Maintenance π | Offline β« | Faulty π΄
- Sortable Columns - Click headers to sort any equipment attribute
- Persistent Preferences - Remember view preference across sessions
- Time Range Selection - Toggle between Week, Month, or Year views
- Dual Metrics Tracking - Monitor emissions (π line chart) and consumption (π bar chart)
- Smart Unit Scaling - Auto-converts MWh/kWh and tCOβe/kgCOβe based on magnitude
- Daily Data Points - Month view shows 30 individual days for granular analysis
- Comprehensive Statistics - Totals and averages with context-aware formatting
- Internal Database - Centralized data store with observer pattern for reactive updates
- Time Series Aggregation - 90 days of historical data with daily, weekly, and monthly aggregates
- Realistic Mock Data - Historical data generation with:
- π Weekend/weekday variations (30% reduction on weekends)
- π Seasonal trends (10% growth over 90 days)
- π² Natural daily fluctuations (Β±15% variation)
- Data Consistency - Dashboard and Analytics use unified time series source
- Dark Theme - Professional dark UI, easy on the eyes
- Responsive Design - Perfect on desktop π», tablet π±, and mobile π±
- Real-time Sync - Manual sync button with loading states
- Error Handling - Graceful error messages with retry functionality
| Technology | Purpose | Version |
|---|---|---|
| React | UI Framework | 18 |
| TypeScript | Type Safety | 5.0+ |
| Vite | Build Tool | 5.4+ |
| Tailwind CSS | Styling | 3.0+ |
| Recharts | Data Visualization | Latest |
| React Router | Navigation | v6 |
| @tanstack/react-table | Table Functionality | Latest |
| Lucide React | Icons | Latest |
- Node.js 16+
- npm or yarn
# 1οΈβ£ Clone the repository
git clone https://github.com/BrandeisPatrick/co2ai-frontend.git
cd co2ai-frontend
# 2οΈβ£ Install dependencies
npm install
# 3οΈβ£ Start development server
npm run dev
# 4οΈβ£ Open in browser
# Visit http://localhost:5173# Start development server with hot reload
npm run dev
# Build for production
npm run build
# Preview production build locally
npm run preview
# Run ESLint and type checking
npm run lintsrc/
βββ π components/
β βββ π dashboard/
β β βββ StatCard.tsx # KPI metric cards
β β βββ MonthlyEmissionsTrend.tsx # Trend line chart
β β βββ TopEquipmentChart.tsx # Top 5 equipment bar chart
β β βββ PredictiveAlerts.tsx # Alert cards
β βββ π§ equipment/
β β βββ EquipmentCard.tsx # Grid view card component
β β βββ EquipmentTable.tsx # List view table (@tanstack/react-table)
β β βββ ViewToggle.tsx # Grid/List toggle buttons
β βββ π¨ layout/
β βββ Sidebar.tsx # Navigation sidebar
β βββ DashboardLayout.tsx # Main layout wrapper
βββ π pages/
β βββ Dashboard.tsx # Dashboard page
β βββ EquipmentInventory.tsx # Equipment inventory page
β βββ Analytics.tsx # Analytics page
βββ π services/
β βββ api.ts # Mock API & equipment data
β βββ dataStore.ts # Internal database with observer pattern
β βββ mockTimeSeriesDb.ts # 90-day historical data generation
βββ π― hooks/
β βββ useDataContext.ts # Custom hook for data access
βββ π utils/
β βββ timeSeriesHelpers.ts # Time series calculations & formatting
βββ π contexts/
β βββ DataContext.tsx # Global data context provider
βββ π¨ types/
β βββ index.ts # TypeScript interfaces
βββ App.tsx # App component with routing
βββ main.tsx # React entry point
βββ index.css # Global Tailwind CSS
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β React Components β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Dashboard β β Equipment β β Analytics β β
β β β β Inventory β β β β
β ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
βββββββββββΌβββββββββββββββββββΌβββββββββββββββββββΌββββββββββ
β β β
ββββββββββββ¬ββββββββ΄βββββββββββ¬ββββββββ
β β
ββββββββββββΌβββββββββββββββββββΌβββββββββ
β DataContext Provider β
β (Global State Management) β
ββββββββββββ¬ββββββββββββββββββββββββββββ
β
ββββββββββββΌβββββββββββββββββββββββββββ
β InternalDatabase (DataStore) β
β β’ Observer Pattern β
β β’ Equipment State β
β β’ Historical Data β
ββββββββββββ¬ββββββββββββββββββββββββββββ
β
ββββββββββββΌβββββββββββββββββββββββββββ
β MockTimeSeriesDatabase β
β β’ 90 days of history β
β β’ Daily aggregates β
β β’ Realistic variations β
ββββββββββββ¬ββββββββββββββββββββββββββββ
β
ββββββββββββΌβββββββββββββββββββββββββββ
β Equipment Data (Mock API) β
β β’ 12 lab equipment items β
β β’ Faulty equipment tracking β
βββββββββββββββββββββββββββββββββββββββ
API/JSONBin
β
Equipment Data
β
DataStore (InternalDatabase)
βββ Equipment List (12 items)
βββ MockTimeSeriesDb
βββ 90 days of snapshots
βββ Daily Aggregates (30 days)
βββ Weekly Aggregates (12 weeks)
βββ Monthly Aggregates (12 months)
β
DataContext (Global State)
βββ Dashboard (derives metrics)
βββ Equipment Inventory (filters/sorts)
βββ Analytics (time series visualization)
- Toggle between responsive grid and sortable table views
- localStorage persistence of user preference
- Faulty equipment visual indicators
- Search functionality in both views
- Status: β¨ Complete & Production Ready
- Unified data calculation across Dashboard and Analytics
- Fixed metric discrepancies (Dashboard vs Analytics)
- Smart unit formatting (auto-scaling MWh/kWh)
- Consistent month-over-month comparisons
- Status: β¨ Complete & Production Ready
| Status | Color | Meaning |
|---|---|---|
| Active | π’ Green | Equipment is operational |
| Idle | π‘ Yellow | Equipment is available but not in use |
| Maintenance | π Orange | Equipment requires scheduled maintenance |
| Offline | β« Gray | Equipment is not connected/powered off |
| Faulty | π΄ Red | Equipment has errors and needs attention |
The application includes 12 mock lab equipment items:
| Equipment | Type | Power Draw | Daily Emissions | Status |
|---|---|---|---|---|
| ULT Freezer #1 | Ultra-Low Freezer | 2.5 kW | 85 kg | π’ Active |
| ULT Freezer #2 | Ultra-Low Freezer | 2.4 kW | 82 kg | π’ Active |
| COβ Incubator Pro | CO2 Incubator | 0.8 kW | 28 kg | π’ Active |
| Autoclave #4 | Autoclave | 3.2 kW | 110 kg | π΄ Faulty |
| PCR Thermal Cycler | PCR Machine | 1.2 kW | 41 kg | π’ Active |
| Centrifuge Unit | Centrifuge | 2.1 kW | 72 kg | π‘ Idle |
| UV-Vis Spectro #8 | Spectrophotometer | 0.5 kW | 17 kg | π΄ Faulty |
| ...and 5 more items | - | - | - | - |
Edit tailwind.config.js:
colors: {
primary: '#your-color',
secondary: '#your-color'
}Update components in src/components/dashboard/ and src/pages/Analytics.tsx
Edit src/components/layout/Sidebar.tsx to add/remove menu items
# Build optimized production bundle
npm run build
# Output files in dist/ directory
# Ready for deployment to:
# β’ Vercel
# β’ Netlify
# β’ AWS S3 + CloudFront
# β’ Any static hosting service- Bundle Size: ~671 KB (minified)
- Gzip Size: ~189 KB
- Assets: CSS, JS, HTML optimized
- TypeScript: Full type checking included
- β Type Safety: 100% TypeScript coverage
- β Dark Mode: Reduces eye strain
- β Responsive: Mobile-first design
- β Optimized: Code-splitting ready
- β Error Handling: Graceful fallbacks
- β Lazy Loading: Components load on demand
- FEATURE 2: Remove API Integrations page
- FEATURE 3: Reports page with CSV/PDF exports
- FEATURE 4: Enhanced Analytics with drill-down views
- Phase 2: AI/ML features (requires infrastructure)
- Real-time data updates via WebSockets
- User authentication & role-based access
MIT Β© 2024 CO2AI
# Node.js version
node --version # 16.0.0 or higher
# Install dependencies
npm install
# Start with hot reload
npm run dev
# Open http://localhost:5173# Run TypeScript compiler
npm run build # Includes type checking via tscFor issues, feature requests, or questions:
- Check existing GitHub issues
- Create a new issue with detailed information
- Include screenshots or error messages
Made with β€οΈ for sustainable computing π