Skip to content
Open
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
238 changes: 238 additions & 0 deletions packages/agent-playground/app/mock-scenarios.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
import type { AgentSession, Theme } from "../../react-grab/src/types";

interface MockScenario {
id: string;
name: string;
description: string;
session: AgentSession;
theme: Theme;
}

export const MOCK_SCENARIOS: MockScenario[] = [
{
id: "scenario-button-styling",
name: "Button Styling",
description: "Style a button with colors and effects",
session: {
id: "playground-session-1",
context: {
content: ['<button class="cta-button">Get Started</button>'],
prompt:
"Make this button stand out with a gradient background and shadow",
options: {},
},
lastStatus: "Ready to apply changes",
isStreaming: false,
createdAt: Date.now(),
lastUpdatedAt: Date.now(),
position: { x: 100, y: 100 },
selectionBounds: [
{
x: 50,
y: 50,
width: 140,
height: 45,
borderRadius: "8px",
transform: "translate(0, 0)",
},
],
tagName: "button",
componentName: "CTAButton",
},
theme: {
enabled: true,
hue: 280,
selectionBox: { enabled: true },
dragBox: { enabled: true },
grabbedBoxes: { enabled: true },
elementLabel: { enabled: true },
crosshair: { enabled: true },
toolbar: { enabled: true },
},
},
{
id: "scenario-card-layout",
name: "Card Layout",
description: "Adjust card spacing and shadows",
session: {
id: "playground-session-2",
context: {
content: [
'<div class="feature-card"><img src="icon.svg" alt="Feature" /><h3>Feature Title</h3><p>Feature description text</p></div>',
],
prompt:
"Improve the card layout with better spacing and a subtle shadow",
options: {},
},
lastStatus: "Changes applied",
isStreaming: false,
createdAt: Date.now() - 60000,
lastUpdatedAt: Date.now() - 55000,
position: { x: 200, y: 150 },
selectionBounds: [
{
x: 150,
y: 120,
width: 300,
height: 200,
borderRadius: "12px",
transform: "translate(0, 0)",
},
],
tagName: "div",
componentName: "FeatureCard",
},
theme: {
enabled: true,
hue: 200,
selectionBox: { enabled: true },
dragBox: { enabled: true },
grabbedBoxes: { enabled: true },
elementLabel: { enabled: true },
crosshair: { enabled: true },
toolbar: { enabled: true },
},
},
{
id: "scenario-form-input",
name: "Form Input",
description: "Style form input with focus states",
session: {
id: "playground-session-3",
context: {
content: [
'<input type="text" placeholder="Enter your name…" class="form-input" />',
],
prompt: "Add focus states and improve the input styling",
options: {},
},
lastStatus: "Streaming updates…",
isStreaming: true,
createdAt: Date.now() - 10000,
lastUpdatedAt: Date.now() - 1000,
position: { x: 150, y: 250 },
selectionBounds: [
{
x: 100,
y: 220,
width: 320,
height: 48,
borderRadius: "6px",
transform: "translate(0, 0)",
},
],
tagName: "input",
},
theme: {
enabled: true,
hue: 140,
selectionBox: { enabled: true },
dragBox: { enabled: true },
grabbedBoxes: { enabled: true },
elementLabel: { enabled: true },
crosshair: { enabled: true },
toolbar: { enabled: true },
},
},
{
id: "scenario-navigation",
name: "Navigation Bar",
description: "Responsive navigation with hover effects",
session: {
id: "playground-session-4",
context: {
content: [
'<nav class="main-nav"><a href="/">Home</a><a href="/features">Features</a><a href="/pricing">Pricing</a><a href="/docs">Docs</a></nav>',
],
prompt:
"Make this navigation responsive and add smooth hover transitions",
options: {},
},
lastStatus: "Ready to apply",
isStreaming: false,
createdAt: Date.now() - 120000,
lastUpdatedAt: Date.now() - 115000,
position: { x: 50, y: 50 },
selectionBounds: [
{
x: 20,
y: 20,
width: 600,
height: 60,
borderRadius: "0",
transform: "translate(0, 0)",
},
],
tagName: "nav",
componentName: "MainNavigation",
},
theme: {
enabled: true,
hue: 0,
selectionBox: { enabled: true },
dragBox: { enabled: true },
grabbedBoxes: { enabled: true },
elementLabel: { enabled: true },
crosshair: { enabled: true },
toolbar: { enabled: true },
},
},
{
id: "scenario-minimal-theme",
name: "Minimal Theme",
description: "Test with minimal UI overlays",
session: {
id: "playground-session-5",
context: {
content: ['<div class="container"><h1>Minimal Example</h1></div>'],
prompt: "Apply minimal styling with reduced visual noise",
options: {},
},
lastStatus: "Changes applied successfully",
isStreaming: false,
createdAt: Date.now() - 240000,
lastUpdatedAt: Date.now() - 235000,
position: { x: 180, y: 120 },
selectionBounds: [
{
x: 120,
y: 80,
width: 400,
height: 100,
borderRadius: "4px",
transform: "translate(0, 0)",
},
],
tagName: "div",
componentName: "Container",
},
theme: {
enabled: true,
hue: 0,
selectionBox: { enabled: true },
dragBox: { enabled: false },
grabbedBoxes: { enabled: false },
elementLabel: { enabled: true },
crosshair: { enabled: false },
toolbar: { enabled: true },
},
},
];

export const getScenarioById = (
scenarioId: string,
): MockScenario | undefined => {
return MOCK_SCENARIOS.find((scenario) => scenario.id === scenarioId);
};

export const getScenarioNames = (): Array<{
id: string;
name: string;
description: string;
}> => {
return MOCK_SCENARIOS.map((scenario) => ({
id: scenario.id,
name: scenario.name,
description: scenario.description,
}));
};
Loading