had cursor replace uses of getDistanceUnit with using the distance unit in the users settings so that it no longer relies on local storage
This commit is contained in:
parent
c6bb7aa24a
commit
dc54f99abd
20 changed files with 273 additions and 199 deletions
|
|
@ -4,8 +4,8 @@ import ResponsiveTable, { Column } from "common/ResponsiveTable";
|
|||
//import { getTableIcons } from "common/ResponsiveTable";
|
||||
//import MaterialTable from "material-table";
|
||||
import { pond } from "protobuf-ts/pond";
|
||||
import { useEffect } from "react";
|
||||
import { distanceConversion, getDistanceUnit } from "utils";
|
||||
import { distanceConversion } from "utils";
|
||||
import { useGlobalState } from "providers";
|
||||
|
||||
interface Props {
|
||||
bin: jsonBin;
|
||||
|
|
@ -13,6 +13,7 @@ interface Props {
|
|||
|
||||
export default function CableMounting(props: Props) {
|
||||
const { bin } = props;
|
||||
const [{ user }] = useGlobalState();
|
||||
// const [tablePage, setTablePage] = useState(0)
|
||||
// const [pageSize, setPageSize] = useState(10)
|
||||
|
||||
|
|
@ -26,15 +27,19 @@ export default function CableMounting(props: Props) {
|
|||
render: (row: CableSum) => <Box padding={2}>{row.Orbit === 0 ? "Center" : row.Orbit}</Box>
|
||||
},
|
||||
{
|
||||
title: "From Center " + (getDistanceUnit() === pond.DistanceUnit.DISTANCE_UNIT_FEET ? "(ft)" : "(m)"),
|
||||
title: "From Center " + (user.distanceUnit() === pond.DistanceUnit.DISTANCE_UNIT_FEET ? "(ft)" : "(m)"),
|
||||
render: (row: CableSum) => (
|
||||
<Box padding={2}>{distanceConversion(row.DistanceFromCenter).toFixed(2)}</Box>
|
||||
<Box padding={2}>
|
||||
{distanceConversion(row.DistanceFromCenter, user.distanceUnit()).toFixed(2)}
|
||||
</Box>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: "Along Roof" + (getDistanceUnit() === pond.DistanceUnit.DISTANCE_UNIT_FEET ? "(ft)" : "(m)"),
|
||||
title: "Along Roof" + (user.distanceUnit() === pond.DistanceUnit.DISTANCE_UNIT_FEET ? "(ft)" : "(m)"),
|
||||
render: (row: CableSum) => (
|
||||
<Box padding={2}>{distanceConversion(roofDist(row.DistanceFromCenter)).toFixed(2)}</Box>
|
||||
<Box padding={2}>
|
||||
{distanceConversion(roofDist(row.DistanceFromCenter), user.distanceUnit()).toFixed(2)}
|
||||
</Box>
|
||||
)
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue