Giter VIP home page Giter VIP logo

playground's Introduction

Amphitheatre Playground

License GitHub contributors GitHub issues

What's it do?ArchitectureUsageDevelopmentContributing简体中文

What's it do?

Embedded Code runner in web pages, supports multiple programming languages. You can check demo and read more about features here.

It has a number of features, including:

  • A nice, unobtrusive editor with syntax highlighting.
  • Supports multiple programming languages, included its build tools.
  • The ability to quickly load preview for predefined code from a GitHub Project or Gist.
  • See console output in the component itself.

Architecture

A React frontend communicates with an Axum backend. Docker containers are used to provide the various compilers and tools as well as to help isolate them.

Playground Architecture

Usage

The Playground may be included on your site in one of two ways:

As a React Component

If you are using React, then you can add the playground-react component directly in your project, as simple as the following:

npm install --save @amphitheatre/playground-react
import Playground from '@amphitheatre/playground-react'

export default function App() {
  return <Playground style={{ width: 800, height: 500 }} />
}

As an iframe

If you're not using React, please deploy the project and backend server privately first, then include the Playground in an iframe.

<iframe
  width="880"
  height="425"
  frameborder="0"
  src="//playground.your-domain.com/?gist=6b8b99c93be318f254606a92955294ec"
></iframe>

Parameters

The Playground accepts the following props/parameters.

Title Description Default
title An optional title for the editor pane. ''
files A map of { [filename]: code }. This will take precedence over code if given. undefined
entry The filename of the file that runs first. This is only relevant when showing multiple files with the files parameter. ''
initialTab The filename of the tab to show by default. This is only relevant when showing multiple files with the files parameter. Defaults to the value of entry. entry
styles An map of inline style objects, applied to various elements to customize the style of the UI. Example: { header: { backgroundColor: 'red' } } {}
fullscreen Show a button to enable fullscreen editing (in most configurations of panes). Note that the iframe must have the allowfullscreen attribute for this to work. false
panes An array of UI panes to display. To display a pane without options, use a string. Otherwise, use an object with a type property. The available panes are: 'stack', 'editor', 'player', 'console'. Note that there must be a player pane for any code to run. For pane options, see below. ['editor', 'player']

Local development

To run the playground locally, run:

  • yarn to install dependencies
  • yarn build to compile the app and place it in the build/ directory
  • yarn start to serve from the build/ directory and open a page on your browser.

For a fast edit-refresh cycle when developing run yarn dev. This will start an http server and automatically re-compile the TypeScript, HTML and CSS files whenever they change.

Local development with Docker-compose

  • Make sure you have docker installed.
  • Clone or fork this repository.
  • Start server docker-compose up, add -d to docker-compose up if you'd like to run it in the background.

The first time will take some time to download the dependencies. they are downloaded only once, and then cached.

Development with Amphitheatre

Just like the other Amphitheatre examples, after installing the server and CLI software, and configuring the certificates and preferences, Execute the following command:

amp run

Contributing

If anything feels off, or if you feel that some functionality is missing, please check out the contributing page. There you will find instructions for sharing your feedback, building the tool locally, and submitting pull requests to the project.

This project is based on the Web3 Open Source General Playground product developed by Amphitheatre, which aims to help developers learn Web3 development better, and is co-sponsored by Amphitheatre and OpenBuild.

We will post some development tasks as task topics and label them as "Tasks", interested partners can evaluate the development time in the corresponding topics, we will pick the most suitable developer from them and assign the task to him, and we will give rewards after the task is completed and passes the PR.

For more information, please refer to How to Contribute and the Contribution Reward Announcement.

Contributors

lispking
King
jueduizone
IanXu
GrayJyy
GrayJiang
wangeguo
Eguo Wang
onlyheartt9
Challenger
dethan3
DEthan3
peewee92
Null
zouyuxuan
Null

License

Copyright (c) The Amphitheatre Authors. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

  https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

playground's People

Contributors

dethan3 avatar github-actions[bot] avatar jueduizone avatar lispking avatar onlyheartt9 avatar peewee92 avatar wangeguo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

playground's Issues

Load files from Github Project

When embedding an iframe, you can specify the repo parameter to load files from Github Repository. In order to prevent unnecessary trouble, the front-end only needs to provide the username/repo, and the Playground API will proxy the data on the server side.

The example is as follows:

<iframe
  width="880"
  height="425"
  frameborder="0"
  src="//play.amphitheatre.app/?repo=amphitheatre-app/amp-example-rust"
></iframe>

增加 NextJS 支持

工程增加对 NextJS 支持

如果你感兴趣,请在下方回复你的预计完成时间(小时),我们将根据时间支付你一定的激励,详情参考 How To Contribute

Load files from Gists

When embedding an iframe, you can specify the gist parameter to load a code snippet from Github Gist (which may have multiple files). In order to prevent unnecessary trouble, the front-end only needs to provide the Gist ID, and the Playground API will proxy the data on the server side.

The example is as follows:

<iframe
  width="880"
  height="425"
  frameborder="0"
  src="//play.amphitheatre.app/?gist=6b8b99c93be318f254606a92955294ec"
></iframe>

贡献激励公示

Github 账号 贡献记录 贡献奖励 发放记录
peewee92 需求评估和任务拆解 $5 已发放(Internal transfer )
peewee92 搭建初始化工程 $5 已发放(Internal transfer )
lispking Translate README.md to Chinese $5 TX Hash
lispking Translate docs/how_to_contribute.md to English $5 TX Hash
lispking Add Docker support $5 TX Hash
lispking CI/CD workflows with Github Actions $10 TX Hash
lispking Add Docker Compose support $10 TX Hash
onlyheartt9 Add NextJS 支持 $10 🧧
lispking After optimizing NextJS, Dockerfile and CI/CD process. $15 TX Hash
onlyheartt9 use storybook to build project struct $10 🧧
dethan3 Remove extra spaces in README.zh $5 🧧
onlyheartt9 Add rollup config to create npm package $10 待发放
onlyheartt9 add Editor,Console,Layout,Playground components $40 待发放
lispking CI/CD workflows with Github Actions $10 TX_Hash
zouyuxuan add scarb $10 Gate Internal transfer
zouyuxuan add cairo build pack $10 Gate Internal transfer
lispking Add a Hardhat sample of Solidity's project on the Ethereum blockchain $5 TX_Hash
lispking Add a Foundry sample of Solidity's project on the Ethereum blockchain $5 TX_Hash
lispking Create buildpack for hardhat $80 TX_Hash
lispking Create buildpack for Solidity $5 TX_Hash
lispking Create buildpack for Solc $5 TX_Hash
onlyheartt9 add api utils and sse api/hooks $10 待发放
lispking Create buildpack for Foundry $40 TX_Hash
lispking Add a sample of Leo's project on the Aleo blockchain $5 TX_Hash
lispking Create buildpack for Leo $80 TX_Hash
lispking Create buildpack for Aleo $15 TX_Hash
lispking Rename leo to leo-dist $5 TX_Hash
lispking Create meta buildpack for Leo $10 TX_Hash
lispking CI/CD workflows with Github Actions For leo-dist $40 TX_Hash
lispking CI/CD workflows with Github Actions For Leo $10 TX_Hash
lispking CI/CD workflows with Github Actions For Aleo $10 TX_Hash
lispking Rewrite using Go For Solc $20 TX_Hash
lispking CI/CD workflows with Github Actions For Solidity $10 TX_Hash
lispking CI/CD workflows with Github Actions For Solc $10 TX_Hash
lispking Rewrite using Go For Foundry $30 TX_Hash
lispking CI/CD workflows with Github Actions For Foundry $10 TX_Hash
lispking Rewrite using Go For Hardhat $15 TX_Hash
lispking CI/CD workflows with Github Actions For Hardhat $5 TX_Hash
zouyuxuan Support Starknet Scarb $150 Gate Internal transfer
onlyheartt9 Design and develop the Toolbar component $30 待发放
onlyheartt9 perf:optimize business logic $30 待发放
lispking Catalog support Leo $5 TX_Hash
lispking Create buildpacks for Leo $20 TX_Hash
lispking CI/CD workflows with Github Actions For leo-builder $30 TX_Hash
lispking Add Aleo example for amp $10 TX_Hash
lispking Add guide for amp-example-aleo under blockchian folder of Web3 Developer Guide $10 TX_Hash
iyi Creating the basic structure of the project for Solana buildpacks $40 TX_HASH
jiahao6635 content and Tree add ToSchema $5 Binance Pay
jiahao6635 Content Increased serialization $5 Binance Pay
jiahao6635 Add a file tree method $15 Binance Pay
jiahao6635 Implement update $10 Binance Pay
jiahao6635 Implement file query,create,delete,start $20 Binance Pay
jiahao6635 amp-common: repo add description $5 Binance Pay
lispking Support generate buildpack for template. $300 TX_Hash
lispking Support Tera template engine $30 TX_Hash
jiahao6635 git_trees rename get_tree $5 Binance Pay
lispking Support meta and builder template $30 TX_Hash
lispking Support custom configuration file $30 TX_Hash
lispking Support compile leo contract $5 TX_Hash
lispking Upgrade leo-dist version to 0.1.4 $5 TX_Hash
lispking Upgrade leo version to 0.1.3 $5 TX_Hash
lispking Support deploy aleo contract $80 TX_Hash
lispking Upgrade aleo version to 0.1.4 $20 TX_Hash
lispking Upgrade leo version to 0.1.4 and support Update Draft Release $20 TX_Hash
lispking Upgrade leo version to 0.1.5 $5 TX_Hash
lispking Add PlanEntryResolver handle For leo-dist $10 TX_Hash
lispking Add leo for BuildPlanRequire $40 TX_Hash
jiahao6635 folder get return Vec,add folder tree $40 Binance Pay
lispking Add PlanEntryResolver handle For Aleo $20 TX_Hash
lispking Add build.env and remove builder version $5 TX_Hash
lispking Add PlanEntryResolver handle For Leo $60 TX_Hash
lispking Use leo-dist and aleo instead of leo And Test $20 TX_Hash
lispking Bugfix unable to determine if '/workspace/build/.aleo' exists $10 TX_Hash
lispking Use leo instead of leo-dist and aleo And upgrade leo version to 0.1.6 $10 TX_Hash
lispking Update Env From BP_* to BPL_* $10 TX_Hash
lispking Upgrade aleo version to 0.1.10 $5 TX_Hash
lispking Upgrade leo version to 0.1.7 $20 TX_Hash
lispking Add PlanEntryResolver handle for buildpack $10 TX_Hash
jiahao6635 repo description is changed to Option $5 Binance Pay
jiahao6635 remove GithubFile blob_id fix file list Deserialization Error missing $5 Binance Pay
jiahao6635 Impl playbook create method $20 Binance Pay
jiahao6635 playbook create add reference $20 Binance Pay
iyi 检测逻辑以及对应的单元测试 $10 TX_Hash
lispking Add a sample of Move's project on the Aptos blockchain $20 TX_Hash
lispking Create buildpack for Aptos $80 TX_Hash
lispking Support init wallet before deploy $30 TX_Hash
lispking CI/CD workflows with Github Actions For Move $5 TX_Hash
lispking Create builder for Move $5 TX_Hash
lispking Add Aptos example for amp $5 TX_Hash
lispking Catalog Support Aptos $5 TX_Hash
lispking Add guide for amp-example-aptos under blockchian folder of Web3 Developer Guide $5 TX_Hash
lispking Update buildpack template $5 TX_Hash
lispking Update builder template $5 TX_Hash
lispking Update SUI sample $5 TX_Hash
lispking Creating the basic structure of the project for Sui buildpacks $200 TX_Hash
lispking Add AptosFramework check for detect $10 TX_Hash
lispking Add Sui Framework check for detect $10 TX_Hash
lispking Add Sui dependency and upgrade Aptos version to 0.1.3 $20 TX_Hash
lispking Change Aptos and Sui packages into an OR relationship $5 TX_Hash
lispking Upgrade move version to 0.1.1 $5 TX_Hash
lispking Catalog Support Sui $5 TX_Hash
lispking Add guide for amp-example-sui under blockchian folder of Web3 Developer Guide $5 TX_Hash
lispking Add Sui example for amp $10 TX_Hash
lispking Update MOVE_HOME Setting to layer.Path/move $10 TX_Hash
lispking Support remove -dist for buildpack project template $5 待发放
lispking Add AMP Buildpacks Author Guide $100 待发放
iyi feat: build solana $10 待发放
lispking amp-example-aptos: Upgrade aptos demo $5 待发放
lispking samples: Upgrade aptos demo $5 待发放
lispking docs: Upgrade aptos demo $5 待发放

Update README

There are a lot of improvements to be made in the README.md file of the project since this repository was just recently created. There a list of some things to improve on, but you don't have to limit yourself with them, feel free to share your opinions and suggestions.

  • Create a table for project ideas in this repo
  • Add contributors section
  • Add how to get started with this project section
  • Add More description of the projects

Files To Be modified:
https://github.com/amphitheatre-app/playground/blob/master/README.md

Drop more improvements that you can think of :)

Add Docker support

Integrate Docker to enhance portability, deployment ease, and version compatibility.

`@amphitheatre/playground` React Component

npm install --save @amphitheatre/playground
import Playground from '@amphitheatre/playground'

export default function App() {
  return <Playground style={{ width: 800, height: 500 }} />
}

制定前端选型和方案

我们需要你:

  1. 与后端贡献者沟通,评估技术选型和参考的方案,这里建议参考:Rust Playground
  2. 根据选型和方案,搭建初始工程,并拆解成关键开发任务
  3. 预估整体开发周期

如果你感兴趣,请在下方回复你的预计完成时间(小时),我们将根据时间支付你一定的激励,详情参考 Readme

Add Docker Compose support

On top of Docker support #1 , Docker Compose support is added to provide local integration development and testing.

This includes integration with at least two projects, playground and playground-api. The two are separate, and the docker-compose.yaml file doesn't fit in either project, so what should I do?

界面及组件开发

根据已有工程,参照 Rust Playground 进行界面开发,当前版本需要支持:

  1. RUN 功能
  2. CONFIG
  3. CHAIN(选择对应的链)

以上仅指页面实现和交互,具体实现由后端 API 实现,API 的对接调试会单独作为任务

如果你感兴趣,请在下方回复你的预计完成时间(小时),我们将根据时间支付你一定的激励,详情参考 How To Contribute

Fix build & publish images workflow not uploading artifacts error

After upgrading actions/upload-artfact@v4, it no longer supports multiple files uploaded to the same artifact name, causing the Build & Publish images workflow to report errors:

Artifact name is valid!
Root directory input is valid!
Error: Failed to CreateArtifact: Received non-retryable error: Failed request: (409) Conflict: an artifact with this name already exists on the workflow run

The docker.yml needs to be readjusted to specify more precise artifact names as directed by the official documentation Multiple uploads to the same named Artifact, see Amphitheatre Completed Configuration.

Add Amphitheatre support

Add .amp.toml file to add real-time progressive integration development based on Amphitheatre.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.