fix: Add proper TypeScript types to DashboardPage
This commit is contained in:
parent
5666970629
commit
15a6b08e0f
1 changed files with 21 additions and 4 deletions
|
|
@ -19,8 +19,25 @@ import { Card } from '../components/ui/card';
|
||||||
import { motion, AnimatePresence } from 'framer-motion';
|
import { motion, AnimatePresence } from 'framer-motion';
|
||||||
import { cn } from '../lib/utils';
|
import { cn } from '../lib/utils';
|
||||||
|
|
||||||
|
// Types
|
||||||
|
type RoomStatus = 'OK' | 'WARNING' | 'CRITICAL';
|
||||||
|
type RoomPhase = 'VEG' | 'FLOWER' | 'DRY' | 'CURE';
|
||||||
|
type Trend = 'up' | 'down' | 'stable';
|
||||||
|
|
||||||
|
interface Room {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
phase: RoomPhase;
|
||||||
|
status: RoomStatus;
|
||||||
|
strains: string[];
|
||||||
|
metrics: { temp: number; humidity: number; vpd: number; co2: number };
|
||||||
|
trend: Trend;
|
||||||
|
tasks: { due: number; completed: number };
|
||||||
|
issue?: string;
|
||||||
|
}
|
||||||
|
|
||||||
// Mock Data - separated by status for different display treatments
|
// Mock Data - separated by status for different display treatments
|
||||||
const MOCK_ROOMS = [
|
const MOCK_ROOMS: Room[] = [
|
||||||
{ id: '1', name: 'Flower Room A', phase: 'FLOWER', status: 'OK', strains: ['OG Kush', 'Gelato #41'], metrics: { temp: 78.4, humidity: 52, vpd: 1.25, co2: 1200 }, trend: 'stable', tasks: { due: 4, completed: 12 } },
|
{ id: '1', name: 'Flower Room A', phase: 'FLOWER', status: 'OK', strains: ['OG Kush', 'Gelato #41'], metrics: { temp: 78.4, humidity: 52, vpd: 1.25, co2: 1200 }, trend: 'stable', tasks: { due: 4, completed: 12 } },
|
||||||
{ id: '2', name: 'Flower Room B', phase: 'FLOWER', status: 'WARNING', strains: ['Blue Dream'], metrics: { temp: 82.1, humidity: 68, vpd: 1.10, co2: 1150 }, trend: 'up', tasks: { due: 8, completed: 5 }, issue: 'Humidity climbing' },
|
{ id: '2', name: 'Flower Room B', phase: 'FLOWER', status: 'WARNING', strains: ['Blue Dream'], metrics: { temp: 82.1, humidity: 68, vpd: 1.10, co2: 1150 }, trend: 'up', tasks: { due: 8, completed: 5 }, issue: 'Humidity climbing' },
|
||||||
{ id: '3', name: 'Veg Room 1', phase: 'VEG', status: 'OK', strains: ['Clones - Batch 402'], metrics: { temp: 76.2, humidity: 65, vpd: 0.85, co2: 800 }, trend: 'stable', tasks: { due: 2, completed: 20 } },
|
{ id: '3', name: 'Veg Room 1', phase: 'VEG', status: 'OK', strains: ['Clones - Batch 402'], metrics: { temp: 76.2, humidity: 65, vpd: 0.85, co2: 800 }, trend: 'stable', tasks: { due: 2, completed: 20 } },
|
||||||
|
|
@ -140,7 +157,7 @@ export default function DashboardPage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attention Card - Only for issues that need action
|
// Attention Card - Only for issues that need action
|
||||||
function AttentionCard({ room, severity }: { room: any, severity: 'critical' | 'warning' }) {
|
function AttentionCard({ room, severity }: { room: Room, severity: 'critical' | 'warning' }) {
|
||||||
const isCritical = severity === 'critical';
|
const isCritical = severity === 'critical';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -195,8 +212,8 @@ function AttentionCard({ room, severity }: { room: any, severity: 'critical' | '
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compact Row for All Systems table
|
// Compact Row for All Systems table
|
||||||
function RoomRow({ room, isExpanded, onToggle }: { room: any, isExpanded: boolean, onToggle: () => void }) {
|
function RoomRow({ room, isExpanded, onToggle }: { room: Room, isExpanded: boolean, onToggle: () => void }) {
|
||||||
const statusDot = {
|
const statusDot: Record<RoomStatus, string> = {
|
||||||
OK: 'bg-[var(--color-primary)]',
|
OK: 'bg-[var(--color-primary)]',
|
||||||
WARNING: 'bg-[var(--color-warning)]',
|
WARNING: 'bg-[var(--color-warning)]',
|
||||||
CRITICAL: 'bg-[var(--color-error)]'
|
CRITICAL: 'bg-[var(--color-error)]'
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue