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

Support JSX and Interactive UI in simulator #2409

Merged
merged 32 commits into from
Jun 27, 2024

Conversation

GuillaumeRx
Copy link
Contributor

@GuillaumeRx GuillaumeRx commented May 15, 2024

Description

This PR allows the simulator to consume the new JSX components from Snaps custom UI.

It also enable interactive interfaces to work in the simulator.

Breakdown:

  • Renderer:

    • Swap the old component format to the JSX format
    • Create a Context provider to provide interaction handlers to the components
  • OnRpcRequest and OnTransaction:

    • Add the missing hooks and handlers to the simulation backend and Redux Store
    • Create a dupe of the interface in the redux store to enable reactive re-rendering of the interface.
    • Interfaces now all go through the SnapInterfaceController
  • UI Builder:

    • Refactor the code generation methods
    • Refactor the component extraction methods
    • Adds the Field component

Copy link

socket-security bot commented May 15, 2024

@GuillaumeRx GuillaumeRx force-pushed the gr/fix-simulator-interactive-interface branch 2 times, most recently from 6bf80d6 to 26f6de0 Compare May 29, 2024 14:21
Copy link

socket-security bot commented May 31, 2024

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

@GuillaumeRx GuillaumeRx changed the title [WIP] Support JSX in simulator Support JSX in simulator Jun 6, 2024
@GuillaumeRx GuillaumeRx changed the title Support JSX in simulator Support JSX and Interactive UI in simulator Jun 6, 2024
@GuillaumeRx GuillaumeRx force-pushed the gr/fix-simulator-interactive-interface branch from 45829da to 9e8ebe8 Compare June 6, 2024 12:20
@GuillaumeRx GuillaumeRx force-pushed the gr/fix-simulator-interactive-interface branch 2 times, most recently from 64eebf3 to e83ea97 Compare June 12, 2024 09:47
@GuillaumeRx GuillaumeRx marked this pull request as ready for review June 12, 2024 10:18
@GuillaumeRx GuillaumeRx requested a review from a team as a code owner June 12, 2024 10:18
@GuillaumeRx GuillaumeRx force-pushed the gr/fix-simulator-interactive-interface branch from 81508a6 to cc99d28 Compare June 12, 2024 10:20
Copy link

codecov bot commented Jun 12, 2024

Codecov Report

Attention: Patch coverage is 71.94245% with 117 lines in your changes missing coverage. Please review.

Project coverage is 93.85%. Comparing base (0a286e1) to head (c00c39f).

Files Patch % Lines
...ges/snaps-simulator/src/contexts/SnapInterface.tsx 36.73% 31 Missing ⚠️
...lator/src/features/builder/components/NodeTree.tsx 8.33% 11 Missing ⚠️
...ulator/src/features/renderer/components/Button.tsx 25.00% 9 Missing ⚠️
...mulator/src/features/renderer/components/Field.tsx 43.75% 9 Missing ⚠️
...imulator/src/features/renderer/components/Form.tsx 38.46% 8 Missing ⚠️
...mulator/src/features/renderer/components/Input.tsx 36.36% 7 Missing ⚠️
...s/snaps-simulator/src/features/simulation/sagas.ts 76.00% 6 Missing ⚠️
...mulator/src/features/renderer/components/Image.tsx 16.66% 5 Missing ⚠️
packages/snaps-simulator/src/utils/render.tsx 87.87% 4 Missing ⚠️
...c/features/builder/components/TextEditableNode.tsx 40.00% 3 Missing ⚠️
... and 11 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2409      +/-   ##
==========================================
- Coverage   94.42%   93.85%   -0.57%     
==========================================
  Files         444      453       +9     
  Lines        9161     9412     +251     
  Branches     1416     1436      +20     
==========================================
+ Hits         8650     8834     +184     
- Misses        511      578      +67     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@GuillaumeRx GuillaumeRx force-pushed the gr/fix-simulator-interactive-interface branch 2 times, most recently from 5705bc9 to 9757143 Compare June 13, 2024 09:02
@GuillaumeRx GuillaumeRx requested a review from Mrtenz June 13, 2024 09:02
@GuillaumeRx GuillaumeRx force-pushed the gr/fix-simulator-interactive-interface branch from c713b97 to 9b67951 Compare June 13, 2024 09:22
@GuillaumeRx GuillaumeRx force-pushed the gr/fix-simulator-interactive-interface branch from 9b67951 to 43c218d Compare June 13, 2024 12:09
@GuillaumeRx GuillaumeRx requested a review from Mrtenz June 13, 2024 14:29
@GuillaumeRx GuillaumeRx force-pushed the gr/fix-simulator-interactive-interface branch 3 times, most recently from 68a3327 to 1e05880 Compare June 19, 2024 14:22
@GuillaumeRx
Copy link
Contributor Author

@metamaskbot update-pr

@GuillaumeRx GuillaumeRx force-pushed the gr/fix-simulator-interactive-interface branch from ba688e0 to b0d29d6 Compare June 26, 2024 11:34
@GuillaumeRx GuillaumeRx requested a review from Mrtenz June 26, 2024 14:25
@GuillaumeRx GuillaumeRx merged commit 35ae1e7 into main Jun 27, 2024
154 of 156 checks passed
@GuillaumeRx GuillaumeRx deleted the gr/fix-simulator-interactive-interface branch June 27, 2024 09:29
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.

None yet

3 participants