Playground browser application.
| Tool | Version |
|---|---|
| git | * |
| node | >=18.15.0 |
| npm | >=9.5.0 |
-
Clone this repository
git clone git@github.com:bugboxau/PlayGround.git
-
change workdirectory to
project,cd Playground -
Install project dependencies
npm i
-
Run the app in the development mode, Open http://localhost:3000 to view it in the browser
npm run start
-
Builds the app for production to the
buildfolder.npm run build
This application is built using react.js.
This project was bootstrapped with Create React App.
| Package | Description |
|---|---|
| blockly | Build blocks |
| codemirror | Code preview |
| @reduxjs/toolkit | State management tool |
| avrgirl-arduino | Upload hex / binary to arduino |
| react-bootstrap(bootstrap) | UI component library |
| bootstrap | UI library |
| react-router-dom | Page transition (navigation) |
| axios | HTTP library to make network calls |
| aws-rum-web | telemetry |
| @react-three | 3D rendering |
| react-dnd | drag and drop functionality |
├── infra
├── public
| └── media
└── src
├── App
| ├── Features
| | ├── Common # Shared components, utilities and hooks
| | | ├── Presentation
| | | | ├── Components
| | | | ├── Hooks
| | | | ├── Providers
| | | | ├── Store
| | | | └── ViewModels
| | | └── Repository
| | | └── Model
| | ├── JoinPlayground
| | | ├── Presentation
| | | | ├── Components
| | | | └── Viewmodel
| | | ├── Repository
| | | └── Usecase
| | └── Playground
| | ├── Presentation
| | | ├── Components
| | | | ├── CodePlaceholder
| | | | ├── CodePreview
| | | | ├── Editor
| | | | └── Menu
| | | ├── Screens
| | | └── ViewModels
| | ├── Repository
| | └── Usecase
| | └── LoginGame # Drag and drop login game
| | └── PlanetMatchGame # 3D solar system - planet match game
| ├── Lib # Bugbox blockly extensions
| | └── Blockly
| | ├── blocks # Contains block UI customization and code generation
| | | ├── comments # comment blocks
| | | ├── control # control blocks
| | | ├── io # input output blocks
| | └───── variables
| └── i18n # Translations
├── Assets
| ├── Icons
| └── Images
└── Domain # models
├── Entity
├── Model
├── Repository
└── usecases
This application will works only on chrome browser, due to the limitation of serial port feature in other modern browsers.
The following table shows the support for core features of this application
| Feature | Browser (version) | supported |
|---|---|---|
| Serial port selection | Chrome | ✅ |
| Compilation | " | ✅ |
| Code upload to arduino nano | " | ✅ |
| Code generation | " | ✅ |
| Serial port selection | Safari | ❌ |
| Compliation | " | ✅ |
| Code upload to arduino nano | " | ❌ |
| Code generation | " | ✅ |
| Device | OS | tested | supported |
|---|---|---|---|
| Macbook pro | monterey | ✅ | ✅ |
| Chromebook | ?? | ?? | ?? |
To extend the bugbox blockly implementation, add block implementation details inside of src/App/Lib/Blockly/blocks defintion and generator files.
There are three types of blockly categories are implemented ot avialable in the current application.
- Control
- Input & output
- Comment
Apart from these custom categories, we have a variable category, which is blockly predefined category.
A block definiton is a javascript or json configuration, that visualizes how the block should look.
Each block definition must have a generator file, which will produce a equavalent code.
InoScript is bugbox version code generation implementation, which will combine the generated code, of all the individual blocks, based on the connected nodes (or other blocks).
InoScript now supports following functionalities
- variables
- functions
void setupvoid loop- import
definitionsor other declrations includingcomments
- 1 Add
BlockTypeinsrc/App/Lib/blockly/types.ts - 2, 3 Add definition and generator files under a specific block category folder inside of
src/App/Lib/Blockly/blocks - 4 Add definition and generator imports in
src/App/Lib/Blockly/blocks-registry.ts - 5 Add block in
src/App/Lib/blockly/toolbox.tsto render the block in toolbox category UI
Use the following command to complete the steps from 1 to 4,
chmod +x scripts/cli.js
# This command will create a block for servo under control category
./scripts/cli.js b servo -c controlor
npm run add-block b servo -- -c controlOnce the files are generated, add the new block in toolbox.ts
