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:
parent
a288c9503a
commit
ce41a2dc05
16 changed files with 188 additions and 178 deletions
|
|
@ -13,12 +13,13 @@ import {
|
|||
yellow
|
||||
} from "@mui/material/colors";
|
||||
import { GraphType } from "common/Graph";
|
||||
import { User } from "models";
|
||||
import { IsCardController } from "products/DeviceProduct";
|
||||
import { pond } from "protobuf-ts/pond";
|
||||
import { quack } from "protobuf-ts/quack";
|
||||
import { getTextSecondary } from "theme/text";
|
||||
// import { getTextSecondary } from "theme";
|
||||
import { getDistanceUnit, getPressureUnit, getTemperatureUnit, roundTo } from "utils";
|
||||
import { getDistanceUnit, getPressureUnit, roundTo } from "utils";
|
||||
import { extract } from "utils/types";
|
||||
|
||||
interface Enumeration {
|
||||
|
|
@ -64,7 +65,8 @@ export class MeasurementDescriber {
|
|||
measurementType: quack.MeasurementType,
|
||||
componentType: quack.ComponentType,
|
||||
componentSubtype: number,
|
||||
product?: pond.DeviceProduct
|
||||
product?: pond.DeviceProduct,
|
||||
user?: User
|
||||
) {
|
||||
this.measurementType = measurementType;
|
||||
this.details = {
|
||||
|
|
@ -87,7 +89,7 @@ export class MeasurementDescriber {
|
|||
case quack.MeasurementType.MEASUREMENT_TYPE_INVALID:
|
||||
break;
|
||||
case quack.MeasurementType.MEASUREMENT_TYPE_TEMPERATURE:
|
||||
let temperatureUnit = getTemperatureUnit();
|
||||
let temperatureUnit = user?.tempUnit() ?? pond.TemperatureUnit.TEMPERATURE_UNIT_CELSIUS;
|
||||
let isFahrenheit = temperatureUnit === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT;
|
||||
this.details.label = "Temperature";
|
||||
this.details.unit = isFahrenheit ? "°F" : "°C";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue