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

Remove the legacy keypad and replace it with MobileKeypad #825

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

benchristel
Copy link
Member

Summary:

Previously, the KeypadSwitch component let you toggle between the new
and old keypads. Now we always use the new keypad.

Issue: https://khanacademy.atlassian.net/browse/LC-739

Test plan:

yarn test

Previously, the KeypadSwitch component let you toggle between the new
and old keypads. Now we always use the new keypad.

Issue: https://khanacademy.atlassian.net/browse/LC-739

Test plan:

`yarn test`
@benchristel benchristel self-assigned this Nov 29, 2023
@khan-actions-bot khan-actions-bot requested a review from a team November 29, 2023 17:51
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Nov 29, 2023

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/funny-carrots-leave.md, packages/math-input/src/full-mobile-input.stories.tsx, packages/math-input/src/index.ts, packages/perseus/src/__tests__/article-renderer.test.tsx, packages/perseus/src/mixins/provide-keypad.tsx, packages/math-input/src/components/__tests__/integration.test.tsx, packages/math-input/src/components/keypad/index.tsx, packages/math-input/src/components/keypad/mobile-keypad-internals.tsx, packages/math-input/src/components/keypad/mobile-keypad.tsx, packages/perseus/src/widgets/__stories__/test-keypad-context-wrapper.tsx, packages/perseus/src/widgets/__tests__/expression-mobile.test.tsx, packages/math-input/src/components/keypad/__tests__/mobile-keypad.test.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 Nov 29, 2023

npm Snapshot: Published

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

Example:

yarn add @khanacademy/perseus@PR825

Copy link
Contributor

github-actions bot commented Nov 29, 2023

Size Change: -29.6 kB (-3%)

Total Size: 834 kB

Filename Size Change
packages/math-input/dist/es/index.js 78.7 kB -29.6 kB (-27%) 🎉
packages/perseus/dist/es/index.js 404 kB -15 B (0%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.1 kB
packages/kmath/dist/es/index.js 4.25 kB
packages/perseus-core/dist/es/index.js 907 B
packages/perseus-editor/dist/es/index.js 269 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.77 kB
packages/simple-markdown/dist/es/index.js 12.4 kB

compressed-size-action

Copy link

codecov bot commented Nov 29, 2023

Codecov Report

Merging #825 (a343751) into main (021f946) will increase coverage by 1.87%.
Report is 22 commits behind head on main.
The diff coverage is 93.91%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #825      +/-   ##
==========================================
+ Coverage   60.68%   62.55%   +1.87%     
==========================================
  Files         484      409      -75     
  Lines      105898   100106    -5792     
  Branches     6225     8639    +2414     
==========================================
- Hits        64266    62624    -1642     
+ Misses      41632    37482    -4150     

Impacted file tree graph

Files Coverage Δ
...ackages/math-input/src/components/keypad/index.tsx 100.00% <100.00%> (ø)
...math-input/src/components/keypad/mobile-keypad.tsx 100.00% <100.00%> (+6.75%) ⬆️
packages/math-input/src/index.ts 100.00% <100.00%> (ø)
packages/perseus/src/mixins/provide-keypad.tsx 64.23% <ø> (+0.46%) ⬆️
.../src/components/keypad/mobile-keypad-internals.tsx 93.33% <93.33%> (ø)

... and 33 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 021f946...a343751. Read the comment docs.

<Basic
keypadElement={keypadElement}
setKeypadElement={setKeypadElement}
keypadActive={keypadActive}
setKeypadActive={setKeypadActive}
Copy link
Member Author

Choose a reason for hiding this comment

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

To avoid breaking compatibility with existing callers, it might be better to wrap the MobileKeypad in a component that uses the KeypadContext.Consumer to get keypadActive and setKeypadActive. @handeyeco do you think that would be an improvement?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, that's definitely the way I'd like to go. See this ticket:

What’s even nicer is that this could likely all happen within Perseus - rather than passing things around in Webapp, we can pass things around in Perseus using Context; the Perseus widget passes a config up to the Perseus context which passes the config down to the Perseus keypad.

Copy link
Contributor

@handeyeco handeyeco left a comment

Choose a reason for hiding this comment

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

Thank you!

@@ -11,7 +11,7 @@
* extend a `ProvideKeypad` component instead of using this mixin.
*/

import {MobileKeypad} from "@khanacademy/math-input";
import {KeypadContext, MobileKeypad} from "@khanacademy/math-input";
Copy link
Contributor

Choose a reason for hiding this comment

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

No action needed: just for reference, both ProvideKeypad and ItemRenderer are dead code now. It's fine if it's out of scope for this PR, but I also wouldn't spend much more time updating them.

@benchristel benchristel merged commit 7cb40e4 into main Nov 29, 2023
13 checks passed
@benchristel benchristel deleted the benc/remove-keypad-legacy branch November 29, 2023 22:50
jeremywiebe pushed a commit that referenced this pull request Nov 30, 2023
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/[email protected]

### Major Changes

-   [#825](#825) [`7cb40e4c`](7cb40e4) Thanks [@benchristel](https://github.com/benchristel)! - We've removed the deprecated `useV2Keypad` prop from the MobileKeypad component.

    The V2 keypad is now the default, and the old keypad has been removed.

    Additionally, the mobile keypad no longer accepts the `keypadActive` or
    `setKeypadActive` props. It now gets those values itself from the `KeypadContext`.

## @khanacademy/[email protected]

### Major Changes

-   [#825](#825) [`7cb40e4c`](7cb40e4) Thanks [@benchristel](https://github.com/benchristel)! - We've removed the deprecated `useV2Keypad` prop from the MobileKeypad component.

    The V2 keypad is now the default, and the old keypad has been removed.

    Additionally, the mobile keypad no longer accepts the `keypadActive` or
    `setKeypadActive` props. It now gets those values itself from the `KeypadContext`.

### Minor Changes

-   [#816](#816) [`cdcd162e`](cdcd162) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Wrap all SvgImage instances in AssetContext (ensures that host applications can correctly wait for all images to load in a renderer before proceeding).


-   [#788](#788) [`8f1f0208`](8f1f020) Thanks [@jeanettehead](https://github.com/jeanettehead)! - create randomized storybook stories for some widgets

### Patch Changes

-   Updated dependencies \[[`7cb40e4c`](7cb40e4)]:
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Minor Changes

-   [#827](#827) [`c7410ccc`](c7410cc) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Revert defensive code in ExpressionEditor that caused a crash when an expression config's answer form was missing a `key` property.

### Patch Changes

-   Updated dependencies \[[`cdcd162e`](cdcd162), [`7cb40e4c`](7cb40e4), [`8f1f0208`](8f1f020)]:
    -   @khanacademy/[email protected]

Author: khan-actions-bot

Reviewers: jeremywiebe

Required Reviewers:

Approved By: jeremywiebe

Checks: ✅ Upload Coverage, ⏭  Publish npm snapshot, ✅ Extract i18n strings (ubuntu-latest, 16.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 16.x), ✅ Check builds for changes in size (ubuntu-latest, 16.x), ✅ Cypress (ubuntu-latest, 16.x), ✅ Jest Coverage (ubuntu-latest, 16.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 16.x), ✅ Check for .changeset entries for all changed files (ubuntu-latest, 16.x), ✅ gerald

Pull Request URL: #819
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