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

Add save warnings to PhET widget editor and unhide widget #1582

Merged
merged 5 commits into from
Sep 4, 2024

Conversation

aemandine
Copy link
Contributor

@aemandine aemandine commented Sep 3, 2024

Summary:

  • Add getSaveWarnings() function to PhET widget editor so that a widget cannot be saved with a non-PhET URL
  • Unhide the widget from the content editor
A save warning popup, Are you sure you want to save your changes with errors? phet-simulation 1: Please enter a URL from the PhET domain.

Issue: LEMS-2292

Test plan:

  • yarn jest packages/perseus/src/widgets/__tests__/phet-simulation.test.ts
  • yarn jest packages/perseus-editor/src/widgets/__tests__/phet-simulation-editor.test.tsx
  • Verify that the widget and editor still show up in Storybook
  • Verify that the editor displays an error when a non-PhET URL is typed into the PhET widget content editor

@aemandine aemandine self-assigned this Sep 3, 2024
Copy link
Contributor

github-actions bot commented Sep 3, 2024

Size Change: +31 B (0%)

Total Size: 861 kB

Filename Size Change
packages/perseus-editor/dist/es/index.js 277 kB +52 B (+0.02%)
packages/perseus/dist/es/index.js 418 kB -21 B (-0.01%)
ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.3 kB
packages/keypad-context/dist/es/index.js 760 B
packages/kmath/dist/es/index.js 4.27 kB
packages/math-input/dist/es/index.js 78 kB
packages/math-input/dist/es/strings.js 1.79 kB
packages/perseus-core/dist/es/index.js 1.48 kB
packages/perseus-linter/dist/es/index.js 22.2 kB
packages/perseus/dist/es/strings.js 3.36 kB
packages/pure-markdown/dist/es/index.js 3.66 kB
packages/simple-markdown/dist/es/index.js 12.4 kB

compressed-size-action

@aemandine aemandine changed the title Add getSaveWarnings Add save warnings to PhET widget editor and unhide widget Sep 3, 2024
@aemandine aemandine force-pushed the am/lems-2292/add-phet-getsavewarnings branch from 1f17666 to f474fe7 Compare September 4, 2024 17:35
@aemandine aemandine marked this pull request as ready for review September 4, 2024 17:39
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Sep 4, 2024

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/thirty-pans-hammer.md, packages/perseus/src/index.ts, packages/perseus-editor/src/widgets/phet-simulation-editor.tsx, packages/perseus/src/widgets/phet-simulation/index.ts, packages/perseus/src/widgets/phet-simulation/phet-simulation.tsx

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

@khan-actions-bot khan-actions-bot requested a review from a team September 4, 2024 17:39
Copy link
Contributor

github-actions bot commented Sep 4, 2024

npm Snapshot: Published

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

Example:

yarn add @khanacademy/perseus@PR1582

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

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

Copy link

codecov bot commented Sep 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.35%. Comparing base (a6ec402) to head (7530b5e).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1582      +/-   ##
==========================================
- Coverage   70.39%   70.35%   -0.05%     
==========================================
  Files         554      579      +25     
  Lines      107555   112078    +4523     
  Branches     5530    11891    +6361     
==========================================
+ Hits        75717    78855    +3138     
- Misses      31722    33223    +1501     
+ Partials      116        0     -116     

Impacted file tree graph

see 1132 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 a6ec402...7530b5e. Read the comment docs.

}
return [];
}

render(): React.ReactNode {
Copy link
Contributor

Choose a reason for hiding this comment

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

Make sure to test this locally in webapp/ a znd before deploying!

Copy link
Contributor Author

@aemandine aemandine Sep 4, 2024

Choose a reason for hiding this comment

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

Thank you! We have just discovered that local dev server doesn't allow for content editing. I will make a ZND instead!

Update: The local dev server does allow content editing, we just had a bug!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Looks good.

Copy link
Contributor

@SonicScrewdriver SonicScrewdriver left a comment

Choose a reason for hiding this comment

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

Other than testing that we'll do together, LGTM! :)

@aemandine aemandine force-pushed the am/lems-2292/add-phet-getsavewarnings branch from 5d52f6e to 480e60f Compare September 4, 2024 20:13
@aemandine aemandine merged commit 377b7ce into main Sep 4, 2024
11 of 13 checks passed
@aemandine aemandine deleted the am/lems-2292/add-phet-getsavewarnings branch September 4, 2024 20:47
aemandine added a commit that referenced this pull request Sep 4, 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/[email protected]

### Major Changes

- [#1577](#1577)
[`c875acd01`](c875acd)
Thanks [@handeyeco](https://github.com/handeyeco)! - Remove example
widgets and their editors

### Minor Changes

- [#1570](#1570)
[`c4432ffad`](c4432ff)
Thanks [@nicolecomputer](https://github.com/nicolecomputer)! - Remove
unlimited points via keyboard


- [#1582](#1582)
[`377b7ce68`](377b7ce)
Thanks [@aemandine](https://github.com/aemandine)! - Add save warnings
to PhET widget editor and un-hide widget from content editor widget
dropdown

### Patch Changes

- [#1578](#1578)
[`78bb8573e`](78bb857)
Thanks [@aemandine](https://github.com/aemandine)! - Remove
simpleValidate from PhET widget


- [#1585](#1585)
[`a6ec402c0`](a6ec402)
Thanks [@handeyeco](https://github.com/handeyeco)! - Reorganize files in
the widgets folder


- [#1589](#1589)
[`d56952564`](d569525)
Thanks [@aemandine](https://github.com/aemandine)! - Make PhET widget
smaller


- [#1587](#1587)
[`8015cdefb`](8015cde)
Thanks [@aemandine](https://github.com/aemandine)! - Tidying up PhET
widget


- [#1583](#1583)
[`615567bd2`](615567b)
Thanks [@handeyeco](https://github.com/handeyeco)! - Remove sort-comp
exceptions and reorder components

## @khanacademy/[email protected]

### Major Changes

- [#1577](#1577)
[`c875acd01`](c875acd)
Thanks [@handeyeco](https://github.com/handeyeco)! - Remove example
widgets and their editors

### Minor Changes

- [#1582](#1582)
[`377b7ce68`](377b7ce)
Thanks [@aemandine](https://github.com/aemandine)! - Add save warnings
to PhET widget editor and un-hide widget from content editor widget
dropdown

### Patch Changes

- [#1585](#1585)
[`a6ec402c0`](a6ec402)
Thanks [@handeyeco](https://github.com/handeyeco)! - Reorganize files in
the widgets folder


- [#1587](#1587)
[`8015cdefb`](8015cde)
Thanks [@aemandine](https://github.com/aemandine)! - Tidying up PhET
widget


- [#1583](#1583)
[`615567bd2`](615567b)
Thanks [@handeyeco](https://github.com/handeyeco)! - Remove sort-comp
exceptions and reorder components

- Updated dependencies
\[[`78bb8573e`](78bb857),
[`a6ec402c0`](a6ec402),
[`d56952564`](d569525),
[`c875acd01`](c875acd),
[`8015cdefb`](8015cde),
[`c4432ffad`](c4432ff),
[`615567bd2`](615567b),
[`377b7ce68`](377b7ce)]:
    -   @khanacademy/[email protected]

## @khanacademy/[email protected]

### Patch Changes

- [#1585](#1585)
[`a6ec402c0`](a6ec402)
Thanks [@handeyeco](https://github.com/handeyeco)! - Reorganize files in
the widgets folder
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