mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-20 20:46:17 +00:00
Update AppImage
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
"use client"
|
||||
import { useState, useEffect } from "react"
|
||||
import { Dialog, DialogContent } from "@radix-ui/react-dialog"
|
||||
import { getUnitsSettings, formatNetworkTraffic, getNetworkLabel } from "@/lib/network-utils"
|
||||
|
||||
|
||||
export function InterfaceDetailsModal({ interface_, onClose, timeframe }: InterfaceDetailsModalProps) {
|
||||
const [metricsData, setMetricsData] = useState<any[]>([])
|
||||
const [loading, setLoading] = useState(false)
|
||||
@@ -10,16 +12,20 @@ export function InterfaceDetailsModal({ interface_, onClose, timeframe }: Interf
|
||||
const settings = getUnitsSettings()
|
||||
setNetworkUnit(settings.networkUnit as "Bytes" | "Bits")
|
||||
|
||||
const handleStorageChange = () => {
|
||||
const handleSettingsChange = () => {
|
||||
const settings = getUnitsSettings()
|
||||
setNetworkUnit(settings.networkUnit as "Bytes" | "Bits")
|
||||
}
|
||||
|
||||
window.addEventListener('storage', handleStorageChange)
|
||||
return () => window.removeEventListener('storage', handleStorageChange)
|
||||
window.addEventListener('storage', handleSettingsChange)
|
||||
window.addEventListener('unitsSettingsChanged', handleSettingsChange)
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('storage', handleSettingsChange)
|
||||
window.removeEventListener('unitsSettingsChanged', handleSettingsChange)
|
||||
}
|
||||
}, [])
|
||||
|
||||
|
||||
const totalReceived = metricsData.length > 0
|
||||
? Math.max(0, (metricsData[metricsData.length - 1].netin || 0) - (metricsData[0].netin || 0))
|
||||
: 0
|
||||
|
||||
Reference in New Issue
Block a user