From 33a7c577c0b4f989e1e2923cf682c9efdd1720d3 Mon Sep 17 00:00:00 2001 From: mrv777 Date: Fri, 11 Oct 2024 17:09:37 -0500 Subject: [PATCH] fix: Add more info on table & temp to 62 --- package.json | 2 +- src/components/MinerStatus.tsx | 11 +++-- src/components/MinerTable.tsx | 88 +++++++++++++++++++++++++--------- src/lib/asicDefaults.ts | 20 +++++++- src/utils/helpers.ts | 8 ++++ 5 files changed, 101 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index 66dcf61..656e851 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bithive", - "version": "0.1.0", + "version": "0.1.1", "private": true, "author": { "name": "MrV", diff --git a/src/components/MinerStatus.tsx b/src/components/MinerStatus.tsx index 86d5bf9..4a24277 100644 --- a/src/components/MinerStatus.tsx +++ b/src/components/MinerStatus.tsx @@ -7,6 +7,7 @@ import { Tooltip, ResponsiveContainer, } from "recharts"; +import { calculateExpectedHashRate } from "@/utils/helpers"; // Add this utility function at the top of the file const formatDifficulty = (value: number): string => { @@ -78,8 +79,10 @@ const MinerStatus: React.FC = ({ data, ready }) => { }; // Calculate expected hash rate - const calculatedExpectedHashRate = Math.floor( - data.frequency * ((data.smallCoreCount * data.asicCount) / 1000) + const calculatedExpectedHashRate = calculateExpectedHashRate( + data.frequency, + data.smallCoreCount, + data.asicCount ); setExpectedHashRate(calculatedExpectedHashRate); @@ -207,7 +210,7 @@ const MinerStatus: React.FC = ({ data, ready }) => { className={`stat-value ${ data.temp >= 68 ? "text-red-500" - : data.temp >= 60 + : data.temp >= 62 ? "text-yellow-500" : "text-green-500" }`} @@ -217,7 +220,7 @@ const MinerStatus: React.FC = ({ data, ready }) => {
{data.temp >= 68 ? "Warning: Overheating" - : data.temp >= 60 + : data.temp >= 62 ? "Caution" : "Healthy"}
diff --git a/src/components/MinerTable.tsx b/src/components/MinerTable.tsx index ed2132f..37d88c6 100644 --- a/src/components/MinerTable.tsx +++ b/src/components/MinerTable.tsx @@ -1,5 +1,7 @@ import React from "react"; import { UseQueryResult } from "@tanstack/react-query"; +import { calculateExpectedHashRate } from "@/utils/helpers"; +import { getDefaultFrequency } from "@/lib/asicDefaults"; interface MinerTableProps { statusQueries: UseQueryResult[]; @@ -32,19 +34,23 @@ const MinerTable: React.FC = ({ - - + + - + @@ -65,33 +71,50 @@ const MinerTable: React.FC = ({
- Devices ({devicesWithData}/{hiveData.length}) - {devicesWithoutData > 0 && ( - - ({devicesWithoutData} offline) - - )} - ASIC Model + Devices ({devicesWithData}/{hiveData.length}) + {devicesWithoutData > 0 && ( + + ({devicesWithoutData} offline) + + )} + + ASIC Model + Best Diff Hash Rate TempFrequency + Frequency + Voltage Power Actions {query.data ? ( <> - {query.data.bestSessionDiff || "N/A"}{" "} - +
{query.data.bestSessionDiff || "N/A"}
+
({query.data.bestDiff || "N/A"}) - +
) : ( "N/A" )}
- {query.data ? `${query.data.hashRate.toFixed(2)} Gh/s` : "N/A"} +
{query.data ? `${query.data.hashRate.toFixed(2)} Gh/s` : "N/A"}
+
+ {query.data + ? `${calculateExpectedHashRate( + query.data.frequency, + query.data.smallCoreCount, + query.data.asicCount + ).toFixed(0)} Gh/s` + : "N/A"} +
= 68 ? "text-red-500" - : query.data?.temp >= 60 + : query.data?.temp >= 62 ? "text-yellow-500" : "text-green-500" : "" }`} > - {query.data ? `${query.data.temp}°C` : "N/A"} +
{query.data ? `${query.data.temp}°C` : "N/A"}
+ {query.data?.temp >= 68 + ? "Warning: Overheating" + : query.data?.temp >= 62 + ? "Caution" + : "Healthy"}
- {query.data ? `${query.data.frequency} MHz` : "N/A"} +
{query.data ? `${query.data.frequency} MHz` : "N/A"}
+
+ {getDefaultFrequency(query.data?.ASICModel || "").toFixed(0)} MHz +
= ({ : "" }`} > - {query.data - ? `${(query.data.voltage / 1000).toFixed(2)}V` +
+ {query.data + ? `${(query.data?.voltage / 1000).toFixed(2)}V` : "N/A"} +
+ {query.data?.voltage > 4900 + ? "Healthy" + : query.data?.voltage > 4800 + ? "Caution" + : "Under Voltage"}
- {query.data ? `${query.data.power.toFixed(2)}W` : "N/A"} + {query.data?.power ? + <> +
+ {query.data.power.toFixed(2)}W +
+
+ {( + (query.data.power / (query.data.hashRate ?? 1)) * + 1000 + ).toFixed(2)} J/Th +
+ + : "N/A"}