mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-10-30 05:54:05 +00:00 
			
		
		
		
	Add temp usage bar, fix disk percentage
This commit is contained in:
		
							parent
							
								
									868c16620f
								
							
						
					
					
						commit
						1e64cf02cd
					
				| @ -2,6 +2,7 @@ import useSWR from "swr"; | ||||
| import { FaThermometerHalf } from "react-icons/fa"; | ||||
| import { BiError } from "react-icons/bi"; | ||||
| import { useTranslation } from "next-i18next"; | ||||
| import UsageBar from "./usage-bar"; | ||||
| 
 | ||||
| export default function CpuTemp({ expanded, units }) { | ||||
|   const { t } = useTranslation(); | ||||
| @ -44,6 +45,7 @@ export default function CpuTemp({ expanded, units }) { | ||||
|   const unit = units === "imperial" ? "fahrenheit" : "celsius"; | ||||
|   const mainTemp = (unit === "celsius") ? data.cputemp.main : data.cputemp.main * 5/9 + 32; | ||||
|   const maxTemp = (unit === "celsius") ? data.cputemp.max : data.cputemp.max * 5/9 + 32; | ||||
|   const percent = Math.round((mainTemp / maxTemp) * 100); | ||||
| 
 | ||||
|   return ( | ||||
|     <div className="flex-none flex flex-row items-center mr-3 py-1.5"> | ||||
| @ -73,6 +75,7 @@ export default function CpuTemp({ expanded, units }) { | ||||
|             <div className="pr-1">{t("resources.max")}</div> | ||||
|           </span> | ||||
|         )} | ||||
|         <UsageBar percent={percent} /> | ||||
|       </div> | ||||
|     </div> | ||||
|   ); | ||||
|  | ||||
| @ -44,7 +44,8 @@ export default function Disk({ options, expanded }) { | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   const percent = Math.round((data.drive.used / data.drive.size) * 100); | ||||
|   // data.drive.used not accurate? | ||||
|   const percent = Math.round(((data.drive.size - data.drive.available) / data.drive.size) * 100); | ||||
| 
 | ||||
|   return ( | ||||
|     <div className="flex-none flex flex-row items-center mr-3 py-1.5"> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 shamoon
						shamoon