Skip to content

Commit

Permalink
Improved readme (#10)
Browse files Browse the repository at this point in the history
* update scripts

* testing script

* update permission

* update working-directory

* Raised quality bar

* improved performance

* update script

* update error code

* Raised the bar

* Update conditional

* Fixed type error

* Update beta

* cdn autodesk

* cdn autodesk comments

* comments canvas

* html comments

* matterport comments

* threejs comments

* cdn matterport

* cdn mouse

* cdn real time

* cdn three

* video cdn

* cdn wio

* Update CDN Projects

* update version

* update type

* Added Form Elements to samples

* Fixed project infos

* Fixed type check

* Improved read-me links
  • Loading branch information
vtnorton authored Jun 15, 2024
1 parent dd8a307 commit d0c78fa
Show file tree
Hide file tree
Showing 70 changed files with 10,201 additions and 2 deletions.
30 changes: 30 additions & 0 deletions js/cdn/forms-elements/.codesandbox/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
// These tasks will run in order when initializing your CodeSandbox project.
"setupTasks": [
{
"name": "Install Dependencies",
"command": "yarn install"
}
],
// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"start": {
"name": "start",
"command": "yarn start",
"runAtStart": true,
"preview": {
"port": 5173
}
},
"build": {
"name": "build",
"command": "yarn build",
"runAtStart": false
},
"preview": {
"name": "preview",
"command": "yarn preview",
"runAtStart": false
}
}
}
14 changes: 14 additions & 0 deletions js/cdn/forms-elements/.codesandbox/template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"title": "Sample Room for Mouse Pointers (CDN/JS)",
"description": "The Real-time Mouse Pointers feature enables real-time tracking of participants' cursor movements, allowing seamless collaboration within the same room. This is part of the SuperViz SDK.",
"iconUrl": "https://superviz.com/wp-content/uploads/2022/10/superviz-1-80x80.png",
"tags": [
"react",
"javascript",
"typescript",
"superviz",
"real-time",
"collaboration"
],
"published": true
}
2 changes: 2 additions & 0 deletions js/cdn/forms-elements/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
env.js
node_modules
14 changes: 14 additions & 0 deletions js/cdn/forms-elements/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "superviz-forms-editor-cdn-js",
"version": "1.0.0",
"description": "This is a sample project for the Forms Editor, based on cdn (js), for more information, go to docs.superviz.com",
"scripts": {
"dev": "npx live-server public/ --host=localhost",
"start": "npx live-server public/ --host=localhost"
},
"dependencies": {
"live-server": "^1.2.2"
},
"author": "",
"license": "ISC"
}
1 change: 1 addition & 0 deletions js/cdn/forms-elements/public/env.example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const DEVELOPER_KEY = "";
4 changes: 4 additions & 0 deletions js/cdn/forms-elements/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions js/cdn/forms-elements/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<title>SuperViz SDK</title>

<!-- SuperViz SDK -->
<script type="module" src="https://unpkg.com/@superviz/sdk@latest"></script>

<!-- Main script, after SDK -->
<script type="module" src="/scripts/main.js"></script>
<link rel="stylesheet" href="/styles/main.css" />
</head>
<body>
<div class="formelements">
<h1>Generic Form</h1>
<label>
Name: <br />
<input type="text" id="name" name="name" />
</label>
<label>
Email: <br />
<input type="email" id="email" name="email" />
</label>
<label>
What is your kind of pet?
<div className="radio-option">
<span> <input type="radio" name="pet" value="cat" id="cat" /> Cat </span>
<span> <input type="radio" name="pet" value="dog" id="dog" /> Dog </span>
<span> <input type="radio" name="pet" value="fish" id="fish" /> Fish </span>
</div>
</label>
</div>
</body>
</html>
1 change: 1 addition & 0 deletions js/cdn/forms-elements/public/projectInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const sampleInfo = { id: 'superviz-forms-editor-cdn-js', name: 'Forms Editor (Cdn/JavaScript)' };
30 changes: 30 additions & 0 deletions js/cdn/forms-elements/public/scripts/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { DEVELOPER_KEY } from "../env.js";
import { sampleInfo } from "../projectInfo.js";

const participant = Math.floor(Math.random() * 100);
const groupId = sampleInfo.id;
const groupName = sampleInfo.name;

async function initializeSuperVizRoom() {
const room = await window.SuperVizRoom.init(DEVELOPER_KEY, {
roomId: groupId,
group: {
id: groupId,
name: groupName,
},
participant: {
id: participant.toString(),
name: "John " + participant,
},
});

const formElements = new window.SuperVizRoom.FormElements({
fields: ['name', 'email', 'dog', 'cat', 'fish'],
})

room.addComponent(formElements)

return room;
}

initializeSuperVizRoom();
41 changes: 41 additions & 0 deletions js/cdn/forms-elements/public/styles/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
body {
margin: 0;
min-height: 100vh;
}

.formelements {
display: flex;
flex-direction: column;
height: 100%;
gap: 1rem;
background: #c9c4d1;
border-radius: 6px;
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
padding: 1rem 1.5rem;
align-items: center;
justify-content: center;
color: #333;
}

.formelements h1 {
margin: 0;
}

.formelements input {
padding: 0.5rem;
margin: 0.5rem 0 0;
border-radius: 6px;
width: 320px;
}

.formelements input[type='radio'] {
width: auto;
}

.formelements .radio-option {
display: flex;
align-items: center;
justify-content: space-between;
width: 340px;
margin-top: 0.5rem;
}
27 changes: 27 additions & 0 deletions js/cdn/forms-elements/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Sample for Forms Editor (Cdn/JavaScript)

### SuperViz SDK

This project hosts samples for SuperViz SDK. To find out more about the SDK itself, please visit [the documentation](https://docs.superviz.com/).

The SDK documentation has extensive sections about [getting started](https://docs.superviz.com/getting-started/quickstart), setting up the SDK, as well as the process of acquiring the required developer key.

## Build and run the samples

You can run this sample with npm:

```bash
npm install
npm start
```

or with Yarn:

```bash
yarn install
yarn start
```

Just make sure that you have the required developer keys in the `.env` file. For that copy the `.env.example` file to `.env` and fill in the values.

You will need Developer Key keys to run the samples on your machines, you therefore should [follow the instructions on these pages](https://docs.superviz.com/getting-started/setting-account) before continuing.
Loading

0 comments on commit d0c78fa

Please sign in to comment.