replacing the getTemperatureUnit function in units that uses the local storage with a function in the user model to just get it from the user settings

This commit is contained in:
csawatzky 2026-03-25 15:45:59 -06:00
parent a288c9503a
commit ce41a2dc05
16 changed files with 188 additions and 178 deletions

View file

@ -40,7 +40,7 @@ import { FullScreen, useFullScreenHandle } from "react-full-screen";
import moment, { Moment } from "moment";
import ResponsiveDialog from "common/ResponsiveDialog";
import { getThemeType } from "theme";
import { getGrainUnit, getTemperatureUnit, or } from "utils";
import { getGrainUnit, or } from "utils";
import { useBinAPI } from "providers/pond/binAPI";
import BindaptIcon from "products/Bindapt/BindaptIcon";
import {
@ -605,7 +605,7 @@ export default function BinVisualizer(props: Props) {
break;
}
if (valC) {
if (getTemperatureUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT) {
if (user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT) {
temp = CtoF(valC).toFixed(1) + "°F";
} else {
temp = valC.toFixed(1) + "°C";
@ -705,7 +705,7 @@ export default function BinVisualizer(props: Props) {
break;
}
if (valC) {
if (getTemperatureUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT) {
if (user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT) {
temp = Math.abs(valC * 1.8).toFixed(1) + "°F"; //since this is a measurement of change a change in 1 degrre celsius is equivalent to 1.8 fahrenheit
} else {
temp = Math.abs(valC).toFixed(1) + "°C";
@ -1676,7 +1676,7 @@ export default function BinVisualizer(props: Props) {
fontWeight: 650,
color: tempColour
}}>
{ambient?.getTempString(getTemperatureUnit())}
{ambient?.getTempString(user.tempUnit())}
</Typography>
</Box>
<Box display="flex" marginY={1}>