Skip to content

Latest commit

 

History

History
47 lines (30 loc) · 4.46 KB

website.md

File metadata and controls

47 lines (30 loc) · 4.46 KB

Website architecture

Current scope

Vite builds a single static HTML entry point. The homepage, My Projects and editor use the same htm application and switch views through @lsongdev/scripts/react and its hash router. The router loads the editor on demand at /#/editor. The homepage is independent of Blockly, device transports and firmware loaders.

Path Responsibility Status
/ (index.html) Product introduction, features, hardware support, guide and editor links Implemented
/#/editor Blocks, Python, device and project editing Implemented
/#/projects Local project management Implemented
/#/editor?id=<id> Open a specific local project Implemented
/examples.html Example discovery Optional future page
/firmware/ Build-generated, checksum-verified firmware files Existing

The homepage links directly to both the editor and My Projects. The editor brand links back home. Opening the editor without an ID creates a readable verb-noun project in IndexedDB and redirects to its ID URL; opening with an ID loads that project. The name can change without changing the ID. There is no draft or legacy migration. Both pages depend only on the project repository, not each other's UI.

Source organization

  • src/main.js is the single bootstrap: router configuration, global styles and initial render.
  • src/app.js owns the application shell, shared language context, navigation and route outlet.
  • src/home.js exports HomePage.
  • src/projects.js exports ProjectsPage.
  • src/editor/page.js exports the lazy EditorPage, handles project selection and mounts or aborts the editor runtime.
  • src/editor/app.js owns Blockly initialization, project persistence, device communication and workspace cleanup; src/editor/view.js renders the editor markup.

Pages share the application context and project repository, not each other's UI. There is no separate site/ layer.

Homepage

The site shell shares navigation, language state and a footer across both views. htm templates render semantic HTML in plain JavaScript. @lsongdev/stylesheets supplies the base theme, layout and common components. PyBlocks CSS supplies the site palette and page-specific styling. Vite bundles the runtime and styles with the site. The block/Python/console preview is explicitly an illustrative example, not a running editor. Use accurate feature and board claims; STM32 USB DFU is experimental and firmware variants remain board-specific.

The routed site and editor share the existing pyblocks.language and pyblocks.theme preference keys. The homepage defaults to English and follows the stored theme or system preference. The editor owns editing, device permission requests and connections.

Build and deployment

Vite builds index.html as the sole HTML entry point. All routes work on static hosting through URL fragments. The editor markup, styles and Blockly dependencies load only when the editor route opens. Keep all resource paths relative to the deployment directory for custom domains and GitHub Pages subpaths. The firmware preparation and postbuild checks remain in npm scripts. The firmware path and storage origin are shared across routes.

Shared web utilities are installed through npm from the lsongdev/scripts GitHub master branch, not the live website or the npm registry. The lockfile records the reproducible installation baseline. CI checks the current master commit and installs it if newer before testing and building; no changes are written back to the repository by CI. To update the local lockfile, run npm update @lsongdev/scripts. Vite bundles imported modules normally for offline use.

PWA identity and scope are ./, and the installed app starts at ./#/editor. The precache contains index.html and the editor's lazy chunks. The browser handles the route and project ID in the fragment. Firmware remains on-demand, outside the precache. Existing installed apps may retain old manifest metadata until the browser refreshes it.

Next steps

See project management for implemented storage and integration contracts. Keep user guides and API inventories as Markdown in docs/; link to them from the homepage until a dedicated documentation site is useful. Do not create placeholder routes or restructure working subsystems before they are needed.

The homepage retains editor entry points in the navigation and hero; the closing primary action opens My Projects instead of creating another project.