|
| 1 | +import { Show } from 'solid-js' |
| 2 | +import CodeBlock from '../CodeBlock' |
| 3 | +import Badge from '../ui/Badge' |
| 4 | +import SurfaceCard from '../ui/SurfaceCard' |
| 5 | + |
| 6 | +type PlaygroundLandingProps = { |
| 7 | + creatingSession: boolean |
| 8 | + error?: string |
| 9 | + onStartManualSession: () => void | Promise<void> |
| 10 | +} |
| 11 | + |
| 12 | +const MCP_CONFIG_SNIPPET = `{ |
| 13 | + "mcpServers": { |
| 14 | + "shaderbase": { |
| 15 | + "url": "https://mcp.shaderbase.com/mcp" |
| 16 | + } |
| 17 | + } |
| 18 | +}` |
| 19 | + |
| 20 | +const CREATE_PLAYGROUND_SNIPPET = `create_playground({ |
| 21 | + language: "tsl", |
| 22 | + pipeline: "surface" |
| 23 | +})` |
| 24 | + |
| 25 | +export default function PlaygroundLanding(props: PlaygroundLandingProps) { |
| 26 | + return ( |
| 27 | + <main class="relative overflow-hidden"> |
| 28 | + <div class="pointer-events-none absolute inset-0 bg-[radial-gradient(circle_at_top_left,rgba(5,150,105,0.14),transparent_36%),radial-gradient(circle_at_bottom_right,rgba(15,23,41,0.08),transparent_34%)]" /> |
| 29 | + |
| 30 | + <div class="mx-auto flex min-h-[calc(100dvh-56px)] w-full max-w-6xl items-center px-4 py-10 sm:py-14"> |
| 31 | + <SurfaceCard class="relative w-full overflow-hidden rounded-[2rem] border-white/70 bg-white/85 p-6 shadow-[0_30px_80px_-40px_rgba(15,23,41,0.35)] backdrop-blur-xl sm:p-8 lg:p-10"> |
| 32 | + <div class="pointer-events-none absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-white/80 to-transparent" /> |
| 33 | + |
| 34 | + <div class="grid gap-10 lg:grid-cols-[1.15fr_0.9fr] lg:gap-12"> |
| 35 | + <div> |
| 36 | + <div class="mb-5 flex flex-wrap gap-2"> |
| 37 | + <Badge label="agent-first" variant="accent" /> |
| 38 | + <Badge label="mcp session" /> |
| 39 | + <Badge label="manual fallback" /> |
| 40 | + </div> |
| 41 | + |
| 42 | + <h1 class="max-w-xl text-4xl font-semibold tracking-tight text-text-primary sm:text-5xl"> |
| 43 | + The playground is built for agents to drive live shader iteration. |
| 44 | + </h1> |
| 45 | + |
| 46 | + <p class="mt-4 max-w-2xl text-base leading-7 text-text-secondary"> |
| 47 | + Connect an AI client to ShaderBase's MCP server, call |
| 48 | + {' '} |
| 49 | + <code class="rounded bg-surface-secondary px-1.5 py-0.5 font-mono text-[0.9em] text-text-primary"> |
| 50 | + create_playground |
| 51 | + </code> |
| 52 | + , then keep iterating with live previews, screenshots, and structured error feedback. |
| 53 | + </p> |
| 54 | + |
| 55 | + <ol class="mt-8 space-y-3"> |
| 56 | + <li class="flex gap-4 rounded-2xl border border-surface-card-border/80 bg-surface-primary/70 px-4 py-4"> |
| 57 | + <span class="font-mono text-xs font-semibold tracking-[0.18em] text-accent">01</span> |
| 58 | + <p class="text-sm leading-6 text-text-secondary"> |
| 59 | + Point your MCP client at |
| 60 | + {' '} |
| 61 | + <code class="font-mono text-text-primary">https://mcp.shaderbase.com/mcp</code> |
| 62 | + {' '} |
| 63 | + so it can access the remote ShaderBase tools. |
| 64 | + </p> |
| 65 | + </li> |
| 66 | + |
| 67 | + <li class="flex gap-4 rounded-2xl border border-surface-card-border/80 bg-surface-primary/70 px-4 py-4"> |
| 68 | + <span class="font-mono text-xs font-semibold tracking-[0.18em] text-accent">02</span> |
| 69 | + <p class="text-sm leading-6 text-text-secondary"> |
| 70 | + Start a session with |
| 71 | + {' '} |
| 72 | + <code class="font-mono text-text-primary">create_playground</code> |
| 73 | + {' '} |
| 74 | + and open the returned |
| 75 | + {' '} |
| 76 | + <code class="font-mono text-text-primary">/playground?session=...</code> |
| 77 | + {' '} |
| 78 | + URL in a browser tab. |
| 79 | + </p> |
| 80 | + </li> |
| 81 | + |
| 82 | + <li class="flex gap-4 rounded-2xl border border-surface-card-border/80 bg-surface-primary/70 px-4 py-4"> |
| 83 | + <span class="font-mono text-xs font-semibold tracking-[0.18em] text-accent">03</span> |
| 84 | + <p class="text-sm leading-6 text-text-secondary"> |
| 85 | + Iterate from your agent with |
| 86 | + {' '} |
| 87 | + <code class="font-mono text-text-primary">update_shader</code> |
| 88 | + , |
| 89 | + {' '} |
| 90 | + <code class="font-mono text-text-primary">get_preview</code> |
| 91 | + , and |
| 92 | + {' '} |
| 93 | + <code class="font-mono text-text-primary">get_errors</code> |
| 94 | + . |
| 95 | + </p> |
| 96 | + </li> |
| 97 | + </ol> |
| 98 | + |
| 99 | + <div class="mt-8 grid gap-4 sm:grid-cols-2"> |
| 100 | + <div class="rounded-2xl border border-surface-card-border/80 bg-surface-primary/70 p-4"> |
| 101 | + <p class="text-[0.68rem] font-semibold uppercase tracking-[0.2em] text-text-muted"> |
| 102 | + MCP endpoint |
| 103 | + </p> |
| 104 | + <a |
| 105 | + href="https://mcp.shaderbase.com/mcp" |
| 106 | + target="_blank" |
| 107 | + rel="noopener noreferrer" |
| 108 | + class="mt-2 block break-all font-mono text-sm text-accent transition hover:text-accent/75" |
| 109 | + > |
| 110 | + https://mcp.shaderbase.com/mcp |
| 111 | + </a> |
| 112 | + </div> |
| 113 | + |
| 114 | + <div class="rounded-2xl border border-surface-card-border/80 bg-surface-primary/70 p-4"> |
| 115 | + <p class="text-[0.68rem] font-semibold uppercase tracking-[0.2em] text-text-muted"> |
| 116 | + Playground tools |
| 117 | + </p> |
| 118 | + <p class="mt-2 text-sm leading-6 text-text-secondary"> |
| 119 | + <code class="font-mono text-text-primary">create_playground</code> |
| 120 | + ,{' '} |
| 121 | + <code class="font-mono text-text-primary">update_shader</code> |
| 122 | + ,{' '} |
| 123 | + <code class="font-mono text-text-primary">get_preview</code> |
| 124 | + ,{' '} |
| 125 | + <code class="font-mono text-text-primary">get_errors</code> |
| 126 | + </p> |
| 127 | + </div> |
| 128 | + </div> |
| 129 | + |
| 130 | + <div class="mt-8 flex flex-col gap-3 sm:flex-row"> |
| 131 | + <a |
| 132 | + href="https://mcp.shaderbase.com" |
| 133 | + target="_blank" |
| 134 | + rel="noopener noreferrer" |
| 135 | + class="inline-flex items-center justify-center rounded-xl bg-accent px-4 py-3 text-sm font-semibold text-white transition hover:-translate-y-[1px] hover:bg-accent/90 active:translate-y-0 active:scale-[0.98]" |
| 136 | + > |
| 137 | + Open MCP server |
| 138 | + </a> |
| 139 | + |
| 140 | + <button |
| 141 | + type="button" |
| 142 | + onClick={() => void props.onStartManualSession()} |
| 143 | + disabled={props.creatingSession} |
| 144 | + class="inline-flex items-center justify-center rounded-xl border border-surface-card-border bg-surface-card px-4 py-3 text-sm font-semibold text-text-primary transition hover:-translate-y-[1px] hover:border-accent/30 hover:text-accent disabled:cursor-wait disabled:opacity-70 active:translate-y-0 active:scale-[0.98]" |
| 145 | + > |
| 146 | + {props.creatingSession ? 'Starting manual session...' : 'Start manual session'} |
| 147 | + </button> |
| 148 | + </div> |
| 149 | + |
| 150 | + <p class="mt-3 text-sm text-text-muted"> |
| 151 | + Manual sessions are useful for quick experiments, but they are not the primary MCP workflow. |
| 152 | + </p> |
| 153 | + |
| 154 | + <Show when={props.error}> |
| 155 | + <div class="mt-4 rounded-2xl border border-danger/20 bg-danger-dim/35 px-4 py-3 text-sm text-danger"> |
| 156 | + <p role="alert" aria-live="assertive">{props.error}</p> |
| 157 | + </div> |
| 158 | + </Show> |
| 159 | + </div> |
| 160 | + |
| 161 | + <div class="space-y-4"> |
| 162 | + <div class="rounded-[1.5rem] border border-surface-card-border/80 bg-surface-primary/80 p-4"> |
| 163 | + <p class="mb-3 text-[0.68rem] font-semibold uppercase tracking-[0.2em] text-text-muted"> |
| 164 | + Connect your client |
| 165 | + </p> |
| 166 | + <CodeBlock code={MCP_CONFIG_SNIPPET} language="Claude config" /> |
| 167 | + </div> |
| 168 | + |
| 169 | + <div class="rounded-[1.5rem] border border-surface-card-border/80 bg-surface-primary/80 p-4"> |
| 170 | + <p class="mb-3 text-[0.68rem] font-semibold uppercase tracking-[0.2em] text-text-muted"> |
| 171 | + Start a playground |
| 172 | + </p> |
| 173 | + <CodeBlock code={CREATE_PLAYGROUND_SNIPPET} language="Tool call" /> |
| 174 | + </div> |
| 175 | + </div> |
| 176 | + </div> |
| 177 | + </SurfaceCard> |
| 178 | + </div> |
| 179 | + </main> |
| 180 | + ) |
| 181 | +} |
0 commit comments