refactor: remove RefreshCw icon and unused BMS refresh functionality from battery detail page
This commit is contained in:
@@ -4,7 +4,7 @@ import { useState, use } from 'react';
|
|||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import {
|
import {
|
||||||
Battery, ArrowLeft, X, BatteryCharging, Activity, Gauge, MapPin, Bike, User, History,
|
Battery, ArrowLeft, X, BatteryCharging, Activity, Gauge, MapPin, Bike, User, History,
|
||||||
Calendar, DollarSign, CheckCircle, Clock, ArrowRightLeft, Handshake, TrendingUp, Edit, RefreshCw
|
Calendar, DollarSign, CheckCircle, Clock, ArrowRightLeft, Handshake, TrendingUp, Edit
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
|
|
||||||
interface BMSData {
|
interface BMSData {
|
||||||
@@ -127,35 +127,12 @@ export default function BatteryDetailPage({ params }: { params: Promise<{ id: st
|
|||||||
const [battery, setBattery] = useState<Battery>(mockBattery);
|
const [battery, setBattery] = useState<Battery>(mockBattery);
|
||||||
const [activeTab, setActiveTab] = useState<'info' | 'bms' | 'history' | 'rent'>('info');
|
const [activeTab, setActiveTab] = useState<'info' | 'bms' | 'history' | 'rent'>('info');
|
||||||
const [showEditModal, setShowEditModal] = useState(false);
|
const [showEditModal, setShowEditModal] = useState(false);
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
|
||||||
|
|
||||||
const handleSaveEdit = (updatedBattery: Battery) => {
|
const handleSaveEdit = (updatedBattery: Battery) => {
|
||||||
setBattery(updatedBattery);
|
setBattery(updatedBattery);
|
||||||
setShowEditModal(false);
|
setShowEditModal(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRefreshBMS = () => {
|
|
||||||
setRefreshing(true);
|
|
||||||
setTimeout(() => {
|
|
||||||
setBattery({
|
|
||||||
...battery,
|
|
||||||
bmsData: {
|
|
||||||
...battery.bmsData!,
|
|
||||||
voltage: Math.round((60 + Math.random() * 10) * 10) / 10,
|
|
||||||
current: Math.round((-3 + Math.random() * 4) * 10) / 10,
|
|
||||||
soc: Math.floor(Math.random() * 40) + 60,
|
|
||||||
temperature: 25 + Math.floor(Math.random() * 15),
|
|
||||||
cycles: battery.bmsData!.cycles + 1,
|
|
||||||
health: Math.max(70, Math.min(100, battery.bmsData!.health + (Math.random() > 0.7 ? 1 : 0))),
|
|
||||||
timestamp: new Date().toISOString().replace('T', ' ').substring(0, 19)
|
|
||||||
},
|
|
||||||
currentSoc: Math.floor(Math.random() * 40) + 60,
|
|
||||||
health: Math.max(70, Math.min(100, battery.health + (Math.random() > 0.7 ? 1 : 0)))
|
|
||||||
});
|
|
||||||
setRefreshing(false);
|
|
||||||
}, 1000);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-4 lg:p-6">
|
<div className="p-4 lg:p-6">
|
||||||
<div className="flex items-center gap-4 mb-6">
|
<div className="flex items-center gap-4 mb-6">
|
||||||
@@ -219,6 +196,7 @@ export default function BatteryDetailPage({ params }: { params: Promise<{ id: st
|
|||||||
<Activity className="w-4 h-4 text-green-600" />
|
<Activity className="w-4 h-4 text-green-600" />
|
||||||
<span className="font-medium text-green-800">Live BMS Data</span>
|
<span className="font-medium text-green-800">Live BMS Data</span>
|
||||||
<span className="text-xs text-green-600 bg-green-100 px-2 py-0.5 rounded-full">Real-time</span>
|
<span className="text-xs text-green-600 bg-green-100 px-2 py-0.5 rounded-full">Real-time</span>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-3 md:grid-cols-6 gap-2">
|
<div className="grid grid-cols-3 md:grid-cols-6 gap-2">
|
||||||
<div className="bg-white rounded-lg p-2 text-center">
|
<div className="bg-white rounded-lg p-2 text-center">
|
||||||
|
|||||||
Reference in New Issue
Block a user