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

[Storybook: Editor Page] Add a working preview for the editor page in storybook #1372

Merged
merged 2 commits into from
Jun 21, 2024

Conversation

nishasy
Copy link
Contributor

@nishasy nishasy commented Jun 21, 2024

Summary:

The preview iframe doesn't work in storybook, because in links to a local URL
to webapp when it's in prod. It has never worked in storybook.

We need to be able to see what the initial state of the questions on the editor
page would look like without making any changes to the actual preview (yet).

I've added a preview here that shows the question and the hints in the editor
page. This works for all widgets. It's sticky, so it follows as you scroll
down a long editor. You can also close it if it's taking too much space.

This is a prerequisite to viewing an interactive graph with initial coordinates.

Issue: https://khanacademy.atlassian.net/browse/LEMS-2051

Test plan:

http://localhost:6006/?path=/story/perseuseditor-editorpage--demo

Interactive graph widget

Screenshot 2024-06-21 at 2 58 45 PM

Expression widget

Screenshot 2024-06-21 at 2 58 14 PM

Demo video

Screen.Recording.2024-06-21.at.2.57.00.PM.mov

… storybook

The preview iframe doesn't work in storybook, because in links to a local URL
to webapp when it's in prod. It has never worked in storybook.

We need to be able to see what the initial state of the questions on the editor
page would look like without making any changes to the actual preview (yet).

I've added a preview here that shows the question and the hints in the editor
page. This works for all widgets. It's sticky, so it follows as you scroll
down a long editor. You can also close it if it's taking too much space.

This is a prerequisite to viewing an interactive graph with initial coordinates.

Issue: https://khanacademy.atlassian.net/browse/LEMS-2051

Test plan:
http://localhost:6006/?path=/story/perseuseditor-editorpage--demo
@nishasy nishasy self-assigned this Jun 21, 2024
@nishasy nishasy requested review from benchristel and a team June 21, 2024 22:05
@nishasy nishasy marked this pull request as ready for review June 21, 2024 22:05
@khan-actions-bot
Copy link
Contributor

khan-actions-bot commented Jun 21, 2024

Gerald

Required Reviewers
  • @Khan/perseus for changes to .changeset/sweet-zebras-impress.md, packages/perseus-editor/src/__stories__/editor-page-with-storybook-preview.tsx, packages/perseus-editor/src/__stories__/editor-page.stories.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 Jun 21, 2024

Size Change: 0 B

Total Size: 846 kB

ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 38.2 kB
packages/kmath/dist/es/index.js 4.26 kB
packages/math-input/dist/es/index.js 80.1 kB
packages/math-input/dist/es/strings.js 1.73 kB
packages/perseus-core/dist/es/index.js 906 B
packages/perseus-editor/dist/es/index.js 272 kB
packages/perseus-error/dist/es/index.js 866 B
packages/perseus-linter/dist/es/index.js 21.8 kB
packages/perseus/dist/es/index.js 407 kB
packages/perseus/dist/es/strings.js 3.21 kB
packages/pure-markdown/dist/es/index.js 3.67 kB
packages/simple-markdown/dist/es/index.js 12.4 kB

compressed-size-action

Copy link

codecov bot commented Jun 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.84%. Comparing base (86f94e1) to head (cf5ad6d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1372      +/-   ##
==========================================
+ Coverage   69.44%   70.84%   +1.39%     
==========================================
  Files         491      496       +5     
  Lines      103849   103946      +97     
  Branches     7450    10571    +3121     
==========================================
+ Hits        72123    73642    +1519     
+ Misses      31546    30304    -1242     
+ Partials      180        0     -180     

Impacted file tree graph

see 153 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 86f94e1...cf5ad6d. Read the comment docs.

Copy link
Member

@benchristel benchristel 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 for adding this and cleaning up that duplicated story code!

One comment about naming inline; otherwise, LGTM!


const onChangeAction = action("onChange");

function EditorPageUtil(props: Props) {
Copy link
Member

Choose a reason for hiding this comment

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

The name EditorPageUtil isn't particularly intuitive / self-explanatory to me. Maybe this component could be named something like EditorPageWithStorybookPreview?

Copy link
Contributor

npm Snapshot: Published

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

Example:

yarn add @khanacademy/perseus@PR1372

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

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

@nishasy nishasy merged commit 8cbfeba into main Jun 21, 2024
13 checks passed
@nishasy nishasy deleted the editor-preview branch June 21, 2024 23:31
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