mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-12-15 00:26:23 +00:00
Update hardware.tsx
This commit is contained in:
@@ -22,10 +22,13 @@ import useSWR from "swr"
|
|||||||
import { useState, useEffect } from "react"
|
import { useState, useEffect } from "react"
|
||||||
import { type HardwareData, type GPU, type PCIDevice, type StorageDevice, fetcher } from "../types/hardware"
|
import { type HardwareData, type GPU, type PCIDevice, type StorageDevice, fetcher } from "../types/hardware"
|
||||||
|
|
||||||
const formatMemory = (memoryMB: number | string): string => {
|
const formatMemory = (memoryKB: number | string): string => {
|
||||||
const mb = typeof memoryMB === "string" ? Number.parseFloat(memoryMB) : memoryMB
|
const kb = typeof memoryKB === "string" ? Number.parseFloat(memoryKB) : memoryKB
|
||||||
|
|
||||||
if (isNaN(mb)) return "N/A"
|
if (isNaN(kb)) return "N/A"
|
||||||
|
|
||||||
|
// Convert KB to MB
|
||||||
|
const mb = kb / 1024
|
||||||
|
|
||||||
// Convert to GB if >= 1024 MB
|
// Convert to GB if >= 1024 MB
|
||||||
if (mb >= 1024) {
|
if (mb >= 1024) {
|
||||||
|
|||||||
Reference in New Issue
Block a user