Repository navigation
Add browser-only demo for GitHub Pages - #68
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F3v6g2oCeEBQuqUzmh7Hr5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F3v6g2oCeEBQuqUzmh7Hr5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F3v6g2oCeEBQuqUzmh7Hr5
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.
Adds a fully functional browser-based demo of the CMS that runs entirely in the browser with no server backend. The demo is published to GitHub Pages at https://trainpaths.github.io/cms/ and serves as an interactive introduction to the block editor.
Key changes
Demo infrastructure (
playground/demo/): Complete in-browser implementation including:seed.ts: Seeded demo page with multilingual content (English, German, French, Italian) and site configurationmockApi.ts: In-browser mock of the API that interceptsfetchcalls and mirrors the real API's draft/live rulesstore.ts: localStorage-backed state management for the demo page, with reset capabilitymockApi.test.ts: Unit tests for the mock API covering publish/draft workflows and storage persistenceDemo UI components:
DemoApp.vue: Root component with router and UI containersDemoMenu.vue: Floating demo control panel (edit/view toggle, reset, links to GitHub)EditPage.vue: Real editor component pointing to the demo pageViewPage.vue: Public page view with language switching and navigationcontext.ts: Injection context for demo state and language managementmain.ts: App initialization with i18n, router, and mock API setupDemo assets:
media.ts: Fixed image library (no upload in demo)lake.svg,mountains.svg,city.svg,forest.svg,blocks.svg,waves.svg,logo.svgmessages.ts: Demo-specific UI strings (English, German, French, Italian)Build configuration:
vite.demo.config.ts: Separate Vite config for the demo build with custom plugin to swap out the upload buttondemo.html: Single-page entry pointvitest.config.ts: Test configuration for demo unit testsCI/CD:
.github/workflows/pages.yml: New workflow to build and deploy the demo to GitHub Pages on pushes to mainci.ymlto run demo tests + build as part of the CI pipelineConfiguration updates:
package.json: Addedbuild:demo,dev:demo, andtest:demoscriptstsconfig.app.jsonandtsconfig.node.json: Include demo files in TypeScript compilation.gitignore,.dockerignore,eslint.config.js: Excludedist-demobuild artifactsDocumentation:
playground/CLAUDE.mdwith demo section explaining the architectureREADME.mdto link to the cms-starter templateImplementation details
The mock API (
mockApi.ts) faithfully reproduces the real API's behavior:hasUnpublishedChangesand timestampsThe demo uses the real editor and public view components from the package, ensuring the demo accurately reflects actual CMS behavior. Language switching works across both the editor and public view, with proper locale loading and fallback handling.