Skip to content

Conversation

@zetter-rpf
Copy link
Contributor

It's handy to be able to quickly try out different projects, and later when we introduce scratch it would be useful to be able to get a scratch project from the test page without a dependency on another app.

To do this, allow an initialProject to be set in the web component.

I've set up json files for sample projects and used AI to generate interesting multi-file HTML and Python projects.

New project bar at the top:

Screenshot 2026-01-27 at 10 40 18

@zetter-rpf zetter-rpf temporarily deployed to previews/1294/merge January 27, 2026 10:42 — with GitHub Actions Inactive
@zetter-rpf zetter-rpf force-pushed the improve-code-editor-test-page branch from 5864a9c to aaae63b Compare January 29, 2026 10:20
@zetter-rpf zetter-rpf temporarily deployed to previews/1294/merge January 29, 2026 10:21 — with GitHub Actions Inactive
@zetter-rpf zetter-rpf force-pushed the improve-code-editor-test-page branch from aaae63b to b632bf6 Compare January 29, 2026 11:10
@zetter-rpf zetter-rpf temporarily deployed to previews/1294/merge January 29, 2026 11:10 — with GitHub Actions Inactive
@zetter-rpf zetter-rpf changed the title Improve code editor test page Add sample projects to code editor test page Jan 29, 2026
@zetter-rpf zetter-rpf force-pushed the improve-code-editor-test-page branch from b632bf6 to 68a3f53 Compare January 29, 2026 11:30
@zetter-rpf zetter-rpf temporarily deployed to previews/1294/merge January 29, 2026 11:30 — with GitHub Actions Inactive
I want to use add more demos to the web-component.html page, but it would be easier if we could load a project directly by providing JSON rather than providing an identifier that has to be loaded through an API.

If this was just react I would pass in a loadProject function, but it's harder to pass in behaviour like that to web components.

This is only intended to be set when the component is loaded and not changed during the lifecycle of the component.
It's handle to be able to quickly try out different projects, and later when we introduce scratch it would be useful to be able to get a scratch project from the test page without a dependnecy on another app.

I've set up json files for the projects and used AI to generate interesting multi-file html and python projects
@zetter-rpf zetter-rpf force-pushed the improve-code-editor-test-page branch from 68a3f53 to 0a08227 Compare January 29, 2026 13:37
@zetter-rpf zetter-rpf temporarily deployed to previews/1294/merge January 29, 2026 13:37 — with GitHub Actions Inactive
@zetter-rpf zetter-rpf temporarily deployed to previews/1294/merge January 29, 2026 13:47 — with GitHub Actions Inactive
@zetter-rpf zetter-rpf force-pushed the improve-code-editor-test-page branch from dda89a7 to 47b4bb1 Compare January 29, 2026 14:20
@zetter-rpf zetter-rpf temporarily deployed to previews/1294/merge January 29, 2026 14:20 — with GitHub Actions Inactive
On this branch this test consistently fails. I'm not sure why this test is failing as there are other similar tests. Try seting test isolation in case other tests are interfering
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds sample project loading functionality to the code editor test page, enabling quick testing of different project types without external dependencies. It introduces a new initial_project web component attribute that accepts JSON project data, along with a UI bar containing links to load predefined sample projects (blank and "cool" examples for both HTML and Python).

Changes:

  • Added initial_project attribute support to the web component for loading projects from JSON
  • Created sample project JSON files with starter templates and demonstration projects
  • Updated webpack configuration to serve project files from src/projects directory
  • Modified test page HTML to include a project selector bar and improved layout structure

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
webpack.config.js Added static file serving and copy patterns for project JSON files
src/web-component.js Added initial_project to observed attributes list
src/web-component.html Added sample projects bar UI and fetch logic to load projects dynamically
src/projects/*.json Four sample project files (blank starters and demo projects for HTML/Python)
src/hooks/useProject.js Added logic to parse and load initialProject parameter with priority handling
src/hooks/useProject.test.js Added test coverage for initialProject feature
src/containers/WebComponentLoader.jsx Added initialProject prop forwarding
src/containers/WebComponentLoader.test.js Updated test expectations to include initialProject parameter
package.json Removed JSON files from eslint configuration (appropriate change)
cypress.config.mjs Enabled testIsolation (standard Cypress configuration)
CHANGELOG.md Added entry for this feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zetter-rpf
Copy link
Contributor Author

Grr, I'm having some problems with an intermittently failing test - it's mostly failing in CI, and occasionally failing locally. I think I must have made some change that makes the failure more likely but I'm not sure what it is.

Will look on Monday.

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