diff --git a/src/components/Navbar.js b/src/components/Navbar.js
new file mode 100644
index 0000000..519bd8d
--- /dev/null
+++ b/src/components/Navbar.js
@@ -0,0 +1,20 @@
+import { LastRefresh } from './LastRefresh'
+
+export function Navbar({ lastUpdateTime }) {
+ return (
+
+ )
+}
\ No newline at end of file
diff --git a/src/components/SolarChart.js b/src/components/SolarChart.js
index 4a983f5..b5a6fd3 100644
--- a/src/components/SolarChart.js
+++ b/src/components/SolarChart.js
@@ -2,9 +2,7 @@ import { Card } from '@/components/ui/card'
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Legend } from 'recharts'
import { useState } from 'react'
-export function SolarChart({ data, type }) {
- const [interval, setInterval] = useState('today')
-
+export function SolarChart({ data, type, timeRange, onTimeRangeChange }) {
const getFilteredData = (data) => {
const now = new Date()
const startOfDay = new Date(now.getFullYear(), now.getMonth(), now.getDate())
@@ -16,7 +14,7 @@ export function SolarChart({ data, type }) {
startOfMonth.setMonth(startOfDay.getMonth() - 1)
let startTime
- switch (interval) {
+ switch (timeRange) {
case 'today':
startTime = startOfDay
break
@@ -92,9 +90,12 @@ export function SolarChart({ data, type }) {
case 'battery':
return {
lines: [
- { key: 'batteryLevel', name: 'Battery Level (%)', color: '#10B981' },
- { key: 'batteryVoltage', name: 'Battery Voltage (V)', color: '#3B82F6' },
- { key: 'batteryVoltageFromScc', name: 'SCC Battery Voltage (V)', color: '#8B5CF6' },
+ { key: 'batteryVoltage', name: 'Battery Voltage (V)', color: '#3B82F6' }
+ ]
+ }
+ case 'current':
+ return {
+ lines: [
{ key: 'chargingCurrent', name: 'Charging Current (A)', color: '#F59E0B' },
{ key: 'batteryDischargeCurrent', name: 'Discharge Current (A)', color: '#EF4444' }
]
@@ -102,10 +103,11 @@ export function SolarChart({ data, type }) {
case 'voltage':
return {
lines: [
+ { key: 'batteryVoltage', name: 'Battery Voltage (V)', color: '#3B82F6' },
{ key: 'pvInputVoltage', name: 'PV Input Voltage (V)', color: '#10B981' },
- { key: 'acInputVoltage', name: 'AC Input Voltage (V)', color: '#3B82F6' },
- { key: 'acOutputVoltage', name: 'AC Output Voltage (V)', color: '#8B5CF6' },
- { key: 'busVoltage', name: 'Bus Voltage (V)', color: '#F59E0B' }
+ { key: 'acInputVoltage', name: 'AC Input Voltage (V)', color: '#8B5CF6' },
+ { key: 'acOutputVoltage', name: 'AC Output Voltage (V)', color: '#F59E0B' },
+ { key: 'busVoltage', name: 'Bus Voltage (V)', color: '#EF4444' }
]
}
case 'temperature':
@@ -128,12 +130,12 @@ export function SolarChart({ data, type }) {
switch(type) {
case 'power':
return 'Power Statistics'
- case 'battery':
- return 'Battery Statistics'
+ case 'current':
+ return 'Battery Current'
case 'voltage':
- return 'Voltage Statistics'
+ return 'System Voltage'
case 'temperature':
- return 'Temperature Statistics'
+ return 'Temp Stats'
default:
return 'Statistics'
}
@@ -145,41 +147,41 @@ export function SolarChart({ data, type }) {
{getChartTitle()}