Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"docusaurus-lunr-search": "3.4.0",
"prism-react-renderer": "2.3.1",
"react": "18.3.1",
"react-dom": "18.3.1"
"react-dom": "18.3.1",
"@stackblitz/sdk": "^1.8.0"
},
"devDependencies": {
"@docusaurus/types": "3.4.0",
Expand Down
34 changes: 34 additions & 0 deletions docs/src/components/AskUIEmbedded/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import sdk from '@stackblitz/sdk';

export function AskUIEmbedded(props): JSX.Element {
const { projectId, embedOpts = {}, openOpts,
files, settings, ...other }
= props || {};
async function handleClick(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) {
// TODO create remote machine and get AskUI Controller URL + VNC URL
const remoteDeviceControllerURL = 'http://localhost:6769';
files['.env'] = files['.env'].replace("RACU", remoteDeviceControllerURL);
console.log(files['.env'])
const vm = await sdk.embedProjectId(
'embedStackBlitz',
projectId,
{
hideExplorer: false,
showSidebar: true,
hideNavigation: false,
height: 600,
openFile: 'askui_example/my-first-askui-test-suite.test.ts',
}
);
await vm.applyFsDiff({
create: {
'.env': files['.env'],
},
destroy: [],
});
}
return (
<button type="button" {...other} onClick={handleClick} class="button button--secondary">Try in Browser!</button>
);
}
23 changes: 23 additions & 0 deletions docs/src/components/InstallationCards/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import Link from '@docusaurus/Link';
import Image from '@theme/IdealImage';
import Heading from '@theme/Heading';

import {AskUIEmbedded} from '@site/src/components/AskUIEmbedded';

const Playgrounds = [
{
name: '📦 Quickstart',
Expand Down Expand Up @@ -137,6 +139,27 @@ function PlaygroundCard({name, url, description, cta, idbutton}: Props) {
export function InstallationCardsRow(): JSX.Element {
return (
<div className="row">
<div class="col col--4 margin-bottom--lg">
<div class="card">
<div class="card__body">
<h3>📦 Stackblitz</h3>
<p>Try AskUI without any hassle in your browser!</p>
</div>
<div class="card__footer">
<div class="button-group button-group--block">
<AskUIEmbedded
projectId="vitejs-vite-khtc7d"
files={{
".env": 'ASKUI_WORKSPACE_ID=AWI\nASKUI_TOKEN=AT\nREMOTE_ASKUI_CONTROLLER_URL=RACU\nREMOTE_VNC=RVNV'
}}
>
Basic Example Open in StackBlitz
</AskUIEmbedded>
</div>
</div>
</div>
</div>
<div id="embedStackBlitz">&nbsp;</div>
{Playgrounds.map((playground) => (
<PlaygroundCard key={playground.name} {...playground} />
))}
Expand Down