Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style movable points and segments on Mafs graphs #1068

Merged
merged 8 commits into from
Mar 13, 2024

Conversation

benchristel
Copy link
Member

@benchristel benchristel commented Mar 13, 2024

Summary:

See this slack thread for designs and discussion:
https://khanacademy.slack.com/archives/C067UM1QAR4/p1709847469823399

Issue: LEMS-1672

Test plan:

yarn dev
open http://localhost:5173

Check the "segment" box in the dropdown at the top of the screen to
switch to the Mafs version of the segment graph.

You should be able to move the points and line segment with the mouse
and keyboard. The hover and focus states of the points should be clearly distinct.
The line segment should be highlighted blue when focused.

Screen.Recording.2024-03-13.at.9.38.08.AM.mov

See this slack thread for designs and discussion:
https://khanacademy.slack.com/archives/C067UM1QAR4/p1709847469823399

Issue: LEMS-1672

Test plan:

```
yarn dev
open http://localhost:5173
```

Check the "segment" box in the dropdown at the top of the screen to
switch to the Mafs version of the segment graph.

You should be able to move the points and line segment with the mouse
and keyboard. The hover and focus states of the points should be clearly distinct.
The line segment should be highlighted blue when focused.
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Mar 13, 2024

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/fast-buckets-wave.md, packages/perseus/src/widgets/__tests__/interactive-graph.test.ts, packages/perseus/src/widgets/interactive-graphs/mafs-styles.css, packages/perseus/src/widgets/interactive-graphs/movable-point.tsx, packages/perseus/src/widgets/interactive-graphs/graphs/segment.tsx

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

Copy link
Contributor

github-actions bot commented Mar 13, 2024

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (162f667) and published it to npm. You
can install it using the tag PR1068.

Example:

yarn add @khanacademy/perseus@PR1068

If you are working in Khan Academy's webapp, you can run:

./dev/tools/bump_perseus_version.sh -t PR1068

Copy link
Contributor

github-actions bot commented Mar 13, 2024

Size Change: +212 B (0%)

Total Size: 810 kB

Filename Size Change
packages/perseus/dist/es/index.js 385 kB +212 B (0%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.1 kB
packages/kmath/dist/es/index.js 4.27 kB
packages/math-input/dist/es/index.js 80.4 kB
packages/perseus-core/dist/es/index.js 908 B
packages/perseus-editor/dist/es/index.js 263 kB
packages/perseus-error/dist/es/index.js 878 B
packages/perseus-linter/dist/es/index.js 21.8 kB
packages/pure-markdown/dist/es/index.js 3.69 kB
packages/simple-markdown/dist/es/index.js 12.4 kB

compressed-size-action

Copy link

codecov bot commented Mar 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.60%. Comparing base (631af3a) to head (162f667).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1068      +/-   ##
==========================================
+ Coverage   67.29%   68.60%   +1.30%     
==========================================
  Files         434      437       +3     
  Lines       96419    96512      +93     
  Branches     6684    10263    +3579     
==========================================
+ Hits        64889    66213    +1324     
+ Misses      31530    30299    -1231     

Impacted file tree graph

Files Coverage Δ
.../src/widgets/interactive-graphs/graphs/segment.tsx 96.03% <100.00%> (-0.07%) ⬇️
...s/src/widgets/interactive-graphs/movable-point.tsx 100.00% <100.00%> (ø)

... and 103 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 631af3a...162f667. Read the comment docs.

Copy link
Contributor

@nishasy nishasy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool!

<circle className="movable-point-ring" r={8} cx={x} cy={y} />
<circle
className="movable-point-center"
r={6}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to break out these scalar numbers into a constants file? I'm not entirely sure since it doesn't look like there are a lot of reused ones (between this file and the CSS file), but I think naming them could make it easier to figure out why the sizes are what they are in the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call-out. Probably all of the radii should be in CSS, at least. I'll move these.

@benchristel benchristel merged commit 881da72 into main Mar 13, 2024
12 checks passed
@benchristel benchristel deleted the benc/movable-point-styling branch March 13, 2024 18:28
@@ -38,11 +38,10 @@ export const MovablePoint = (props: Props) => {
}
>
<circle className="movable-point-hitbox" r={30} cx={x} cy={y} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional suggestion: Maybe also move the hitbox radius to the styles for consistency?

benchristel pushed a commit that referenced this pull request Mar 14, 2024
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.


# Releases
## @khanacademy/perseus-dev-ui@1.3.0

### Minor Changes

-   [#1071](#1071) [`eb637b35`](eb637b3) Thanks [@benchristel](https://github.com/benchristel)! - Add a "check answer" button to interactive graphs displayed in the dev flipbook UI

## @khanacademy/perseus@20.2.0

### Minor Changes

-   [#1067](#1067) [`6196375a`](6196375) Thanks [@nishasy](https://github.com/nishasy)! - Can pass a point into `lockedFigures` into MafsGraph and a point will be displayed.


-   [#1074](#1074) [`a263e940`](a263e94) Thanks [@nishasy](https://github.com/nishasy)! - Add "add a locked figure" UI to interactive graph editor + adding points (mafs graphs only)

### Patch Changes

-   [#1068](#1068) [`881da724`](881da72) Thanks [@benchristel](https://github.com/benchristel)! - Adjust styling of the movable points and line segments on the Mafs segment graph


-   [#1071](#1071) [`eb637b35`](eb637b3) Thanks [@benchristel](https://github.com/benchristel)! - Add a "check answer" button to interactive graphs displayed in the dev flipbook UI


-   [#1073](#1073) [`ea0db7d9`](ea0db7d) Thanks [@benchristel](https://github.com/benchristel)! - Fix color of Mafs line segments

## @khanacademy/perseus-editor@5.1.0

### Minor Changes

-   [#1074](#1074) [`a263e940`](a263e94) Thanks [@nishasy](https://github.com/nishasy)! - Add "add a locked figure" UI to interactive graph editor + adding points (mafs graphs only)

### Patch Changes

-   Updated dependencies \[[`881da724`](881da72), [`eb637b35`](eb637b3), [`6196375a`](6196375), [`a263e940`](a263e94), [`ea0db7d9`](ea0db7d)]:
    -   @khanacademy/perseus@20.2.0

Author: khan-actions-bot

Reviewers: benchristel

Required Reviewers:

Approved By: benchristel

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

Pull Request URL: #1069
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants