mirror of
				https://github.com/karl0ss/homepage.git
				synced 2025-11-04 00:10:57 +00:00 
			
		
		
		
	Update cputemp.jsx
This commit is contained in:
		
							parent
							
								
									a0fa6367ca
								
							
						
					
					
						commit
						2fbe4e5f24
					
				@ -47,16 +47,14 @@ export default function CpuTemp({ expanded, units }) {
 | 
				
			|||||||
    );
 | 
					    );
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  let minTemp = 0;
 | 
					 | 
				
			||||||
  let mainTemp = data.cputemp.main;
 | 
					  let mainTemp = data.cputemp.main;
 | 
				
			||||||
  if (data.cputemp.cores?.length) {
 | 
					  if (data.cputemp.cores?.length) {
 | 
				
			||||||
    mainTemp = data.cputemp.cores.reduce((a, b) => a + b) / data.cputemp.cores.length;
 | 
					    mainTemp = data.cputemp.cores.reduce((a, b) => a + b) / data.cputemp.cores.length;
 | 
				
			||||||
    minTemp = Math.min(...data.cputemp.cores);
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  const unit = units === "imperial" ? "fahrenheit" : "celsius";
 | 
					  const unit = units === "imperial" ? "fahrenheit" : "celsius";
 | 
				
			||||||
  mainTemp = (unit === "celsius") ? mainTemp : convertToFahrenheit(mainTemp);
 | 
					  mainTemp = (unit === "celsius") ? mainTemp : convertToFahrenheit(mainTemp);
 | 
				
			||||||
  const maxTemp = (unit === "celsius") ? data.cputemp.max : convertToFahrenheit(data.cputemp.max);
 | 
					  const maxTemp = (unit === "celsius") ? data.cputemp.max : convertToFahrenheit(data.cputemp.max);
 | 
				
			||||||
  const percent = Math.round(((mainTemp - minTemp) / (maxTemp - minTemp)) * 100);
 | 
					  const percent = Math.round((mainTemp / maxTemp) * 100);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return (
 | 
					  return (
 | 
				
			||||||
    <div className="flex-none flex flex-row items-center mr-3 py-1.5">
 | 
					    <div className="flex-none flex flex-row items-center mr-3 py-1.5">
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user