diff --git a/src/components/EnergyCharts.jsx b/src/components/EnergyCharts.jsx index aafd3a7..83d9238 100644 --- a/src/components/EnergyCharts.jsx +++ b/src/components/EnergyCharts.jsx @@ -50,21 +50,6 @@ const EnergyCharts = () => { return (
{/* Real-time Energy Consumption */} -
-

Real-time Energy Overview

-
-
-

Current Consumption

-

{state.energyConsumption} W

-
-
-

Battery Level

-

{state.batteryLevel}%

-
-
-

Temperature

-

{state.temperature}°C

-
{ exit={{ x: -320 }} transition={{ type: 'spring', damping: 30, stiffness: 300 }} className="fixed left-0 top-0 h-full w-64 bg-white shadow-xl z-40 lg:z-auto" + role="navigation" + aria-label="Primary" >
diff --git a/src/components/NotificationList.jsx b/src/components/NotificationList.jsx index f6c75e1..81c3b9c 100644 --- a/src/components/NotificationList.jsx +++ b/src/components/NotificationList.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { motion, AnimatePresence } from 'framer-motion'; +import { AnimatePresence, motion as Motion } from 'framer-motion'; import { useNotification } from '../context/NotificationContext'; import { formatTime, formatDate } from '../utils/format'; @@ -41,10 +41,10 @@ const NotificationList = () => { )}
-
+
{notifications.map((notification, index) => ( - { ✕
- + ))} diff --git a/src/components/StatusCard.jsx b/src/components/StatusCard.jsx index 686ff89..a96dadf 100644 --- a/src/components/StatusCard.jsx +++ b/src/components/StatusCard.jsx @@ -2,7 +2,7 @@ import React from 'react'; import { motion } from 'framer-motion'; import { useApp } from '../context/AppContext'; -const StatusCard = ({ title, value, subtitle, icon, color, onClick }) => { +const StatusCard = ({ title, value: propValue, subtitle: propSubtitle, icon, color: propColor, onClick }) => { const { state } = useApp(); const getStatusColor = () => { @@ -38,6 +38,11 @@ const StatusCard = ({ title, value, subtitle, icon, color, onClick }) => { const warningLevel = getWarningLevel(); + // Build derived values without mutating props + let value = propValue; + let subtitle = propSubtitle; + let color = propColor || 'status-offline'; + if (title === 'Inverter Status') { value = `${getStatusIcon()} ${state.inverterStatus.toUpperCase()}`; color = getStatusColor(); @@ -77,11 +82,24 @@ const StatusCard = ({ title, value, subtitle, icon, color, onClick }) => { } } + if (title === 'Energy Usage') { + value = `${state.energyConsumption}W`; + if (state.energyConsumption > 500) { + subtitle = 'High consumption'; + color = 'status-warning-battery'; + } else if (state.energyConsumption > 300) { + subtitle = 'Moderate consumption'; + color = 'status-standby'; + } else { + subtitle = 'Low consumption'; + color = 'status-online'; + } + } + return ( { role="region" aria-label="System status cards" > - - - - + + + + {/* Energy Usage Card - Separate row for better mobile layout */} @@ -82,10 +82,7 @@ const Dashboard = () => { >