feat(tutorial): add interactive in-browser runners to most read-only tutorials - #161
feat(tutorial): add interactive in-browser runners to most read-only tutorials#161thephez wants to merge 7 commits into
Conversation
Add a reusable interactive-tutorial block (JS runner + CSS) that lazily loads the Evo SDK from esm.sh and executes the visible snippet against testnet. Wire it up in conf.py as a classic deferred script and embed a read-only identity fetch example in the retrieve-an-identity tutorial.
…rials Rework the runner to support multiple named inputs (data-param) and per-operation result renderers (identity, contract, name, documents, status), materializing form values as declarations in the displayed snippet so the visible code is exactly what executes. Add Try it blocks to the connect, retrieve-a-data-contract, retrieve-documents, and retrieve-a-name tutorials, and migrate the retrieve-an-identity block to the new attributes.
…ion allow-list Replace AsyncFunction evaluation of DOM-embedded snippet text with an explicit map of read-only operation functions selected via data-operation. The displayed source is derived from the same function that runs, so the markup is no longer executable and the shown code cannot drift from the executed code. Also stack the action buttons on narrow viewports.
…ples Drop the standalone Try It sections and attach each runner directly below the tutorial's code block with a compact toolbar, a text-style reset button, and a View browser code toggle. Expand the status renderer to show network, block height, sync state, peers, and component versions, and improve narrow-viewport layout for inputs, metrics, and the toolbar.
…and token info Add allow-listed operations for contract history, identity name lookup, DPNS prefix search, and token info, with matching renderers and runner blocks in the contract history, name retrieval, and token info tutorials. Support per-operation constants (DPNS contract ID) in the displayed source and rename the normalized Map key field to mapKey so the history renderer can read revision timestamps.
Interactive tutorial runners now import a self-hosted esbuild bundle (_static/vendor/evo-sdk.js) built from the npm-pinned @dashevo/evo-sdk 4.1.1 rather than fetching esm.sh at runtime. Read the Docs generates the bundle in a pre_build job; locally, make html rebuilds it via the new sdk target after a one-time make sdk-install. Also bump the lite demo apps' esm.sh pin to 4.1.1 to match the bundled version, exclude node_modules from the Sphinx build, and document the setup in CLAUDE.md.
…ycle - Validate number inputs against their min/max bounds before running and cap token position at 65535 - Guard runs with a generation counter so a reset cancels stale results instead of racing the UI - Format large integers via BigInt to avoid precision loss and cache the SDK import with retry after a failed load - Add Node 22 to the devcontainer and run make sdk-install during post-create so the SDK bundle builds - Document serving _build/html over HTTP since browsers block the SDK module import from file:// pages Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (21)
Included review availability: Your plan provides up to 3 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe documentation adds a bundled Evo SDK, interactive testnet tutorial widgets, browser-side query execution, result rendering, responsive styling, and SDK build integration for local and Read the Docs builds. ChangesInteractive Evo SDK tutorials
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to This change adds read-only interactive tutorial runners and local SDK bundling; no actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant TutorialWidget
participant InteractiveTutorial
participant BundledEvoSDK
participant Testnet
TutorialWidget->>InteractiveTutorial: submit operation and inputs
InteractiveTutorial->>BundledEvoSDK: load SDK and execute read-only query
BundledEvoSDK->>Testnet: request testnet data
Testnet-->>BundledEvoSDK: return query response
BundledEvoSDK-->>InteractiveTutorial: return SDK result
InteractiveTutorial-->>TutorialWidget: render status and results
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Overview
Adds interactive "try it" widgets to the JavaScript (Evo SDK) tutorials so readers can run the documented queries against testnet directly from the docs page. Each widget executes one of a fixed allow-list of read-only operations, and the code shown on the page is derived from the same function the Run button invokes, so the displayed example can never drift from what actually runs. The Evo SDK is now bundled locally at build time instead of being imported from esm.sh at runtime.
Highlights
_static/vendor/evo-sdk.js), pinned viapackage-lock.json; Read the Docs builds it in apre_buildjob andmake htmlrebuilds it locallymake sdk-install/sdktargets, devcontainer Node 22 support, widget CSS styling, and docs on serving_build/htmlover HTTP (browsers block the SDK module import from file:// pages)Summary by CodeRabbit
New Features
Documentation
Maintenance
Preview build: https://dash-docs-platform--161.org.readthedocs.build/en/161/