Repository navigation
playground: show the examples as chips grouped by what SQLQuack does - #149
Merged
Merged
Conversation
The six examples were hidden in a dropdown. They are now buttons above the editor, in three groups that echo the tagline: "Runs it" (verified results), "Catches the mistake" and "Says no, clearly" (a clear no). Each chip names the stage where its example stops; the test derives each example's actual stop stage from the engine and, for the ones that translate, a DuckDB-WASM run, and fails when a label drifts. A click loads and runs the example, marks the chip pressed and puts ?example=<slug> in the address with history.replaceState, so each example can be shared. A link with a slug, or an earlier example key, opens that example; an unknown one opens the default. Editing the SQL clears the chip and the slug.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Website-only change: the playground page, its styles and its test. Nothing under
website/wasm/, and no engine or converter changes.The "Examples…" dropdown is replaced by always-visible example chips above the editor, in three groups that echo the tagline:
aria-pressedand highlighted.stopsinexamples.js, andtests/playground.test.mjsderives every example's actual stop stage: the first of parse, checks and translate that does not pass, or, for examples that translate, a run of the translated SQL against the page's fixture tables and rows in the same DuckDB-WASM build the page serves (duckdb-node-blocking, DuckDB v2.0.0). The test fails if a label drifts. I checked this by mislabelling two chips: the test failed on each.?example=<slug>(converts-and-runs,decimal-division,syntax-error,snowflake-rejects-it,unknown-column,translation-refused) loads and runs that example. A chip click writes the slug withhistory.replaceState. The earlier keys (?example=refused, etc.) still work, an unknown slug opens the default example quietly, and?sql=is unchanged. Editing the SQL clears the chip and removes the slug, so a link never names an example the editor no longer holds.Checked locally:
npm run -s test:engine(12 pass),npm run build,check_links.py(0 broken). In the browser I clicked through all six chips (URL, pressed chip and stages each matched the label), loaded the new slug, an unknown slug, an old key and?sql=cold, edited the SQL to clear the chip, and pressed Tab then Enter on a chip. Screenshots were taken at 1280 px and 390 px in light and dark.