Skip to content

Commit

Permalink
Resolve a couple TODO comments (#1391)
Browse files Browse the repository at this point in the history
Issue: none

## Test plan:
`yarn test`

Author: benchristel

Reviewers: mark-fitzgerald, nicolecomputer, SonicScrewdriver

Required Reviewers:

Approved By: mark-fitzgerald

Checks: ✅ codecov/project, ✅ codecov/patch, ✅ Upload Coverage (ubuntu-latest, 20.x), ✅ Publish npm snapshot (ubuntu-latest, 20.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 20.x), ✅ Check builds for changes in size (ubuntu-latest, 20.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 20.x), ✅ Cypress (ubuntu-latest, 20.x), ✅ Jest Coverage (ubuntu-latest, 20.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 20.x), ✅ gerald

Pull Request URL: #1391
  • Loading branch information
benchristel authored Jul 9, 2024
1 parent e6424d5 commit f5711a3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-bananas-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Internal: Resolve TODO comments
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit f5711a3

Please sign in to comment.