Update AppImage

This commit is contained in:
MacRimi
2025-11-18 21:11:56 +01:00
parent a2862f22f6
commit ae69fec7ce
5 changed files with 38 additions and 57 deletions

View File

@@ -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