diff --git a/.changeset/serious-bananas-build.md b/.changeset/serious-bananas-build.md new file mode 100644 index 0000000000..12d2cf7f78 --- /dev/null +++ b/.changeset/serious-bananas-build.md @@ -0,0 +1,5 @@ +--- +"@khanacademy/perseus": patch +--- + +Internal: Resolve TODO comments diff --git a/packages/perseus/src/widgets/interactive-graphs/axis-ticks.tsx b/packages/perseus/src/widgets/interactive-graphs/axis-ticks.tsx index 2c5ec61e66..73114597b3 100644 --- a/packages/perseus/src/widgets/interactive-graphs/axis-ticks.tsx +++ b/packages/perseus/src/widgets/interactive-graphs/axis-ticks.tsx @@ -120,12 +120,8 @@ export const AxisTicks = () => { height, }; - // TODO(benchristel): destructure these in one line - const [xMin, xMax] = range[X]; - const [yMin, yMax] = range[Y]; - - const yTickStep = tickStep[Y]; - const xTickStep = tickStep[X]; + const [[xMin, xMax], [yMin, yMax]] = range; + const [xTickStep, yTickStep] = tickStep; const yGridTicks = generateTickLocations(yTickStep, yMin, yMax); const xGridTicks = generateTickLocations(xTickStep, xMin, xMax); diff --git a/packages/perseus/src/widgets/interactive-graphs/graphs/components/axis-tick-labels.tsx b/packages/perseus/src/widgets/interactive-graphs/graphs/components/axis-tick-labels.tsx index ba945832f0..5113f0c80b 100644 --- a/packages/perseus/src/widgets/interactive-graphs/graphs/components/axis-tick-labels.tsx +++ b/packages/perseus/src/widgets/interactive-graphs/graphs/components/axis-tick-labels.tsx @@ -1,6 +1,5 @@ import * as React from "react"; -import {X, Y} from "../../math"; import useGraphConfig from "../../reducer/use-graph-config"; import {pointToPixel} from "../use-transform"; @@ -42,12 +41,8 @@ export const AxisTickLabels = () => { const graphConfig = useGraphConfig(); const {tickStep, range} = graphConfig; - // TODO(benchristel): use destructuring here - const [xMin, xMax] = range[X]; - const [yMin, yMax] = range[Y]; - - const yTickStep = tickStep[Y]; - const xTickStep = tickStep[X]; + const [[xMin, xMax], [yMin, yMax]] = range; + const [xTickStep, yTickStep] = tickStep; const yGridTicks = generateTickLocations(yTickStep, yMin, yMax); const xGridTicks = generateTickLocations(xTickStep, xMin, xMax); diff --git a/packages/perseus/src/widgets/interactive-graphs/graphs/components/movable-point-view.tsx b/packages/perseus/src/widgets/interactive-graphs/graphs/components/movable-point-view.tsx index 453b49d6e3..35eb6dcc9b 100644 --- a/packages/perseus/src/widgets/interactive-graphs/graphs/components/movable-point-view.tsx +++ b/packages/perseus/src/widgets/interactive-graphs/graphs/components/movable-point-view.tsx @@ -57,9 +57,7 @@ export const MovablePointView = forwardRef( const [[x, y]] = useTransformVectorsToPixels(point); - // TODO(benchristel): destructure range in one line - const [xMin, xMax] = range[X]; - const [yMin, yMax] = range[Y]; + const [[xMin, xMax], [yMin, yMax]] = range; const [[verticalStartX]] = useTransformVectorsToPixels([xMin, 0]); const [[verticalEndX]] = useTransformVectorsToPixels([xMax, 0]);