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

#6800 Page Editor Walkthrough Modal #6894

Merged
merged 30 commits into from Nov 17, 2023

Conversation

mnholtz
Copy link
Collaborator

@mnholtz mnholtz commented Nov 16, 2023

What does this PR do?

  • Closes Page Editor walkthrough modal #6800
  • Adds a Page Editor walkthrough modal with instructions for opening the Page Editor on the current page. This modal can be triggered from links in the Quickbar and the Mod Launcher footer.
  • Also adds PageEditorWalkthroughModalView and PageEditorWalkthroughModalClose events

Demo

Checklist

@twschiller
Copy link
Contributor

twschiller commented Nov 16, 2023

The modal approach is looking good.

  • For the vertical height, you likely want to make the modal body scroll, but not the header/footer
  • @BrandonPxBx: let's make sure to update the UX to refer to Chrome DevTools correctly/consistently. They are the "Chrome DevTools"/"DevTools": https://developer.chrome.com/docs/devtools/
  • Let's make sure to run the copy through a grammar checker. E.g., "it's magic" should not have an apostrophe

Is there a reason we're using images for the shortcuts keys vs. using our Shortcut Keys component?:

const ShortcutKeys: React.FC<{ shortcut: string | null }> = ({ shortcut }) => {

@BrandonPxBx a simpler shortcut is F12. Did we want to include that shortcut as well?

@grahamlangford
Copy link
Collaborator

QQ: Did you run the svgs through an optimizer?

@mnholtz
Copy link
Collaborator Author

mnholtz commented Nov 16, 2023

@grahamlangford was having trouble getting typescript to recognize the webp format, so due to time constraints I'm going to use png's in place of the hefty svgs, see https://github.com/pixiebrix/pixiebrix-extension/actions/runs/6897518554/job/18765844476

Happy to discuss things I tried later if you'd like to dig in; I checked the tsconfig and experimented with webpage config as well

@mnholtz mnholtz marked this pull request as ready for review November 16, 2023 23:30
Copy link
Contributor

@twschiller twschiller left a comment

Choose a reason for hiding this comment

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

Conditionally approved: see comment on splitting out the context script vs. walkthrough code: https://github.com/pixiebrix/pixiebrix-extension/pull/6894/files#r1396636873

Copy link

When the PR is merged, the first loom link found on this PR will be posted to #sprint-demo on Slack. Do not edit this comment manually.

@mnholtz mnholtz enabled auto-merge (squash) November 17, 2023 17:10
@mnholtz mnholtz merged commit a8c2b82 into main Nov 17, 2023
10 checks passed
@mnholtz mnholtz deleted the feature/6800_page_editor_walkthrough_modal branch November 17, 2023 17:13
} finally {
reportEvent(Events.PAGE_EDITOR_WALKTHROUGH_MODAL_CLOSE);
controller.abort();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This promise/controller setup should be reviewed, I see several issues with it:

  1. modal can't throw because we control it, and it only calls .resolve, so no need for try/catch
  2. The controller and the promise are doing the same thing (closing the modal), so they should be merged (e.g. registerWalkthroughModal should return the signal)
  3. If showModal is managing the modal, why are its registration and abort not also handled by it?
  4. AbortControllers aren't meant to be passed around, there should be one controller that allows for listening via the signal

I think this should look like:

- const controller = new AbortController();
- const modal = registerWalkthroughModal();
- showModal({ url: frameSource, controller });
- try {
-   await modal;
- } finally {
-   reportEvent(Events.PAGE_EDITOR_WALKTHROUGH_MODAL_CLOSE);
-   controller.abort();
- }
+ await showModal({ url: frameSource });
+ reportEvent(Events.PAGE_EDITOR_WALKTHROUGH_MODAL_CLOSE);

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.

Page Editor walkthrough modal
5 participants