import React, { useState, useEffect } from "react" import { Text, Box, useInput, useApp } from "ink" import type { cpuProps, gpuProps } from "./main.d.ts" import si from "systeminformation" export default function App() { const [cpu, setCpu] = useState() const [gpu, setGpu] = useState() const [gpuTemperature, setGpuTemperature] = useState() const [cpuTemperature, setCpuTemperature] = useState() const { exit } = useApp(); useEffect(() => { si.cpu() .then((data: any) => setCpu(data)) si.graphics() .then((data: any) => setGpu(data.controllers[0])) const tempFetch = setInterval(() => { si.graphics() .then((data: any) => setGpuTemperature(data.controllers[0].temperatureGpu)) si.cpuTemperature() .then((data: any) => setCpuTemperature(data.main)) }, 250) return () => { clearInterval(tempFetch) } },[]) useInput((input) => { if (input === "q") { exit() } }) return ( CPU: {cpu?.brand} CPU Temperature: {cpuTemperature || "N/A"} °C Cores: {cpu?.cores} Physical Cores: {cpu?.physicalCores} Virtualization: {cpu?.virtualization ? "yes" : "no"} GPU: {gpu?.name} GPU Temperature: {gpuTemperature || "N/A"} °C GPU Utilization: {gpu?.utilizationGpu}% VRAM: {gpu?.vram}MB Driver Version: {gpu?.driverVersion} ); }